[cfe-commits] r67639 - in /cfe/trunk: include/clang/Driver/Driver.h include/clang/Driver/ToolChain.h lib/Driver/Driver.cpp lib/Driver/ToolChain.cpp lib/Driver/ToolChains.cpp
Daniel Dunbar
daniel at zuster.org
Tue Mar 24 11:57:02 PDT 2009
Author: ddunbar
Date: Tue Mar 24 13:57:02 2009
New Revision: 67639
URL: http://llvm.org/viewvc/llvm-project?rev=67639&view=rev
Log:
Move ToolChain::ShouldUseClangCompiler to
Driver::ShouldUseClangCompiler.
- No functionality change.
Modified:
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=67639&r1=67638&r2=67639&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Tue Mar 24 13:57:02 2009
@@ -77,6 +77,7 @@
/// 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 @@
/// 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;
+
/// @}
};
Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=67639&r1=67638&r2=67639&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Tue Mar 24 13:57:02 2009
@@ -76,10 +76,6 @@
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
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=67639&r1=67638&r2=67639&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Mar 24 13:57:02 2009
@@ -981,3 +981,30 @@
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;
+}
Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=67639&r1=67638&r2=67639&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Tue Mar 24 13:57:02 2009
@@ -33,31 +33,3 @@
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;
-}
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=67639&r1=67638&r2=67639&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Mar 24 13:57:02 2009
@@ -91,7 +91,7 @@
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 @@
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();
More information about the cfe-commits
mailing list