summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Driver.cpp
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
commit8fa879d39fb218bc30ecf8c2ebdb50e8d1c9ab50 (patch)
tree7edc65dab95e626251a819c59038aea4f221edba /clang/lib/Driver/Driver.cpp
parent306813cbbb043c42575eecd5ccb545a66a5d7b2d (diff)
downloadbcm5719-llvm-8fa879d39fb218bc30ecf8c2ebdb50e8d1c9ab50.tar.gz
bcm5719-llvm-8fa879d39fb218bc30ecf8c2ebdb50e8d1c9ab50.zip
Move ToolChain::ShouldUseClangCompiler to
Driver::ShouldUseClangCompiler. - No functionality change. llvm-svn: 67639
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index df71c97215a..1e10ac5c8f9 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/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;
+}
OpenPOWER on IntegriCloud