1 // RUN: rm -rf %t
2 //
3 // RUN: %clang_cc1 %s \
4 // RUN:   -fmodules-local-submodule-visibility \
5 // RUN:   -fmodule-map-file=%S/Inputs/lsv-private-macro/mod.map \
6 // RUN:   -I%S/Inputs/lsv-private-macro -fmodule-name=self \
7 // RUN:   -verify=expected-lsv
8 //
9 // RUN: %clang_cc1 %s \
10 // RUN:   -fmodules -fmodules-cache-path=%t \
11 // RUN:   -fmodule-map-file=%S/Inputs/lsv-private-macro/mod.map \
12 // RUN:   -I%S/Inputs/lsv-private-macro -fmodule-name=self \
13 // RUN:   -verify=expected-nolsv
14 //
15 // RUN: %clang_cc1 %s \
16 // RUN:   -fmodules -fmodules-cache-path=%t \
17 // RUN:   -fmodules-local-submodule-visibility \
18 // RUN:   -fmodule-map-file=%S/Inputs/lsv-private-macro/mod.map \
19 // RUN:   -I%S/Inputs/lsv-private-macro -fmodule-name=self \
20 // RUN:   -verify=expected-lsv
21 
22 #include "self.h"
23 
24 // With local submodule visibility enabled, private macros don't leak out of
25 // their respective submodules, even within the same top-level module.
26 // expected-lsv-no-diagnostics
27 
28 // expected-nolsv-error@+2 {{SELF_PRIVATE defined}}
29 #ifdef SELF_PRIVATE
30 #error SELF_PRIVATE defined
31 #endif
32 
33 #ifndef SELF_PUBLIC
34 #error SELF_PUBLIC not defined
35 #endif
36 
37 #ifndef SELF_DEFAULT
38 #error SELF_DEFAULT not defined
39 #endif
40 
41 #include "other.h"
42 
43 #ifdef OTHER_PRIVATE
44 #error OTHER_PRIVATE defined
45 #endif
46 
47 #ifndef OTHER_PUBLIC
48 #error OTHER_PUBLIC not defined
49 #endif
50 
51 #ifndef OTHER_DEFAULT
52 #error OTHER_DEFAULT not defined
53 #endif
54