aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCContext.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2010-08-09 22:52:14 +0000
committerKevin Enderby <enderby@apple.com>2010-08-09 22:52:14 +0000
commitb07ce60981368f816af4caa3257e1e4ebf059133 (patch)
treefd377dabc972ee82042efd43d9337e1f3df59c12 /lib/MC/MCContext.cpp
parentb000d683c822bab7bed608937048b24b4b6db551 (diff)
Next bit of support for the dwarf .file directive. This patch takes the
previously collected info from the .file directives and outputs the encoded bytes for it. For now this is only in the Mach-O streamer but at some point will move to a more generic place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110617 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCContext.cpp')
-rw-r--r--lib/MC/MCContext.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp
index 5812622bb0..3996334d9b 100644
--- a/lib/MC/MCContext.cpp
+++ b/lib/MC/MCContext.cpp
@@ -222,7 +222,7 @@ unsigned MCContext::GetDwarfFile(StringRef FileName, unsigned FileNumber) {
} else {
StringRef Directory = Slash.first;
Name = Slash.second;
- for (DirIndex = 1; DirIndex < MCDwarfDirs.size(); DirIndex++) {
+ for (DirIndex = 0; DirIndex < MCDwarfDirs.size(); DirIndex++) {
if (Directory == MCDwarfDirs[DirIndex])
break;
}
@@ -231,6 +231,11 @@ unsigned MCContext::GetDwarfFile(StringRef FileName, unsigned FileNumber) {
memcpy(Buf, Directory.data(), Directory.size());
MCDwarfDirs.push_back(StringRef(Buf, Directory.size()));
}
+ // The DirIndex is one based, as DirIndex of 0 is used for FileNames with
+ // no directories. MCDwarfDirs[] is unlike MCDwarfFiles[] in that the
+ // directory names are stored at MCDwarfDirs[DirIndex-1] where FileNames are
+ // stored at MCDwarfFiles[FileNumber].Name .
+ DirIndex++;
}
// Now make the MCDwarfFile entry and place it in the slot in the MCDwarfFiles