aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-24 18:57:02 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-24 18:57:02 +0000
commitaf80e1ffafeb77929cc0b9ba8940a7f1c0b80d51 (patch)
treef45099f54bb6e2a368d23f627fcc67c9e0c8a5e5
parentb3fd500a1c486e9fb82d82e28828ead025462aeb (diff)
Move ToolChain::ShouldUseClangCompiler to
Driver::ShouldUseClangCompiler. - No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67639 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Driver/Driver.h6
-rw-r--r--include/clang/Driver/ToolChain.h4
-rw-r--r--lib/Driver/Driver.cpp27
-rw-r--r--lib/Driver/ToolChain.cpp28
-rw-r--r--lib/Driver/ToolChains.cpp4
5 files changed, 35 insertions, 34 deletions
diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h
index 7a52498364..d1df4d8751 100644
--- a/include/clang/Driver/Driver.h
+++ b/include/clang/Driver/Driver.h
@@ -77,6 +77,7 @@ public:
/// Only print tool bindings, don't build any jobs.
bool CCCPrintBindings : 1;
+private:
/// Don't use clang for any tasks.
bool CCCNoClang : 1;
@@ -227,6 +228,11 @@ public:
/// host triple.
const HostInfo *GetHostInfo(const char *HostTriple) const;
+ /// ShouldUseClangCompilar - Should the clang compiler be used to
+ /// handle this action.
+ bool ShouldUseClangCompiler(const Compilation &C, const JobAction &JA,
+ const std::string &ArchName) const;
+
/// @}
};
diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h
index f917eb6da4..99d9bcb3cb 100644
--- a/include/clang/Driver/ToolChain.h
+++ b/include/clang/Driver/ToolChain.h
@@ -76,10 +76,6 @@ public:
llvm::sys::Path GetFilePath(const Compilation &C, const char *Name) const;
llvm::sys::Path GetProgramPath(const Compilation &C, const char *Name) const;
- /// ShouldUseClangCompilar - Should the clang compiler be used to
- /// handle this action.
- bool ShouldUseClangCompiler(const Compilation &C, const JobAction &JA) const;
-
// Platform defaults information
/// IsMathErrnoDefault - Does this tool chain set -fmath-errno by
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index df71c97215..1e10ac5c8f 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -981,3 +981,30 @@ const HostInfo *Driver::GetHostInfo(const char *Triple) const {
return createUnknownHostInfo(*this, Arch.c_str(), Platform.c_str(),
OS.c_str());
}
+
+bool Driver::ShouldUseClangCompiler(const Compilation &C, const JobAction &JA,
+ const std::string &ArchName) const {
+ // Check if user requested no clang, or clang doesn't understand
+ // this type (we only handle single inputs for now).
+ if (CCCNoClang || JA.size() != 1 ||
+ !types::isAcceptedByClang((*JA.begin())->getType()))
+ return false;
+
+ // Otherwise make sure this is an action clang undertands.
+ if (isa<PreprocessJobAction>(JA)) {
+ if (CCCNoClangCPP)
+ return false;
+ } else if (!isa<PrecompileJobAction>(JA) && !isa<CompileJobAction>(JA))
+ return false;
+
+ // Avoid CXX if the user requested.
+ if (CCCNoClangCXX && types::isCXX((*JA.begin())->getType()))
+ return false;
+
+ // Finally, don't use clang if this isn't one of the user specified
+ // archs to build.
+ if (!CCCClangArchs.empty() && !CCCClangArchs.count(ArchName))
+ return false;
+
+ return true;
+}
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index 87b169e7e9..aed58c9422 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -33,31 +33,3 @@ llvm::sys::Path ToolChain::GetProgramPath(const Compilation &C,
const char *Name) const {
return Host.getDriver().GetProgramPath(Name, *this);
}
-
-bool ToolChain::ShouldUseClangCompiler(const Compilation &C,
- const JobAction &JA) const {
- // Check if user requested no clang, or clang doesn't understand
- // this type (we only handle single inputs for now).
- if (Host.getDriver().CCCNoClang || JA.size() != 1 ||
- !types::isAcceptedByClang((*JA.begin())->getType()))
- return false;
-
- // Otherwise make sure this is an action clang undertands.
- if (isa<PreprocessJobAction>(JA)) {
- if (Host.getDriver().CCCNoClangCPP)
- return false;
- } else if (!isa<PrecompileJobAction>(JA) && !isa<CompileJobAction>(JA))
- return false;
-
- // Avoid CXX if the user requested.
- if (Host.getDriver().CCCNoClangCXX && types::isCXX((*JA.begin())->getType()))
- return false;
-
- // Finally, don't use clang if this isn't one of the user specified
- // archs to build.
- if (!Host.getDriver().CCCClangArchs.empty() &&
- !Host.getDriver().CCCClangArchs.count(getArchName()))
- return false;
-
- return true;
-}
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index d4e8e93e2a..c8df6c09e5 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -91,7 +91,7 @@ Darwin_X86::~Darwin_X86() {
Tool &Darwin_X86::SelectTool(const Compilation &C,
const JobAction &JA) const {
Action::ActionClass Key;
- if (ShouldUseClangCompiler(C, JA))
+ if (getHost().getDriver().ShouldUseClangCompiler(C, JA, getArchName()))
Key = Action::AnalyzeJobClass;
else
Key = JA.getKind();
@@ -172,7 +172,7 @@ Generic_GCC::~Generic_GCC() {
Tool &Generic_GCC::SelectTool(const Compilation &C,
const JobAction &JA) const {
Action::ActionClass Key;
- if (ShouldUseClangCompiler(C, JA))
+ if (getHost().getDriver().ShouldUseClangCompiler(C, JA, getArchName()))
Key = Action::AnalyzeJobClass;
else
Key = JA.getKind();