diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-03-17 23:58:03 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-03-17 23:58:03 +0000 |
commit | a1f86256623824ba0dadee5a607c047a8aba803d (patch) | |
tree | 874ff48c93028749a9912a6fd31520dec8b8feae /llvm/lib/CodeGen/AsmPrinter | |
parent | 64e936f41c1b733244809ee1b1f1af6ffa2513b3 (diff) | |
download | bcm5719-llvm-a1f86256623824ba0dadee5a607c047a8aba803d.tar.gz bcm5719-llvm-a1f86256623824ba0dadee5a607c047a8aba803d.zip |
DebugInfo: Add ability to not emit DW_AT_vtable_elem_location for virtual functions.
A virtual index of -1u indicates that the subprogram's virtual index is
unrepresentable (for example, when using the relative vtable ABI), so do
not emit a DW_AT_vtable_elem_location attribute for it.
Differential Revision: http://reviews.llvm.org/D18236
llvm-svn: 263765
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index d2cf8effdc2..387921cb46f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1218,10 +1218,12 @@ void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, unsigned VK = SP->getVirtuality(); if (VK) { addUInt(SPDie, dwarf::DW_AT_virtuality, dwarf::DW_FORM_data1, VK); - DIELoc *Block = getDIELoc(); - addUInt(*Block, dwarf::DW_FORM_data1, dwarf::DW_OP_constu); - addUInt(*Block, dwarf::DW_FORM_udata, SP->getVirtualIndex()); - addBlock(SPDie, dwarf::DW_AT_vtable_elem_location, Block); + if (SP->getVirtualIndex() != -1u) { + DIELoc *Block = getDIELoc(); + addUInt(*Block, dwarf::DW_FORM_data1, dwarf::DW_OP_constu); + addUInt(*Block, dwarf::DW_FORM_udata, SP->getVirtualIndex()); + addBlock(SPDie, dwarf::DW_AT_vtable_elem_location, Block); + } ContainingTypeMap.insert( std::make_pair(&SPDie, resolve(SP->getContainingType()))); } |