xref: /llvm-project/clang/test/Modules/cxx20-import-diagnostics-b.cpp (revision da00c60dae0040185dc45039c4397f6e746548e9)
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/a.cpp -o %t/a.pcm
6 
7 // RUN: %clang_cc1 -std=c++20 -emit-module-interface  %t/c.cpp \
8 // RUN: -fmodule-file=a=%t/a.pcm -o %t/c.pcm
9 
10 // RUN: %clang_cc1 -std=c++20 -emit-module-interface  %t/d.cpp \
11 // RUN: -fmodule-file=a=%t/a.pcm -o %t/d.pcm
12 
13 // RUN: %clang_cc1 -std=c++20 -emit-module-interface  %t/e.cpp \
14 // RUN: -fmodule-file=a=%t/a.pcm -o %t/e.pcm
15 
16 // RUN: %clang_cc1 -std=c++20 -emit-module-interface  %t/a-part.cpp \
17 // RUN: -o %t/a-part.pcm
18 
19 // RUN: %clang_cc1 -std=c++20 -emit-module-interface  %t/f.cpp \
20 // RUN: -fmodule-file=a=%t/a.pcm -o %t/f.pcm -verify
21 
22 // RUN: %clang_cc1 -std=c++20 -emit-module-interface  %t/g.cpp \
23 // RUN: -fmodule-file=a=%t/a.pcm -o %t/g.pcm -verify
24 
25 // Test again with reduced BMI.
26 // RUN: rm -rf %t
27 // RUN: mkdir -p %t
28 // RUN: split-file %s %t
29 
30 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface  %t/a.cpp -o %t/a.pcm
31 
32 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface  %t/c.cpp \
33 // RUN: -fmodule-file=a=%t/a.pcm -o %t/c.pcm
34 
35 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface  %t/d.cpp \
36 // RUN: -fmodule-file=a=%t/a.pcm -o %t/d.pcm
37 
38 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface  %t/e.cpp \
39 // RUN: -fmodule-file=a=%t/a.pcm -o %t/e.pcm
40 
41 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface  %t/a-part.cpp \
42 // RUN: -o %t/a-part.pcm
43 
44 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface  %t/f.cpp \
45 // RUN: -fmodule-file=a=%t/a.pcm -o %t/f.pcm -verify
46 
47 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface  %t/g.cpp \
48 // RUN: -fmodule-file=a=%t/a.pcm -o %t/g.pcm -verify
49 
50 //--- a.cpp
51 export module a;
52 
53 //--- b.hpp
54 import a;
55 
56 //--- c.cpp
57 module;
58 #include "b.hpp"
59 export module c;
60 
61 //--- d.cpp
62 module;
63 import a;
64 
65 export module d;
66 
67 //--- e.cpp
68 export module e;
69 
70 module :private;
71 import a;
72 
73 //--- a-part.cpp
74 export module a:part;
75 
76 //--- f.cpp
77 module;
78 import :part ; // expected-error {{module partition imports cannot be in the global module fragment}}
79 
80 export module f;
81 
82 //--- g.cpp
83 
84 export module g;
85 module :private;
86 import :part; // expected-error {{module partition imports cannot be in the private module fragment}}
87