2 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s -DALLOW_NAME_LEAKAGE
3 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-local-submodule-visibility -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s -DIMPORT
4 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-local-submodule-visibility -fmodules-cache-path=%t -fmodule-name=x -I%S/Inputs/submodule-visibility -verify %s
5 // RUN: %clang_cc1 -fimplicit-module-maps -fmodules-local-submodule-visibility -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s
7 // Explicit module builds.
8 // RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -emit-module -x c++-module-map %S/Inputs/submodule-visibility/module.modulemap -fmodule-name=other -o %t/other.pcm
9 // RUN: %clang_cc1 -fmodules -fmodule-map-file=%S/Inputs/submodule-visibility/module.modulemap -fmodules-local-submodule-visibility -fmodule-file=%t/other.pcm -verify -fmodule-name=x -I%S/Inputs/submodule-visibility %s
10 // RUN: %clang_cc1 -fmodules -fmodule-map-file=%S/Inputs/submodule-visibility/module.modulemap -fmodule-file=%t/other.pcm -verify -fmodule-name=x -I%S/Inputs/submodule-visibility %s -DALLOW_TEXTUAL_NAME_LEAKAGE
15 #if ALLOW_NAME_LEAKAGE
16 // expected-no-diagnostics
18 // expected-error@-6 {{could not build module 'x'}}
19 #elif ALLOW_TEXTUAL_NAME_LEAKAGE
20 // expected-warning@b.h:7 {{A is defined}}
22 // The use of -fmodule-name=x causes us to textually include the above headers.
23 // The submodule visibility rules are still applied in this case.
25 // expected-error@b.h:1 {{missing '#include "a.h"'; 'n' must be declared}}
26 // expected-note@a.h:1 {{here}}
29 int k
= n
+ m
; // OK, a and b are visible here.
32 #error A is not defined
36 #error B is not defined
39 // Ensure we don't compute the linkage of this struct before we find it has a
40 // typedef name for linkage purposes.
46 void g() { b_template
<int>(); }