Debian Codegraph @

clang/test/Modules/local-submodule-visibility-transitive-import.c

raw
1 // Checks that macros from transitive imports work with local submodule
2 // visibility. In the below test, previously a() and d() failed because
3 // OTHER_MACRO1 and OTHER_MACRO3 were not visible at the use site.
4
5 // RUN: rm -rf %t
6 // RUN: split-file %s %t
7 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
8 // RUN: -fmodules-local-submodule-visibility -I%t %t/tu.c -verify
9
10 //--- Other1.h
11 #define OTHER_MACRO1(...)
12
13 //--- Other2.h
14 #define OTHER_MACRO2(...)
15
16 //--- Other3.h
17 #define OTHER_MACRO3(...)
18
19 //--- module.modulemap
20 module Other {
21 module O1 { header "Other1.h" }
22 module O2 { header "Other2.h" }
23 module O3 { header "Other3.h" }
24 }
25
26 //--- Top/A.h
27 #include "Other1.h"
28 #define MACRO_A OTHER_MACRO1(x, y)
29
30 //--- Top/B.h
31 #include "Other2.h"
32 #define MACRO_B OTHER_MACRO2(x, y)
33
34 //--- Top/C.h
35 #include "D.h"
36
37 //--- Top/D.h
38 #include "Other3.h"
39 #define MACRO_D OTHER_MACRO3(x, y)
40
41 //--- Top/Top.h
42 #include "A.h"
43 #include "B.h"
44 #include "C.h"
45
46 void a() MACRO_A;
47 void b() MACRO_B;
48 void d() MACRO_D;
49
50 //--- Top/module.modulemap
51 module Top {
52 umbrella header "Top.h"
53 module A { header "A.h" export * }
54 module D { header "D.h" export * }
55 module * { export * }
56 export *
57 export Other.O3
58 }
59
60 //--- tu.c
61 #include "Top/Top.h"
62 // expected-no-diagnostics