Debian Codegraph @

clang/test/CXX/module/module.import/p7.cpp

raw
1 // RUN: mkdir -p %t
2 // RUN: split-file %s %t
3
4 // All of the following should build without diagnostics.
5 //
6 // RUN: %clang_cc1 -std=c++20 %t/a.cpp -emit-module-interface -o %t/a.pcm
7 // R U N: %clang_cc1 -std=c++20 %t/a.pcm -emit-obj -o %t/a.o
8 //
9 // RUN: %clang_cc1 -std=c++20 %t/b.cpp -emit-module-interface -o %t/b.pcm \
10 // RUN: -fprebuilt-module-path=%t
11 // R U N: %clang_cc1 -std=c++20 %t/b.pcm -emit-obj -o %t/b.o
12 //
13 // RUN: %clang_cc1 -std=c++20 %t/b-impl.cpp -emit-obj -o %t/b-impl.o \
14 // RUN: -fprebuilt-module-path=%t
15 //
16 // RUN: %clang_cc1 -std=c++20 %t/ab-main.cpp -fsyntax-only \
17 // RUN: -fprebuilt-module-path=%t
18
19 //--- a.cpp
20
21 export module a;
22
23 export int foo() {
24 return 42;
25 }
26
27 //--- b.cpp
28
29 export module b;
30 import a;
31
32 export int bar();
33
34 //--- b-impl.cpp
35
36 module b;
37
38 int bar() {
39 return foo();
40 }
41
42 //--- ab-main.cpp
43
44 import b;
45
46 int main() {
47 return bar();
48 }
49