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 | 899292827456532bc66219f9d778595c57614f77 (patch) | |
tree | fa9971f4bad44e176c13d13bc80d68f4dce77e25 /clang/lib/Basic/Module.cpp | |
parent | 829400bb22fc72d291fd3e5057b0880d7b09aafa (diff) | |
download | bcm5719-llvm-899292827456532bc66219f9d778595c57614f77.tar.gz bcm5719-llvm-899292827456532bc66219f9d778595c57614f77.zip |
Thread a TargetInfo through to the module map; we'll need it for
target-specific module requirements.
llvm-svn: 149224
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r-- | clang/lib/Basic/Module.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 015f421f9db..3052532650e 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/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) |