aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2014-04-25 16:44:17 +0000
committerHans Wennborg <hans@hanshq.net>2014-04-25 16:44:17 +0000
commit8a6fa5cade1b3e402e3e161936045361eeaa426f (patch)
tree2fc22563cb640b523b9727e14f7bef6537a7ecb4
parentb67bacf5c681998d875faaa0c3c47c8dea71fccb (diff)
downloadclang_35a-8a6fa5cade1b3e402e3e161936045361eeaa426f.tar.gz
clang-cl: /fallback only applies to C or C++ files
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
-rw-r--r--lib/Driver/Tools.cpp3
-rw-r--r--test/Driver/Inputs/file.ll0
-rw-r--r--test/Driver/cl-fallback.c7
3 files changed, 9 insertions, 1 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 924e040246..991fe4358e 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -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
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/Driver/Inputs/file.ll
diff --git a/test/Driver/cl-fallback.c b/test/Driver/cl-fallback.c
index a8279d3d09..655535b65f 100644
--- a/test/Driver/cl-fallback.c
+++ b/test/Driver/cl-fallback.c
@@ -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."