summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2014-04-12 01:44:42 +0000
committerAdrian Prantl <aprantl@apple.com>2014-04-12 01:44:42 +0000
commit1f2f3c3434cca74a67358c1de18a82e2f98497e9 (patch)
tree5f82a2b23e7bfd3dbbb6807b779d6e3edb4b3ede /llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
parentdad17727ae98fdee6a7bcadb6b57947e141d9c5d (diff)
downloadbcm5719-llvm-1f2f3c3434cca74a67358c1de18a82e2f98497e9.tar.gz
bcm5719-llvm-1f2f3c3434cca74a67358c1de18a82e2f98497e9.zip
Debug info: (bugfix) C++ C/Dtors can be compiled to multiple functions,
therefore, their declaration cannot have one DW_AT_linkage_name. The specific instances however can and should have that attribute. This patch reorders the code in DwarfUnit::getOrCreateSubprogramDIE() to emit linkage names for C/Dtors. rdar://problem/16362674. llvm-svn: 206096
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 82e9bb008a0..2302abef31d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1467,20 +1467,25 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
// Add function template parameters.
addTemplateParams(*SPDie, SP.getTemplateParams());
- // If this DIE is going to refer declaration info using AT_specification
- // then there is no need to add other attributes.
- if (DeclDie) {
+ if (DeclDie)
// Refer function declaration directly.
addDIEEntry(SPDie, dwarf::DW_AT_specification, DeclDie);
- return SPDie;
+ // Add the linkage name if we have one and it isn't in the Decl.
+ StringRef LinkageName = SP.getLinkageName();
+ if (!LinkageName.empty()) {
+ if (SPDecl.isSubprogram() && !SPDecl.getLinkageName().empty())
+ assert(SPDecl.getLinkageName() == SP.getLinkageName() &&
+ "decl has a linkage name and it is different");
+ else
+ addString(SPDie, dwarf::DW_AT_MIPS_linkage_name,
+ GlobalValue::getRealLinkageName(LinkageName));
}
- // Add the linkage name if we have one.
- StringRef LinkageName = SP.getLinkageName();
- if (!LinkageName.empty())
- addString(SPDie, dwarf::DW_AT_MIPS_linkage_name,
- GlobalValue::getRealLinkageName(LinkageName));
+ // If this DIE is going to refer declaration info using AT_specification
+ // then there is no need to add other attributes.
+ if (DeclDie)
+ return SPDie;
// Constructors and operators for anonymous aggregates do not have names.
if (!SP.getName().empty())
OpenPOWER on IntegriCloud