]> granicus.if.org Git - clang/commitdiff
clang-cl: /fallback only applies to C or C++ files
authorHans Wennborg <hans@hanshq.net>
Fri, 25 Apr 2014 16:44:17 +0000 (16:44 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 25 Apr 2014 16:44:17 +0000 (16:44 +0000)
We would previously hit an assert if using /fallback with an .ll file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207234 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/Inputs/file.ll [new file with mode: 0644]
test/Driver/cl-fallback.c

index 924e040246db3625af86992f0926b4e2b38e16f0..991fe4358ea491242663e8b8acc335c1cc5a80bb 100644 (file)
@@ -4066,7 +4066,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
 
   // 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);
diff --git a/test/Driver/Inputs/file.ll b/test/Driver/Inputs/file.ll
new file mode 100644 (file)
index 0000000..e69de29
index a8279d3d0993290ff10988886f1764b1e0cabd74..655535b65fb257cf91ef9ef12d81e5077d59c46d 100644 (file)
 // 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."