xref: /llvm-project/clang/test/Modules/search-partitions.cpp (revision fce0916969218fdb4b89ad0b3e18599204d4138d)
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 %t/moduleA.cpp -fsyntax-only -verify \
15 // RUN:  -fprebuilt-module-path=%t
16 
17 // Test again with reduced BMI
18 // RUN: rm -rf %t
19 // RUN: mkdir -p %t
20 // RUN: split-file %s %t
21 
22 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/partition1.cpp \
23 // RUN:  -o %t/A-Part1.pcm
24 
25 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/partition2.cpp \
26 // RUN:  -o %t/A-Part2.pcm
27 
28 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/partition3.cpp \
29 // RUN:  -o %t/A-Part3.pcm
30 
31 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %t/moduleA.cpp -fprebuilt-module-path=%t
32 
33 //--- partition1.cpp
34 export module A:Part1;
35 
36 int part1();
37 
38 //--- partition2.cpp
39 
40 export module A:Part2;
41 
42 int part2();
43 
44 //--- partition3.cpp
45 
46 export module A:Part3;
47 
48 int part3();
49 
50 //--- moduleA.cpp
51 // expected-no-diagnostics
52 export module A;
53 
54 import :Part1;
55 export import :Part2;
56 import :Part3;
57 
58 int foo();
59