Index: include/clang/Driver/ToolChain.h =================================================================== --- include/clang/Driver/ToolChain.h +++ include/clang/Driver/ToolChain.h @@ -164,7 +164,12 @@ } /// Choose a tool to use to handle the action \p JA. - Tool *SelectTool(const JobAction &JA) const; + /// This is virtualized because there are scenarios where you want the + /// default driver in the default driver-mode not to pick Clang as + /// the right tool for a C program, at the discretion of the ToolChain. + /// GetTool is overridable, but it's also necessary to avoid inquiring with + /// Driver::ShouldUseClangCompiler() which says "yes" to C, usually. + virtual Tool *SelectTool(const JobAction &JA) const; // Helper methods Index: lib/Driver/Driver.cpp =================================================================== --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -2118,13 +2118,12 @@ } 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(JA) && !isa(JA) && !isa(JA) && !isa(JA)) return false;