Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3661bf7

Browse files
[Clang][Modules] Add regression test for #179178 (#187173)
This patch adds a regression test for a clang header modules failure we saw after #179178 landed. I'm too familiar with the norms for clang modules tests, so feel free to nit-pick. I've verified that this test passes at HEAD and fails with #179168 applied (i.e., the revert reverted).
1 parent aa2defc commit 3661bf7

1 file changed

Lines changed: 120 additions & 0 deletions

File tree

clang/test/Modules/pr179178.cpp

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
// RUN: rm -rf %t
2+
// RUN: mkdir %t
3+
// RUN: split-file %s %t
4+
// RUN: cd %t
5+
//
6+
// RUN: %clang -fmodule-name=//b -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -c b.cppmap -o b.pic.pcm
7+
// RUN: %clang -fmodule-name=//c -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=b.pic.pcm -c c.cppmap -o c.pic.pcm
8+
// RUN: %clang -fmodule-name=//d -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=c.pic.pcm -c d.cppmap -o d.pic.pcm
9+
// RUN: %clang -fmodule-name=//e -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=d.pic.pcm -c e.cppmap -o e.pic.pcm
10+
// RUN: %clang -fmodule-name=//f -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=e.pic.pcm -c f.cppmap -o f.pic.pcm
11+
// RUN: %clang -fmodule-name=//g -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=f.pic.pcm -c g.cppmap -o g.pic.pcm
12+
// RUN: %clang -fmodule-name=//h -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=g.pic.pcm -c h.cppmap -o h.pic.pcm
13+
// RUN: %clang -fmodule-name=//i -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=h.pic.pcm -c i.cppmap -o i.pic.pcm
14+
// RUN: %clang -fmodule-name=//j -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=i.pic.pcm -c j.cppmap -o j.pic.pcm
15+
// RUN: %clang -fmodule-name=//k -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -c k.cppmap -o k.pic.pcm
16+
// RUN: %clang -fmodule-name=//l -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=j.pic.pcm -c l.cppmap -o l.pic.pcm
17+
// RUN: %clang -fmodule-name=//m -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=k.pic.pcm -c m.cppmap -o m.pic.pcm
18+
// RUN: %clang -fmodule-name=//n -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=l.pic.pcm -Xclang=-fmodule-file=m.pic.pcm -c n.cppmap -o n.pic.pcm
19+
// RUN: %clang -fmodule-name=//o -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -xc++ -Xclang=-emit-module -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=n.pic.pcm -c o.cppmap -o o.pic.pcm
20+
// RUN: %clang -Xclang=-fno-cxx-modules -Xclang=-fmodule-map-file-home-is-cwd -fmodules -fno-implicit-modules -fno-implicit-module-maps -Xclang=-fmodule-file=o.pic.pcm -c a.cc -o a.o
21+
22+
//--- a.cc
23+
#include "k.h"
24+
namespace base {
25+
namespace internal {}
26+
}
27+
REGISTER_MODULE_INITIALIZER(, );
28+
29+
30+
//--- b.cppmap
31+
module "//b" {
32+
header "b.h"
33+
}
34+
35+
36+
//--- b.h
37+
namespace base {}
38+
39+
40+
//--- c.cppmap
41+
module "//c" {
42+
}
43+
44+
45+
//--- d.cppmap
46+
module "//d" {
47+
}
48+
49+
50+
//--- e.cppmap
51+
module "//e" {
52+
}
53+
54+
55+
//--- f.cppmap
56+
module "//f" {
57+
}
58+
59+
60+
//--- g.cppmap
61+
module "//g" {
62+
}
63+
64+
65+
//--- h.cppmap
66+
module "//h" {
67+
}
68+
69+
70+
//--- i.cppmap
71+
module "//i" {
72+
}
73+
74+
75+
//--- j.cppmap
76+
module "//j" {
77+
}
78+
79+
80+
//--- k.cppmap
81+
module "//k" {
82+
header "k.h"
83+
}
84+
85+
86+
//--- k.h
87+
namespace base {
88+
namespace internal {
89+
struct LiteralTag ;
90+
}
91+
}
92+
class FooInitializer ;
93+
#define REGISTER_INITIALIZER(type, name, body) void foo_init__() ; FooInitializer initializer_name( base::internal::LiteralTag\
94+
foo_init__)
95+
#define REGISTER_MODULE_INITIALIZER(name, body) REGISTER_INITIALIZER(, , )
96+
97+
98+
//--- l.cppmap
99+
module "//l" {
100+
}
101+
102+
103+
//--- m.cppmap
104+
module "//m" {
105+
}
106+
107+
108+
//--- n.cppmap
109+
module "//n" {
110+
header "n.h"
111+
}
112+
113+
114+
//--- n.h
115+
namespace base {}
116+
117+
118+
//--- o.cppmap
119+
module "//o" {
120+
}

0 commit comments

Comments
 (0)