From: Ben Langmuir Date: Fri, 18 Apr 2014 23:51:00 +0000 (+0000) Subject: Fix a hole with nested unavailable submodules from r206664 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba02ce0dd8fb01a280179d7717dac67691086d87;p=clang Fix a hole with nested unavailable submodules from r206664 If a module doesn't meet a requirement, neither do its submodules. If we don't propogate that, we might think it's an error to be missing a header in one of those submodules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206673 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/Module.h b/include/clang/Basic/Module.h index 98f86df6d5..92de93a4d4 100644 --- a/include/clang/Basic/Module.h +++ b/include/clang/Basic/Module.h @@ -413,7 +413,7 @@ public: const TargetInfo &Target); /// \brief Mark this module and all of its submodules as unavailable. - void markUnavailable(); + void markUnavailable(bool MissingRequirement = false); /// \brief Find the submodule with the given name. /// diff --git a/lib/Basic/Module.cpp b/lib/Basic/Module.cpp index 6f29fae03a..64013bd6bd 100644 --- a/lib/Basic/Module.cpp +++ b/lib/Basic/Module.cpp @@ -39,6 +39,7 @@ Module::Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent, IsSystem = true; if (Parent->IsExternC) IsExternC = true; + IsMissingRequirement = Parent->IsMissingRequirement; Parent->SubModuleIndex[Name] = Parent->SubModules.size(); Parent->SubModules.push_back(this); @@ -160,11 +161,10 @@ void Module::addRequirement(StringRef Feature, bool RequiredState, if (hasFeature(Feature, LangOpts, Target) == RequiredState) return; - IsMissingRequirement = true; - markUnavailable(); + markUnavailable(/*MissingRequirement*/true); } -void Module::markUnavailable() { +void Module::markUnavailable(bool MissingRequirement) { if (!IsAvailable) return; @@ -178,6 +178,7 @@ void Module::markUnavailable() { continue; Current->IsAvailable = false; + Current->IsMissingRequirement |= MissingRequirement; for (submodule_iterator Sub = Current->submodule_begin(), SubEnd = Current->submodule_end(); Sub != SubEnd; ++Sub) { diff --git a/test/Modules/Inputs/submodules/module.map b/test/Modules/Inputs/submodules/module.map index 8677ea0c80..27c1ee4c61 100644 --- a/test/Modules/Inputs/submodules/module.map +++ b/test/Modules/Inputs/submodules/module.map @@ -20,6 +20,7 @@ module missing_unavailable_headers { module missing { requires !objc header "missing.h" + module also_missing { header "also_missing.h" } } module not_missing { } }