summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2011-11-01 23:39:05 +0000
committerKevin Enderby <enderby@apple.com>2011-11-01 23:39:05 +0000
commit064e48a3dce1fd29a35b4b1b01a8c4b67e29c74a (patch)
tree6b2b60ee0a6c105c0d136290c52ee1770cf9b540 /lib
parent6284afc293c8f6e84dffab8731aa9e679d437745 (diff)
downloadllvm-064e48a3dce1fd29a35b4b1b01a8c4b67e29c74a.tar.gz
llvm-064e48a3dce1fd29a35b4b1b01a8c4b67e29c74a.tar.bz2
llvm-064e48a3dce1fd29a35b4b1b01a8c4b67e29c74a.tar.xz
Fixed a bug in the code to create a dwarf file and directory table entires when
it is separating the directory part from the basename of the FileName. Noticed that this: .file 1 "dir/foo" when assembled got the two parts switched. Using the Mac OS X dwarfdump tool it can be seen easily: % dwarfdump -a a.out include_directories[ 1] = 'foo' Dir Mod Time File Len File Name ---- ---------- ---------- --------------------------- file_names[ 1] 1 0x00000000 0x00000000 dir ... Which should be: ... include_directories[ 1] = 'dir' Dir Mod Time File Len File Name ---- ---------- ---------- --------------------------- file_names[ 1] 1 0x00000000 0x00000000 foo git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143521 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/MC/MCContext.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp
index 814726ebd8..a1a01e3bad 100644
--- a/lib/MC/MCContext.cpp
+++ b/lib/MC/MCContext.cpp
@@ -273,8 +273,10 @@ unsigned MCContext::GetDwarfFile(StringRef Directory, StringRef FileName,
// Separate the directory part from the basename of the FileName.
std::pair<StringRef, StringRef> Slash = FileName.rsplit('/');
Directory = Slash.second;
- if (!Directory.empty())
- FileName = Slash.first;
+ if (!Directory.empty()) {
+ Directory = Slash.first;
+ FileName = Slash.second;
+ }
}
// Find or make a entry in the MCDwarfDirs vector for this Directory.