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 -I%S/Inputs/submodule-visibility -verify %s
6 // RUN: %clang_cc1 -fmodule-map-file=%S/Inputs/submodule-visibility/module.modulemap -fmodules-local-submodule-visibility -I%S/Inputs/submodule-visibility -verify %s
8 // Ensure the driver forwards the relevant flags when -fmodules is disabled.
9 // FIXME: -fdelayed-template-parsing doesn't properly interact with module visibility yet.
10 // RUN: %clang -fimplicit-module-maps -Xclang -fmodules-local-submodule-visibility -I%S/Inputs/submodule-visibility -fsyntax-only -Xclang -verify %s -fno-delayed-template-parsing
11 // RUN: %clang -fmodule-map-file=%S/Inputs/submodule-visibility/module.modulemap -Xclang -fmodules-local-submodule-visibility -I%S/Inputs/submodule-visibility -fsyntax-only -Xclang -verify %s -fno-delayed-template-parsing
13 // Explicit module builds.
14 // 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
15 // 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
16 // 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
21 #if ALLOW_NAME_LEAKAGE
22 // expected-no-diagnostics
24 // expected-error@-6 {{could not build module 'x'}}
25 #elif ALLOW_TEXTUAL_NAME_LEAKAGE
26 // expected-warning@b.h:7 {{A is defined}}
28 // The use of -fmodule-name=x causes us to textually include the above headers.
29 // The submodule visibility rules are still applied in this case.
31 // expected-error@b.h:1 {{missing '#include "a.h"'; 'n' must be declared}}
32 // expected-note@a.h:1 {{here}}
35 int k
= n
+ m
; // OK, a and b are visible here.
38 #error A is not defined
42 #error B is not defined
45 // Ensure we don't compute the linkage of this struct before we find it has a
46 // typedef name for linkage purposes.
52 void g() { b_template
<int>(); }