xref: /llvm-project/clang/test/Modules/cxx20-partition-redeclarations.cpp (revision dc4e85bd79ff17014cbbe4a9db1d9b91929e91ce)
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: cd %t
4 
5 // RUN: %clang_cc1 -std=c++20 A-intf-part.cpp -emit-module-interface \
6 // RUN:  -o A-PubPart.pcm
7 // RUN: %clang_cc1 -std=c++20 A-interface.cpp -emit-module-interface \
8 // RUN:   -fmodule-file=A-PubPart.pcm -o A.pcm
9 
10 // RUN: %clang_cc1 -std=c++20 A-impl-top.cpp -fsyntax-only -fprebuilt-module-path=%t
11 // RUN: %clang_cc1 -std=c++20 A-impl-part.cpp -fsyntax-only -fprebuilt-module-path=%t
12 // RUN: %clang_cc1 -std=c++20 A-impl-1.cpp -fsyntax-only -fprebuilt-module-path=%t
13 // RUN: %clang_cc1 -std=c++20 A-impl-2.cpp -fsyntax-only -fprebuilt-module-path=%t
14 
15 //--- A-interface.cpp
16 export module A;
17 
18 export import :PubPart;
19 
20 export void do_something();
21 
22 void helper1();
23 void helper3();
24 
25 //--- A-intf-part.cpp
26 export module A:PubPart;
27 
28 void helper2();
29 
30 //--- A-impl-top.cpp
31 
32 module A;
33 
do_something()34 void do_something() {
35   helper1();
36   helper2();
37   helper3();
38 }
39 
40 //--- A-impl-part.cpp
41 module A:Secret;
42 
43 import A;
44 
helper3()45 void helper3() {}
46 
47 //--- A-impl-1.cpp
48 module A;
49 
helper1()50 void helper1() {}
51 
52 //--- A-impl-2.cpp
53 module A;
54 
helper2()55 void helper2() {}
56