summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-02-22 01:33:46 +0000
committerEric Christopher <echristo@gmail.com>2013-02-22 01:33:46 +0000
commit77569ffd0617b583e40c3e685a8b3f193ede7514 (patch)
tree729cc6c63359c28a1ec9f6d5c4936be81716a0a9
parentac2d082f58e61aa9424cbe778677f61109cf7392 (diff)
downloadbcm5719-llvm-77569ffd0617b583e40c3e685a8b3f193ede7514.tar.gz
bcm5719-llvm-77569ffd0617b583e40c3e685a8b3f193ede7514.zip
Make sure we only use the output file as a base for debug splitting
if we're compiling. llvm-svn: 175851
-rw-r--r--clang/lib/Driver/Tools.cpp2
-rw-r--r--clang/test/Driver/split-debug.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index e830bdcc9c3..ebbabcfdf9c 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -1723,7 +1723,7 @@ void Clang::SplitDebugInfo(Compilation &C, const JobAction &JA,
// Add an output for the extract.
Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o);
const char *OutFile;
- if (FinalOutput) {
+ if (FinalOutput && C.getArgs().hasArg(options::OPT_c)) {
SmallString<128> T(FinalOutput->getValue());
llvm::sys::path::replace_extension(T, "dwo");
OutFile = Args.MakeArgString(T);
diff --git a/clang/test/Driver/split-debug.c b/clang/test/Driver/split-debug.c
index fb01953b0d6..5c77e6e98cf 100644
--- a/clang/test/Driver/split-debug.c
+++ b/clang/test/Driver/split-debug.c
@@ -12,3 +12,9 @@
// RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s
//
// CHECK-NO-ACTIONS-NOT: -split-dwarf
+
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -o Bad.x -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-BAD < %t %s
+//
+// CHECK-BAD-NOT: "Bad.dwo"
OpenPOWER on IntegriCloud