From 8a6fa5cade1b3e402e3e161936045361eeaa426f Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Fri, 25 Apr 2014 16:44:17 +0000 Subject: [PATCH] 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 --- lib/Driver/Tools.cpp | 3 ++- test/Driver/Inputs/file.ll | 0 test/Driver/cl-fallback.c | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/Driver/Inputs/file.ll 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 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." -- 2.40.0