summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-08 05:11:16 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-08 05:11:16 +0000
commit3b358a3d830c6f3587813359eba62e81ee215303 (patch)
tree5832e24dc179e220a1a156212d3d88c71382a63a /clang/lib/Driver/Tools.cpp
parentd969f5fb6f71c8a79d5b939a61cb99d475983125 (diff)
downloadbcm5719-llvm-3b358a3d830c6f3587813359eba62e81ee215303.tar.gz
bcm5719-llvm-3b358a3d830c6f3587813359eba62e81ee215303.zip
Make debug info work when using -save-temps.
- This is pretty ugly, but the most obvious solution. Chime in if you have a nicer one. - The problem is that with -save-temps, clang-cc has no idea what the name of the original input file is. However, the user expects to be able to set breakpoints based on the input file name. - We support this by providing a new option -main-file-name (similar to -dumpbase used by gcc) which allows the driver to pass in the original file name. - <rdar://problem/6753383> building with clang using --save-temps gets the compile unit name from the .i file... llvm-svn: 68595
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index eb9bbf2b7b4..4ae96c2e643 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -74,6 +74,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// The make clang go fast button.
CmdArgs.push_back("-disable-free");
+ // Set the main file name, so that debug info works even with
+ // -save-temps.
+ CmdArgs.push_back("-main-file-name");
+ CmdArgs.push_back(darwin::CC1::getBaseInputName(Args, Inputs));
+
if (isa<AnalyzeJobAction>(JA)) {
// Add default argument set.
//
OpenPOWER on IntegriCloud