Thread a TargetInfo through to the module map; we'll need it for
target-specific module requirements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149224 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/Module.cpp b/lib/Basic/Module.cpp
index 015f421..3052532 100644
--- a/lib/Basic/Module.cpp
+++ b/lib/Basic/Module.cpp
@@ -47,7 +47,8 @@
/// \brief Determine whether a translation unit built using the current
/// language options has the given feature.
-static bool hasFeature(StringRef Feature, const LangOptions &LangOpts) {
+static bool hasFeature(StringRef Feature, const LangOptions &LangOpts,
+ const TargetInfo &Target) {
return llvm::StringSwitch<bool>(Feature)
.Case("blocks", LangOpts.Blocks)
.Case("cplusplus", LangOpts.CPlusPlus)
@@ -58,13 +59,14 @@
}
bool
-Module::isAvailable(const LangOptions &LangOpts, StringRef &Feature) const {
+Module::isAvailable(const LangOptions &LangOpts, const TargetInfo &Target,
+ StringRef &Feature) const {
if (IsAvailable)
return true;
for (const Module *Current = this; Current; Current = Current->Parent) {
for (unsigned I = 0, N = Current->Requires.size(); I != N; ++I) {
- if (!hasFeature(Current->Requires[I], LangOpts)) {
+ if (!hasFeature(Current->Requires[I], LangOpts, Target)) {
Feature = Current->Requires[I];
return false;
}
@@ -121,11 +123,12 @@
return Umbrella.dyn_cast<const DirectoryEntry *>();
}
-void Module::addRequirement(StringRef Feature, const LangOptions &LangOpts) {
+void Module::addRequirement(StringRef Feature, const LangOptions &LangOpts,
+ const TargetInfo &Target) {
Requires.push_back(Feature);
// If this feature is currently available, we're done.
- if (hasFeature(Feature, LangOpts))
+ if (hasFeature(Feature, LangOpts, Target))
return;
if (!IsAvailable)