Debian Codegraph @

clang/test/Modules/pr145975.cppm

raw
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4
5 // RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm
6 // RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm \
7 // RUN: -fmodule-file=a:b=%t/b.pcm
8 // RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -o %t/c.pcm \
9 // RUN: -fmodule-file=a:b=%t/b.pcm -fmodule-file=a=%t/a.pcm
10
11 // RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -o %t/b.pcm
12 // RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm \
13 // RUN: -fmodule-file=a:b=%t/b.pcm
14 // RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-reduced-module-interface -o %t/c.pcm \
15 // RUN: -fmodule-file=a:b=%t/b.pcm -fmodule-file=a=%t/a.pcm
16
17
18 //--- b.cppm
19 export module a:b;
20 class Polymorphic {
21 public:
22 virtual ~Polymorphic() = default;
23 };
24
25 //--- a.h
26 namespace std {
27 using X = int;
28 }
29
30 namespace a {
31 using std::X;
32 }
33
34 //--- a.cppm
35 module;
36 #include "a.h"
37 export module a;
38 import :b;
39 std::X var;
40 namespace std {
41 export using std::X;
42 }
43 namespace a {
44 export using std::X;
45 }
46
47 //--- c.cppm
48 export module c;
49 import a;
50 namespace a {
51 export using std::X;
52 }
53
54 namespace a {
55 X test() {
56 return X{};
57 }
58 }