summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-10-07 00:04:16 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-10-07 00:04:16 +0000
commitc9ad9191a7bcd98418c0e18f1df0d5ffba7496f4 (patch)
tree1c22d5361ce44de8e7b573496f81900b9d2512ea /llvm/lib/CodeGen/AsmPrinter
parent6c85598c5a6e7aa121ca5b4855713b188ebc8c1d (diff)
downloadbcm5719-llvm-c9ad9191a7bcd98418c0e18f1df0d5ffba7496f4.tar.gz
bcm5719-llvm-c9ad9191a7bcd98418c0e18f1df0d5ffba7496f4.zip
DebugInfo: Include the decl_line/decl_file in subprogram definitions if they differ from those in the declaration
This is handy for some AutoFDO stuff, and seems like a minor improvement to correctness (otherwise a debug info consumer might think the decl line/file of the def was the same as that of the declaration - though what a consumer might use that for, I'm not sure - maybe "list <func>" would've misbehaved with the old behavior?) and at a minor cost (in my experiment, with fission, without type units, without compression, 0.01% growth in debug info in the executable/objects, 0.02% growth in the .dwo files). llvm-svn: 249487
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 3a89c809da3..c441a67a5d7 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1151,6 +1151,14 @@ bool DwarfUnit::applySubprogramDefinitionAttributes(const DISubprogram *SP,
"definition DIE was created in "
"getOrCreateSubprogramDIE");
DeclLinkageName = SPDecl->getLinkageName();
+ unsigned DeclID =
+ getOrCreateSourceID(SPDecl->getFilename(), SPDecl->getDirectory());
+ unsigned DefID = getOrCreateSourceID(SP->getFilename(), SP->getDirectory());
+ if (DeclID != DefID)
+ addUInt(SPDie, dwarf::DW_AT_decl_file, None, DefID);
+
+ if (SP->getLine() != SPDecl->getLine())
+ addUInt(SPDie, dwarf::DW_AT_decl_line, None, SP->getLine());
}
// Add function template parameters.
OpenPOWER on IntegriCloud