]> granicus.if.org Git - clang/commitdiff
clang-cl: Ignore /fallback when not actually compiling (PR18456)
authorHans Wennborg <hans@hanshq.net>
Mon, 13 Jan 2014 22:24:42 +0000 (22:24 +0000)
committerHans Wennborg <hans@hanshq.net>
Mon, 13 Jan 2014 22:24:42 +0000 (22:24 +0000)
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

lib/Driver/Tools.cpp
test/Driver/cl-fallback.c

index 2084c0f557ac29c2aeb1fd9ecc5873bbd1075679..489c6ba4b589525358fae8226083cb2b0cd2ca85 100644 (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);
index 2433072a0250d0f96b7100881cab05be41ebd810..9b33b0c0a74843b40b2e6fb78b4314bd0d47ec78 100644 (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"