[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / lsv-private-macro.cpp
blob6564558453e3ab2e8734a75628505ff85a3a4695
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
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
22 #include "self.h"
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
28 // expected-nolsv-error@+2 {{SELF_PRIVATE defined}}
29 #ifdef SELF_PRIVATE
30 #error SELF_PRIVATE defined
31 #endif
33 #ifndef SELF_PUBLIC
34 #error SELF_PUBLIC not defined
35 #endif
37 #ifndef SELF_DEFAULT
38 #error SELF_DEFAULT not defined
39 #endif
41 #include "other.h"
43 #ifdef OTHER_PRIVATE
44 #error OTHER_PRIVATE defined
45 #endif
47 #ifndef OTHER_PUBLIC
48 #error OTHER_PUBLIC not defined
49 #endif
51 #ifndef OTHER_DEFAULT
52 #error OTHER_DEFAULT not defined
53 #endif