diff options
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 3 | ||||
-rw-r--r-- | clang/test/Driver/Inputs/file.ll | 0 | ||||
-rw-r--r-- | clang/test/Driver/cl-fallback.c | 7 |
3 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 924e040246d..991fe4358ea 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/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/clang/test/Driver/Inputs/file.ll b/clang/test/Driver/Inputs/file.ll new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/clang/test/Driver/Inputs/file.ll diff --git a/clang/test/Driver/cl-fallback.c b/clang/test/Driver/cl-fallback.c index a8279d3d099..655535b65fb 100644 --- a/clang/test/Driver/cl-fallback.c +++ b/clang/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." |