summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-07-23 20:38:37 +0000
committerDevang Patel <dpatel@apple.com>2010-07-23 20:38:37 +0000
commit28f167699acf28bf6996ea55e89200940bccbf2b (patch)
tree141e36c406f2bee34608ce2db17348faabbf721f
parent3032354bbef002ccf0c871b70e44d4795c5ac07c (diff)
downloadbcm5719-llvm-28f167699acf28bf6996ea55e89200940bccbf2b.tar.gz
bcm5719-llvm-28f167699acf28bf6996ea55e89200940bccbf2b.zip
There is no need to use separate dir name for AT_comp_dir attribute. Using absolute path for filename allows clients to query complete file location info from gdb breakpoints. Save constructed full file name.
llvm-svn: 109263
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 753cdcddd28..7458fa3e6f2 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -188,18 +188,25 @@ void CGDebugInfo::CreateCompileUnit() {
if (MainFileName.empty())
MainFileName = "<unknown>";
- llvm::sys::Path AbsFileName(MainFileName);
- AbsFileName.makeAbsolute();
-
// The main file name provided via the "-main-file-name" option contains just
// the file name itself with no path information. This file name may have had
// a relative path, so we look into the actual file entry for the main
// file to determine the real absolute path for the file.
- std::string MainFileDir;
- if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID()))
+ char *FileNamePtr = NULL;
+ if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
+ std::string MainFileDir;
MainFileDir = MainFile->getDir()->getName();
- else
- MainFileDir = AbsFileName.getDirname();
+ llvm::sys::Path AbsFileDirName(MainFileDir);
+ AbsFileDirName.makeAbsolute();
+ AbsFileDirName.appendComponent(MainFileName);
+ FileNamePtr = DebugInfoNames.Allocate<char>(AbsFileDirName.size());
+ memcpy(FileNamePtr, AbsFileDirName.c_str(), AbsFileDirName.size());
+ } else {
+ llvm::sys::Path AbsFileDirName(MainFileName);
+ AbsFileDirName.makeAbsolute();
+ FileNamePtr = DebugInfoNames.Allocate<char>(AbsFileDirName.size());
+ memcpy(FileNamePtr, AbsFileDirName.c_str(), AbsFileDirName.size());
+ }
unsigned LangTag;
const LangOptions &LO = CGM.getLangOptions();
@@ -229,7 +236,7 @@ void CGDebugInfo::CreateCompileUnit() {
// Create new compile unit.
TheCU = DebugFactory.CreateCompileUnit(
- LangTag, AbsFileName.getLast(), MainFileDir, Producer, true,
+ LangTag, FileNamePtr, llvm::StringRef(), Producer, true,
LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers);
}
OpenPOWER on IntegriCloud