aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2022-09-22 12:17:52 -0700
committerJan Svoboda <jan_svoboda@apple.com>2022-09-22 12:36:05 -0700
commitf35230ae0a69bbdd74a4faa3ae0b69a46796dc12 (patch)
treecf589b8456391210979596b47e17837f896bc91b /clang/lib/Lex/ModuleMap.cpp
parent46525fee812343b5e603a77893dfe2983768ca56 (diff)
downloadllvm-f35230ae0a69bbdd74a4faa3ae0b69a46796dc12.zip
llvm-f35230ae0a69bbdd74a4faa3ae0b69a46796dc12.tar.gz
llvm-f35230ae0a69bbdd74a4faa3ae0b69a46796dc12.tar.bz2
[clang][modules][deps] Report modulemaps describing excluded headers
Module map files describing excluded headers do affect compilation. Track them in the compiler, serialize them into the PCM file and report them in the scanner. Depends on D134222. Reviewed By: Bigcheese Differential Revision: https://reviews.llvm.org/D134224
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 87a90bc..174d639 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -567,9 +567,11 @@ static bool isBetterKnownHeader(const ModuleMap::KnownHeader &New,
}
ModuleMap::KnownHeader ModuleMap::findModuleForHeader(const FileEntry *File,
- bool AllowTextual) {
+ bool AllowTextual,
+ bool AllowExcluded) {
auto MakeResult = [&](ModuleMap::KnownHeader R) -> ModuleMap::KnownHeader {
- if (!AllowTextual && R.getRole() & ModuleMap::TextualHeader)
+ if ((!AllowTextual && R.getRole() & ModuleMap::TextualHeader) ||
+ (!AllowExcluded && R.getRole() & ModuleMap::ExcludedHeader))
return {};
return R;
};
@@ -700,6 +702,9 @@ ModuleMap::isHeaderUnavailableInModule(const FileEntry *Header,
E = Known->second.end();
I != E; ++I) {
+ if (I->getRole() == ModuleMap::ExcludedHeader)
+ continue;
+
if (I->isAvailable() &&
(!RequestingModule ||
I->getModule()->isSubModuleOf(RequestingModule))) {
@@ -1261,11 +1266,13 @@ void ModuleMap::addHeader(Module *Mod, Module::Header Header,
}
void ModuleMap::excludeHeader(Module *Mod, Module::Header Header) {
+ KnownHeader KH(Mod, ModuleHeaderRole::ExcludedHeader);
+
// Add this as a known header so we won't implicitly add it to any
// umbrella directory module.
// FIXME: Should we only exclude it from umbrella modules within the
// specified module?
- (void) Headers[Header.Entry];
+ Headers[Header.Entry].push_back(KH);
Mod->Headers[Module::HK_Excluded].push_back(std::move(Header));
}