Debian Codegraph @

clang/test/Modules/pr61067.cppm

raw
1 // From https://github.com/llvm/llvm-project/issues/61067
2 // RUN: rm -rf %t
3 // RUN: mkdir -p %t
4 // RUN: split-file %s %t
5 //
6 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/a.cppm \
7 // RUN: -emit-module-interface -o %t/a.pcm
8 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/b.cppm \
9 // RUN: -emit-module-interface -fmodule-file=a=%t/a.pcm -o %t/b.pcm
10 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/b.pcm \
11 // RUN: -emit-llvm -fmodule-file=a=%t/a.pcm -disable-llvm-passes -o - | FileCheck %t/b.cppm
12 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/c.cpp -fmodule-file=a=%t/a.pcm \
13 // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %t/c.cpp
14
15 // Test again with reduced BMI
16 // RUN: rm -rf %t
17 // RUN: mkdir -p %t
18 // RUN: split-file %s %t
19 //
20 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/a.cppm \
21 // RUN: -emit-reduced-module-interface -o %t/a.pcm
22 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/b.cppm \
23 // RUN: -emit-module-interface -fmodule-file=a=%t/a.pcm -o %t/b.pcm
24 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/b.pcm \
25 // RUN: -emit-llvm -fmodule-file=a=%t/a.pcm -disable-llvm-passes -o - | FileCheck %t/b.cppm
26 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/c.cpp -fmodule-file=a=%t/a.pcm \
27 // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %t/c.cpp
28
29 //--- a.cppm
30 export module a;
31
32 export struct a {
33 friend bool operator==(a, a) = default;
34 };
35
36 //--- b.cppm
37 export module b;
38
39 import a;
40
41 void b() {
42 (void)(a() == a());
43 }
44
45 // CHECK: define{{.*}}linkonce_odr{{.*}}@_ZW1aeqS_1aS0_(
46
47 //--- c.cpp
48 import a;
49
50 int c() {
51 (void)(a() == a());
52 return 0;
53 }
54
55 // CHECK: define{{.*}}linkonce_odr{{.*}}@_ZW1aeqS_1aS0_(