clang-cl: Ignore /fallback when not actually compiling (PR18456)

For example, don't fall back in /P (preprocess) mode.

llvm-svn: 199153
This commit is contained in:
Hans Wennborg 2014-01-13 22:24:42 +00:00
parent 0ad27923d5
commit 859422a867
2 changed files with 7 additions and 1 deletions

View File

@ -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);

View File

@ -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"