diff options
author | Eric Christopher <echristo@gmail.com> | 2013-05-08 21:23:22 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-05-08 21:23:22 +0000 |
commit | 697fa1c8be6c52a5f1c72b35bb9fe3004e3e40e2 (patch) | |
tree | 44ae3712285dafe9f2a54a15bfe64db4ae02a957 /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | |
parent | 266abefed004e468842fc4ccf680cac999265d78 (diff) | |
download | bcm5719-llvm-697fa1c8be6c52a5f1c72b35bb9fe3004e3e40e2.tar.gz bcm5719-llvm-697fa1c8be6c52a5f1c72b35bb9fe3004e3e40e2.zip |
Make sure debug info contains linkage names (DW_AT_MIPS_linkage_name)
for constructors and destructors since the original declaration given
by the AT_specification both won't and can't.
Patch by Yacine Belkadi, I've cleaned up the testcases.
llvm-svn: 181471
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index c38ada6b66b..b56255cb9b1 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -1150,20 +1150,24 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) { // Add function template parameters. addTemplateParams(*SPDie, SP.getTemplateParams()); - // Unfortunately this code needs to stay here instead of below the - // AT_specification code in order to work around a bug in older - // gdbs that requires the linkage name to resolve multiple template - // functions. - // TODO: Remove this set of code when we get rid of the old gdb - // compatibility. StringRef LinkageName = SP.getLinkageName(); - if (!LinkageName.empty() && DD->useDarwinGDBCompat()) - addString(SPDie, dwarf::DW_AT_MIPS_linkage_name, - getRealLinkageName(LinkageName)); // If this DIE is going to refer declaration info using AT_specification - // then there is no need to add other attributes. + // then there is no need to add other attributes, except + // DW_AT_MIPS_linkage_name in two cases: + // 1) The current DIE has a linkage name but the referred-to declaration + // doesn't have one (e.g. constructor/destructor). + // 2) To work around a bug in older gdbs that requires the linkage name to + // resolve multiple template functions. TODO: Remove this case (the + // DD->useDarwinGDBCompat() condition) when we get rid of the old gdb + // compatibility. + if (DeclDie) { + if (!LinkageName.empty() + && (SPDecl.getLinkageName().empty() || DD->useDarwinGDBCompat())) + addString(SPDie, dwarf::DW_AT_MIPS_linkage_name, + getRealLinkageName(LinkageName)); + // Refer function declaration directly. addDIEEntry(SPDie, dwarf::DW_AT_specification, dwarf::DW_FORM_ref4, DeclDie); @@ -1172,7 +1176,7 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) { } // Add the linkage name if we have one. - if (!LinkageName.empty() && !DD->useDarwinGDBCompat()) + if (!LinkageName.empty()) addString(SPDie, dwarf::DW_AT_MIPS_linkage_name, getRealLinkageName(LinkageName)); |