r239608 - Allow ToolChain to decide if Clang is not the right C compiler.
Douglas Katzman
dougk at google.com
Fri Jun 12 08:45:21 PDT 2015
Author: dougk
Date: Fri Jun 12 10:45:21 2015
New Revision: 239608
URL: http://llvm.org/viewvc/llvm-project?rev=239608&view=rev
Log:
Allow ToolChain to decide if Clang is not the right C compiler.
Removed comment in Driver::ShouldUseClangCompiler implying that there
was an opt-out ability at that point - there isn't.
Differential Revision: http://reviews.llvm.org/D10246
Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Driver.cpp
Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=239608&r1=239607&r2=239608&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Jun 12 10:45:21 2015
@@ -164,7 +164,10 @@ public:
}
/// Choose a tool to use to handle the action \p JA.
- Tool *SelectTool(const JobAction &JA) const;
+ ///
+ /// This can be overridden when a particular ToolChain needs to use
+ /// a C compiler other than Clang.
+ virtual Tool *SelectTool(const JobAction &JA) const;
// Helper methods
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=239608&r1=239607&r2=239608&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Jun 12 10:45:21 2015
@@ -2117,13 +2117,12 @@ const ToolChain &Driver::getToolChain(co
}
bool Driver::ShouldUseClangCompiler(const JobAction &JA) const {
- // Check if user requested no clang, or clang doesn't understand this type (we
- // only handle single inputs for now).
+ // Say "no" if there is not exactly one input of a type clang understands.
if (JA.size() != 1 ||
!types::isAcceptedByClang((*JA.begin())->getType()))
return false;
- // Otherwise make sure this is an action clang understands.
+ // And say "no" if this is not a kind of action clang understands.
if (!isa<PreprocessJobAction>(JA) && !isa<PrecompileJobAction>(JA) &&
!isa<CompileJobAction>(JA) && !isa<BackendJobAction>(JA))
return false;
More information about the cfe-commits
mailing list