From b07ce60981368f816af4caa3257e1e4ebf059133 Mon Sep 17 00:00:00 2001 From: Kevin Enderby Date: Mon, 9 Aug 2010 22:52:14 +0000 Subject: 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 --- lib/MC/MCContext.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/MC/MCContext.cpp') 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 -- cgit v1.2.3