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

Hans Wennborg hans at hanshq.net
Mon Jan 13 14:24:42 PST 2014


Author: hans
Date: Mon Jan 13 16:24:42 2014
New Revision: 199153

URL: http://llvm.org/viewvc/llvm-project?rev=199153&view=rev
Log:
clang-cl: Ignore /fallback when not actually compiling (PR18456)

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

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/cl-fallback.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=199153&r1=199152&r2=199153&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Jan 13 16:24:42 2014
@@ -3725,7 +3725,8 @@ void Clang::ConstructJob(Compilation &C,
   }
 
   // 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);

Modified: cfe/trunk/test/Driver/cl-fallback.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-fallback.c?rev=199153&r1=199152&r2=199153&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-fallback.c (original)
+++ cfe/trunk/test/Driver/cl-fallback.c Mon Jan 13 16:24:42 2014
@@ -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"





More information about the cfe-commits mailing list