xref: /llvm-project/clang/test/Modules/cxx20-multiple-partitions.cpp (revision 69350e569dc47f871590243b5e46a68520640dcd)
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 
5 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/partition1.cpp \
6 // RUN:  -o %t/A_part1.pcm
7 
8 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/partition2.cpp \
9 // RUN:  -o %t/A_part2.pcm
10 
11 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/partition3.cpp \
12 // RUN:  -o %t/A_part3.pcm
13 
14 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/moduleA.cpp \
15 // RUN:  -fmodule-file=%t/A_part1.pcm -fmodule-file=%t/A_part2.pcm \
16 // RUN:  -fmodule-file=%t/A_part3.pcm -o %t/A.pcm
17 
18 // expected-no-diagnostics
19 
20 //--- partition1.cpp
21 
22 export module A:Part1;
23 
24 int part1();
25 
26 //--- partition2.cpp
27 
28 export module A:Part2;
29 
30 int part2();
31 
32 //--- partition3.cpp
33 
34 export module A:Part3;
35 
36 int part3();
37 
38 //--- moduleA.cpp
39 
40 export module A;
41 
42 import :Part1;
43 export import :Part2;
44 import :Part3;
45 
46 int foo();
47