brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 648f756 Raw
57 lines · c
1// Verify that the use of a PCH does not accidentally make modules from the PCH2// visible to submodules when using -fmodules-local-submodule-visibility3// and -fmodule-name to trigger a textual include.4 5// RUN: rm -rf %t6// RUN: split-file %s %t7 8// First check that it works with a header9 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 -verify14 15// Now with a PCH16 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 %t20 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 -verify25 26//--- module.modulemap27module ModViaPCH { header "ModViaPCH.h" }28module ModViaInclude { header "ModViaInclude.h" }29module Mod { header "Mod.h" }30module SomeOtherMod { header "SomeOtherMod.h" }31 32//--- ModViaPCH.h33#define ModViaPCH 134 35//--- ModViaInclude.h36#define ModViaInclude 237 38//--- SomeOtherMod.h39// empty40 41//--- Mod.h42#include "SomeOtherMod.h"43#ifdef ModViaPCH44#error "Visibility violation ModViaPCH"45#endif46#ifdef ModViaInclude47#error "Visibility violation ModViaInclude"48#endif49 50//--- prefix.h51#include "ModViaPCH.h"52 53//--- tu.c54#include "ModViaInclude.h"55#include "Mod.h"56// expected-no-diagnostics57