r207234 - clang-cl: /fallback only applies to C or C++ files

Hans Wennborg hans at hanshq.net
Fri Apr 25 09:44:18 PDT 2014


Author: hans
Date: Fri Apr 25 11:44:17 2014
New Revision: 207234

URL: http://llvm.org/viewvc/llvm-project?rev=207234&view=rev
Log:
clang-cl: /fallback only applies to C or C++ files

We would previously hit an assert if using /fallback with an .ll file.

Added:
    cfe/trunk/test/Driver/Inputs/file.ll
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=207234&r1=207233&r2=207234&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Apr 25 11:44:17 2014
@@ -4066,7 +4066,8 @@ void Clang::ConstructJob(Compilation &C,
 
   // Finally add the compile command to the compilation.
   if (Args.hasArg(options::OPT__SLASH_fallback) &&
-      Output.getType() == types::TY_Object) {
+      Output.getType() == types::TY_Object &&
+      (InputType == types::TY_C || InputType == types::TY_CXX)) {
     tools::visualstudio::Compile CL(getToolChain());
     Command *CLCommand = CL.GetCommand(C, JA, Output, Inputs, Args,
                                        LinkingOutput);

Added: cfe/trunk/test/Driver/Inputs/file.ll
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/file.ll?rev=207234&view=auto
==============================================================================
    (empty)

Modified: cfe/trunk/test/Driver/cl-fallback.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-fallback.c?rev=207234&r1=207233&r2=207234&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-fallback.c (original)
+++ cfe/trunk/test/Driver/cl-fallback.c Fri Apr 25 11:44:17 2014
@@ -54,4 +54,11 @@
 // RUN:     FileCheck -check-prefix=ErrWarn %s
 // ErrWarn: warning: falling back to {{.*}}cl.exe
 
+// Don't fall back on non-C or C++ files.
+// RUN: %clang_cl /fallback -### -- %S/Inputs/file.ll 2>&1 | FileCheck -check-prefix=LL %s
+// LL: file.ll
+// LL-NOT: ||
+// LL-NOT: "cl.exe"
+
+
 #error "This fails to compile."





More information about the cfe-commits mailing list