xref: /llvm-project/clang/test/Modules/mismatch-diagnostics.cpp (revision 99de065b850b6e1c5461325998a40c6925d7ee9e)
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
3 // RUN: split-file %s %t
4 // RUN: mkdir -p %t/prebuilt_modules
5 //
6 // RUN: %clang_cc1 -triple %itanium_abi_triple                          \
7 // RUN:     -std=c++20 -fprebuilt-module-path=%t/prebuilt-modules       \
8 // RUN:     -emit-module-interface -pthread -DBUILD_MODULE              \
9 // RUN:     %t/mismatching_module.cppm -o                               \
10 // RUN:     %t/prebuilt_modules/mismatching_module.pcm
11 //
12 // RUN: not %clang_cc1 -triple %itanium_abi_triple -std=c++20           \
13 // RUN:     -fprebuilt-module-path=%t/prebuilt_modules -DCHECK_MISMATCH \
14 // RUN:     %t/use.cpp 2>&1 | FileCheck %s
15 
16 // Test again with reduced BMI.
17 // RUN: %clang_cc1 -triple %itanium_abi_triple                          \
18 // RUN:     -std=c++20 -fprebuilt-module-path=%t/prebuilt-modules       \
19 // RUN:     -emit-reduced-module-interface -pthread -DBUILD_MODULE              \
20 // RUN:     %t/mismatching_module.cppm -o                               \
21 // RUN:     %t/prebuilt_modules/mismatching_module.pcm
22 //
23 // RUN: not %clang_cc1 -triple %itanium_abi_triple -std=c++20           \
24 // RUN:     -fprebuilt-module-path=%t/prebuilt_modules -DCHECK_MISMATCH \
25 // RUN:     %t/use.cpp 2>&1 | FileCheck %s
26 
27 //--- mismatching_module.cppm
28 export module mismatching_module;
29 
30 //--- use.cpp
31 import mismatching_module;
32 // CHECK: error: POSIX thread support was enabled in AST file '{{.*[/|\\\\]}}mismatching_module.pcm' but is currently disabled
33 // CHECK-NEXT: module file {{.*[/|\\\\]}}mismatching_module.pcm cannot be loaded due to a configuration mismatch with the current compilation
34