DebugInfo: Use MC line table file entry uniquing for non-asm input as well.

See r204027 for the precursor to this that applied to asm debug info.

This required some non-obvious API changes to handle the case of asm
output (we never go asm->asm so this didn't come up in r204027): the
modification of the file/directory name by MCDwarfLineTableHeader needed
to be reflected in the MCAsmStreamer caller so it could print the
appropriate .file directive, so those StringRef parameters are now
non-const ref (in/out) parameters rather than just const.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204069 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie committed 2014-03-17 18:13:58 +00:00
1 parent 03a3f643b1
commit daeeb37373
5 files changed
+35 -49

No files matched your search

+9 -3
View File
@@ -287,6 +287,7 @@ std::pair<MCSymbol *, MCSymbol *> MCDwarfLineTableHeader::Emit(MCStreamer *MCOS)
// Second the file table.
for (unsigned i = 1; i < MCDwarfFiles.size(); i++) {
assert(!MCDwarfFiles[i].Name.empty());
MCOS->EmitBytes(MCDwarfFiles[i].Name); // FileName
MCOS->EmitBytes(StringRef("\0", 1)); // the null term. of the string
// the Directory num
@@ -331,14 +332,19 @@ const MCSymbol *MCDwarfLineTable::EmitCU(MCStreamer *MCOS) const {
return LineStartSym;
}
unsigned MCDwarfLineTable::getFile(StringRef Directory, StringRef FileName,
unsigned MCDwarfLineTable::getFile(StringRef &Directory, StringRef &FileName,
unsigned FileNumber) {
return Header.getFile(Directory, FileName, FileNumber);
}
unsigned MCDwarfLineTableHeader::getFile(StringRef Directory,
StringRef FileName,
unsigned MCDwarfLineTableHeader::getFile(StringRef &Directory,
StringRef &FileName,
unsigned FileNumber) {
if (FileName.empty()) {
FileName = "<stdin>";
Directory = "";
}
assert(!FileName.empty());
if (FileNumber == 0) {
FileNumber = SourceIdMap.size() + 1;
assert((MCDwarfFiles.empty() || FileNumber == MCDwarfFiles.size()) &&