summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-07-23 23:04:28 +0000
committerDevang Patel <dpatel@apple.com>2010-07-23 23:04:28 +0000
commitcb9fe9ec16bb785642ff18f8d31314e04dfc12a6 (patch)
treebfac94e886d61d69300a10d9f6b00f6d75d5968c /clang/lib/CodeGen/CGDebugInfo.cpp
parentc17dd5790b1264d748a107732a744f76fe9bc17b (diff)
downloadbcm5719-llvm-cb9fe9ec16bb785642ff18f8d31314e04dfc12a6.tar.gz
bcm5719-llvm-cb9fe9ec16bb785642ff18f8d31314e04dfc12a6.zip
Revert r109263.
llvm-svn: 109284
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 7458fa3e6f2..753cdcddd28 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -188,25 +188,18 @@ 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.
- char *FileNamePtr = NULL;
- if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
- std::string MainFileDir;
+ std::string MainFileDir;
+ if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID()))
MainFileDir = MainFile->getDir()->getName();
- 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());
- }
+ else
+ MainFileDir = AbsFileName.getDirname();
unsigned LangTag;
const LangOptions &LO = CGM.getLangOptions();
@@ -236,7 +229,7 @@ void CGDebugInfo::CreateCompileUnit() {
// Create new compile unit.
TheCU = DebugFactory.CreateCompileUnit(
- LangTag, FileNamePtr, llvm::StringRef(), Producer, true,
+ LangTag, AbsFileName.getLast(), MainFileDir, Producer, true,
LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers);
}
OpenPOWER on IntegriCloud