summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-03-17 23:29:40 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-03-17 23:29:40 +0000
commitc7f29dc068c54ff74ced4653f6d0b25a3cf6b429 (patch)
tree7e5129d5874edb7e23522523be655ab2b9766a2d /llvm/lib
parentffdfaa690834a7371e5244bde684ff555888854e (diff)
downloadbcm5719-llvm-c7f29dc068c54ff74ced4653f6d0b25a3cf6b429.tar.gz
bcm5719-llvm-c7f29dc068c54ff74ced4653f6d0b25a3cf6b429.zip
DebugInfo: Move line table zero-directory-index (compilation dir) handling into MCDwarf
Our handling of compilation directory in DwarfDebug was broken (incorrectly using the 'last' compilation directory (that of the last CU in the metadata list) for all function emission in any CU). By moving this handling down into MCDwarf the issue is fixed as the compilation dir is tracked correctly per line table. llvm-svn: 204089
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp6
-rw-r--r--llvm/lib/MC/MCDwarf.cpp2
2 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 4791e6d5ade..5b05ee1f735 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -679,10 +679,6 @@ unsigned DwarfDebug::getOrCreateSourceID(StringRef FileName, StringRef DirName,
if (Asm->OutStreamer.hasRawTextSupport())
CUID = 0;
- // TODO: this might not belong here. See if we can factor this better.
- if (DirName == CompilationDir)
- DirName = "";
-
// Print out a .file directive to specify files for .loc directives.
return Asm->OutStreamer.EmitDwarfFileDirective(0, DirName, FileName, CUID);
}
@@ -704,6 +700,8 @@ DwarfCompileUnit *DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
DwarfCompileUnit *NewCU = new DwarfCompileUnit(
InfoHolder.getUnits().size(), Die, DIUnit, Asm, this, &InfoHolder);
InfoHolder.addUnit(NewCU);
+ Asm->OutStreamer.getContext().setMCLineTableCompilationDir(
+ NewCU->getUniqueID(), CompilationDir);
NewCU->addString(Die, dwarf::DW_AT_producer, DIUnit.getProducer());
NewCU->addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index edeee20ab47..f5260952c7a 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -340,6 +340,8 @@ unsigned MCDwarfLineTable::getFile(StringRef &Directory, StringRef &FileName,
unsigned MCDwarfLineTableHeader::getFile(StringRef &Directory,
StringRef &FileName,
unsigned FileNumber) {
+ if (Directory == CompilationDir)
+ Directory = "";
if (FileName.empty()) {
FileName = "<stdin>";
Directory = "";
OpenPOWER on IntegriCloud