From: Hans Wennborg Date: Mon, 13 Jan 2014 22:24:42 +0000 (+0000) Subject: clang-cl: Ignore /fallback when not actually compiling (PR18456) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b44435d22f19cefa9c0c555d62f33781408b5e89;p=clang clang-cl: Ignore /fallback when not actually compiling (PR18456) For example, don't fall back in /P (preprocess) mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199153 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 2084c0f557..489c6ba4b5 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -3725,7 +3725,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } // Finally add the compile command to the compilation. - if (Args.hasArg(options::OPT__SLASH_fallback)) { + if (Args.hasArg(options::OPT__SLASH_fallback) && + Output.getType() == types::TY_Object) { tools::visualstudio::Compile CL(getToolChain()); Command *CLCommand = CL.GetCommand(C, JA, Output, Inputs, Args, LinkingOutput); diff --git a/test/Driver/cl-fallback.c b/test/Driver/cl-fallback.c index 2433072a02..9b33b0c0a7 100644 --- a/test/Driver/cl-fallback.c +++ b/test/Driver/cl-fallback.c @@ -39,3 +39,8 @@ // RUN: %clang_cl /fallback /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s // Ox: cl.exe // Ox: "/Ox" + +// Only fall back when actually compiling, not for e.g. /P (preprocess). +// RUN: %clang_cl /fallback /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s +// P-NOT: || +// P-NOT: "cl.exe"