summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/lib/Basic/Module.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Basic/Module.cpp')
-rw-r--r--contrib/llvm/tools/clang/lib/Basic/Module.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/contrib/llvm/tools/clang/lib/Basic/Module.cpp b/contrib/llvm/tools/clang/lib/Basic/Module.cpp
index 1a48a6c..3846fec 100644
--- a/contrib/llvm/tools/clang/lib/Basic/Module.cpp
+++ b/contrib/llvm/tools/clang/lib/Basic/Module.cpp
@@ -82,10 +82,6 @@ bool Module::isAvailable(const LangOptions &LangOpts, const TargetInfo &Target,
return true;
for (const Module *Current = this; Current; Current = Current->Parent) {
- if (!Current->MissingHeaders.empty()) {
- MissingHeader = Current->MissingHeaders.front();
- return false;
- }
for (unsigned I = 0, N = Current->Requirements.size(); I != N; ++I) {
if (hasFeature(Current->Requirements[I].first, LangOpts, Target) !=
Current->Requirements[I].second) {
@@ -93,6 +89,10 @@ bool Module::isAvailable(const LangOptions &LangOpts, const TargetInfo &Target,
return false;
}
}
+ if (!Current->MissingHeaders.empty()) {
+ MissingHeader = Current->MissingHeaders.front();
+ return false;
+ }
}
llvm_unreachable("could not find a reason why module is unavailable");
@@ -184,7 +184,11 @@ void Module::addRequirement(StringRef Feature, bool RequiredState,
}
void Module::markUnavailable(bool MissingRequirement) {
- if (!IsAvailable)
+ auto needUpdate = [MissingRequirement](Module *M) {
+ return M->IsAvailable || (!M->IsMissingRequirement && MissingRequirement);
+ };
+
+ if (!needUpdate(this))
return;
SmallVector<Module *, 2> Stack;
@@ -193,7 +197,7 @@ void Module::markUnavailable(bool MissingRequirement) {
Module *Current = Stack.back();
Stack.pop_back();
- if (!Current->IsAvailable)
+ if (!needUpdate(Current))
continue;
Current->IsAvailable = false;
@@ -201,7 +205,7 @@ void Module::markUnavailable(bool MissingRequirement) {
for (submodule_iterator Sub = Current->submodule_begin(),
SubEnd = Current->submodule_end();
Sub != SubEnd; ++Sub) {
- if ((*Sub)->IsAvailable)
+ if (needUpdate(*Sub))
Stack.push_back(*Sub);
}
}
OpenPOWER on IntegriCloud