diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-03-17 18:13:58 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-03-17 18:13:58 +0000 |
commit | c2df16b6d36678af7cbdeb8c748d6a289988f49b (patch) | |
tree | c434842c181ef5e64bc924b333928f06a033a6af /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | ec47bc2baef059cd7ebb8c3befbb3aa6c9bb8ff5 (diff) | |
download | bcm5719-llvm-c2df16b6d36678af7cbdeb8c748d6a289988f49b.tar.gz bcm5719-llvm-c2df16b6d36678af7cbdeb8c748d6a289988f49b.zip |
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.
llvm-svn: 204069
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index a03da3c452a..4791e6d5ade 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -171,8 +171,7 @@ static unsigned getDwarfVersionFromModule(const Module *M) { } DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M) - : Asm(A), MMI(Asm->MMI), FirstCU(0), SourceIdMap(DIEValueAllocator), - PrevLabel(NULL), GlobalRangeCount(0), + : Asm(A), MMI(Asm->MMI), FirstCU(0), PrevLabel(NULL), GlobalRangeCount(0), InfoHolder(A, "info_string", DIEValueAllocator), HasCURanges(false), UsedNonDefaultText(false), SkeletonHolder(A, "skel_string", DIEValueAllocator) { @@ -680,36 +679,12 @@ unsigned DwarfDebug::getOrCreateSourceID(StringRef FileName, StringRef DirName, if (Asm->OutStreamer.hasRawTextSupport()) CUID = 0; - // If FE did not provide a file name, then assume stdin. - if (FileName.empty()) { - FileName = "<stdin>"; - DirName = ""; - } - // TODO: this might not belong here. See if we can factor this better. if (DirName == CompilationDir) DirName = ""; - // FileIDCUMap stores the current ID for the given compile unit. - unsigned SrcId = FileIDCUMap[CUID] + 1; - - // We look up the CUID/file/dir by concatenating them with a zero byte. - SmallString<128> NamePair; - NamePair += utostr(CUID); - NamePair += '\0'; - NamePair += DirName; - NamePair += '\0'; // Zero bytes are not allowed in paths. - NamePair += FileName; - - StringMapEntry<unsigned> &Ent = SourceIdMap.GetOrCreateValue(NamePair, SrcId); - if (Ent.getValue() != SrcId) - return Ent.getValue(); - - FileIDCUMap[CUID] = SrcId; // Print out a .file directive to specify files for .loc directives. - Asm->OutStreamer.EmitDwarfFileDirective(SrcId, DirName, FileName, CUID); - - return SrcId; + return Asm->OutStreamer.EmitDwarfFileDirective(0, DirName, FileName, CUID); } void DwarfDebug::addGnuPubAttributes(DwarfUnit *U, DIE *D) const { @@ -730,8 +705,6 @@ DwarfCompileUnit *DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) { InfoHolder.getUnits().size(), Die, DIUnit, Asm, this, &InfoHolder); InfoHolder.addUnit(NewCU); - FileIDCUMap[NewCU->getUniqueID()] = 0; - NewCU->addString(Die, dwarf::DW_AT_producer, DIUnit.getProducer()); NewCU->addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data2, DIUnit.getLanguage()); |