r206673 - Fix a hole with nested unavailable submodules from r206664
Ben Langmuir
blangmuir at apple.com
Fri Apr 18 16:51:00 PDT 2014
Author: benlangmuir
Date: Fri Apr 18 18:51:00 2014
New Revision: 206673
URL: http://llvm.org/viewvc/llvm-project?rev=206673&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/Basic/Module.h
cfe/trunk/lib/Basic/Module.cpp
cfe/trunk/test/Modules/Inputs/submodules/module.map
Modified: cfe/trunk/include/clang/Basic/Module.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Module.h?rev=206673&r1=206672&r2=206673&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Module.h (original)
+++ cfe/trunk/include/clang/Basic/Module.h Fri Apr 18 18:51:00 2014
@@ -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.
///
Modified: cfe/trunk/lib/Basic/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=206673&r1=206672&r2=206673&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Module.cpp (original)
+++ cfe/trunk/lib/Basic/Module.cpp Fri Apr 18 18:51:00 2014
@@ -39,6 +39,7 @@ Module::Module(StringRef Name, SourceLoc
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 Fe
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) {
Modified: cfe/trunk/test/Modules/Inputs/submodules/module.map
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/submodules/module.map?rev=206673&r1=206672&r2=206673&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/submodules/module.map (original)
+++ cfe/trunk/test/Modules/Inputs/submodules/module.map Fri Apr 18 18:51:00 2014
@@ -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 { }
}
More information about the cfe-commits
mailing list