diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-30 06:01:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-30 06:01:29 +0000 |
commit | dc58aa71026cce539ca9b5c2c52cc4efc7bd77fe (patch) | |
tree | 6ced169a86aa0072e25c83227aa56b7dc75199e1 /lib/Basic/Module.cpp | |
parent | add5adb9aa5facc1cd170fc9dacbd58cde028025 (diff) |
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
Diffstat (limited to 'lib/Basic/Module.cpp')
-rw-r--r-- | lib/Basic/Module.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Basic/Module.cpp b/lib/Basic/Module.cpp index 015f421f9d..3052532650 100644 --- a/lib/Basic/Module.cpp +++ b/lib/Basic/Module.cpp @@ -47,7 +47,8 @@ Module::~Module() { /// \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 @@ static bool hasFeature(StringRef Feature, const LangOptions &LangOpts) { } 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 @@ const DirectoryEntry *Module::getUmbrellaDir() const { 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) |