From c9abc043af88f90d177a5bd147f627b78ca49fde Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 8 Apr 2009 05:11:16 +0000 Subject: 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. - building with clang using --save-temps gets the compile unit name from the .i file... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68595 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/CodeGen/CGDebugInfo.cpp') diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index c0819369b1..45ceb2b8e6 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -74,6 +74,12 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) { const char *DirName = FE ? FE->getDir()->getName() : ""; const LangOptions &LO = M->getLangOptions(); + + // If this is the main file, use the user provided main file name if + // specified. + if (isMain && LO.getMainFileName()) + FileName = LO.getMainFileName(); + unsigned LangTag; if (LO.CPlusPlus) { if (LO.ObjC1) -- cgit v1.2.3