Make sure we only use the output file as a base for debug splitting

if we're compiling.

llvm-svn: 175851
This commit is contained in:
Eric Christopher 2013-02-22 01:33:46 +00:00
parent ac2d082f58
commit 77569ffd06
2 changed files with 7 additions and 1 deletions

View File

@ -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);

View File

@ -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"