Files
clang-p2996/clang/test/Modules/pr61783.cppm
Chuanqi Xu 5bbadec2d1 Recommit [C++20] [Modules] Don't load declaration eagerly for named modules
Close https://github.com/llvm/llvm-project/issues/61064.

The root cause of the issue is that we will deserilize some declarations
eagerly when reading the BMI. However, many declarations in the BMI are
not necessary for the importer. So it wastes a lot of time.

The new commit handles the MSVC's extension #pragma comment and #pragma
detect_mismatch to follow MSVC's behavior. See pr61783 for details.
2023-04-06 11:01:58 +08:00

30 lines
1.0 KiB
C++

// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 -triple x86_64-pc-windows-msvc19.11.0 -fms-extensions %t/mod.cppm -emit-module-interface \
// RUN: -o %t/mod.pcm
// RUN: %clang_cc1 -std=c++20 -triple x86_64-pc-windows-msvc19.11.0 -fms-extensions %t/mod.pcm -S -emit-llvm -o - | \
// RUN: FileCheck %t/mod.cppm
// RUN: %clang_cc1 -std=c++20 -triple x86_64-pc-windows-msvc19.11.0 -fms-extensions %t/user.cpp -fmodule-file=mod=%t/mod.pcm \
// RUN: -S -emit-llvm -o - | FileCheck %t/user.cpp
//--- mod.cppm
module;
#pragma comment(lib, "msvcprt.lib")
#pragma detect_mismatch("myLib_version", "9")
export module mod;
// CHECK: ![[NUM:[0-9]+]] ={{.*}}msvcprt.lib
// CHECK: ![[NUM:[0-9]+]] ={{.*}}FAILIFMISMATCH{{.*}}myLib_version=9
//--- user.cpp
#pragma detect_mismatch("myLib_version", "1")
import mod;
// CHECK: ![[NUM:[0-9]+]] ={{.*}}FAILIFMISMATCH{{.*}}myLib_version=1
// CHECK: ![[NUM:[0-9]+]] ={{.*}}msvcprt.lib
// CHECK: ![[NUM:[0-9]+]] ={{.*}}FAILIFMISMATCH{{.*}}myLib_version=9