1 // Verify that the use of a PCH does not accidentally make modules from the PCH
2 // visible to submodules when using -fmodules-local-submodule-visibility
3 // and -fmodule-name to trigger a textual include.
6 // RUN: split-file %s %t
8 // First check that it works with a header
10 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache \
11 // RUN: -fmodules-local-submodule-visibility -fimplicit-module-maps \
12 // RUN: -fmodule-name=Mod \
13 // RUN: %t/tu.c -include %t/prefix.h -I %t -verify
17 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache \
18 // RUN: -fmodules-local-submodule-visibility -fimplicit-module-maps \
19 // RUN: -x c-header %t/prefix.h -emit-pch -o %t/prefix.pch -I %t
21 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache \
22 // RUN: -fmodules-local-submodule-visibility -fimplicit-module-maps \
23 // RUN: -fmodule-name=Mod \
24 // RUN: %t/tu.c -include-pch %t/prefix.pch -I %t -verify
26 //--- module.modulemap
27 module ModViaPCH
{ header
"ModViaPCH.h" }
28 module ModViaInclude
{ header
"ModViaInclude.h" }
29 module Mod
{ header
"Mod.h" }
30 module SomeOtherMod
{ header
"SomeOtherMod.h" }
36 #define ModViaInclude 2
42 #include "SomeOtherMod.h"
44 #error "Visibility violation ModViaPCH"
47 #error "Visibility violation ModViaInclude"
51 #include "ModViaPCH.h"
54 #include "ModViaInclude.h"
56 // expected-no-diagnostics