summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2014-04-14 21:16:04 +0000
committerAdrian Prantl <aprantl@apple.com>2014-04-14 21:16:04 +0000
commit8714aaf0a5041c9177a51a042b1d86520ba0cf78 (patch)
treee4328ed295c28b58a86d6b81c299fb70576a7f2a /llvm/lib/CodeGen
parent3a8c087cb9583b8cb9af9b16c005ca74d41af619 (diff)
downloadbcm5719-llvm-8714aaf0a5041c9177a51a042b1d86520ba0cf78.tar.gz
bcm5719-llvm-8714aaf0a5041c9177a51a042b1d86520ba0cf78.zip
Re-apply r206096 after investigating the gdb buildbot failure.
Thanks to dblaikie for updating the testcase! 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: 206210
Diffstat (limited to 'llvm/lib/CodeGen')
-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 7f6fd5d13c3..06a6b737cc8 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1473,20 +1473,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