diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-11-10 22:34:29 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-11-10 22:34:29 +0000 |
commit | 79278365d3fd8eafabd2da4495f6fcd490e8cf4d (patch) | |
tree | f7a003df3f085617b5712e75bf125b9422f1bbc3 /llvm/lib/CodeGen | |
parent | 86660ab0b0073603ec535e55ad445dc491f8f078 (diff) | |
download | bcm5719-llvm-79278365d3fd8eafabd2da4495f6fcd490e8cf4d.tar.gz bcm5719-llvm-79278365d3fd8eafabd2da4495f6fcd490e8cf4d.zip |
Check in getOrCreateSubprogramDIE if a declaration exists and if so output
it first.
This is a more general fix to pr11300.
llvm-svn: 144324
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 12 |
2 files changed, 12 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index d440a746197..657763a8fce 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -934,6 +934,12 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) { if (SPDie) return SPDie; + DISubprogram SPDecl = SP.getFunctionDeclaration(); + DIE *DeclDie = NULL; + if (SPDecl.isSubprogram()) { + DeclDie = getOrCreateSubprogramDIE(SPDecl); + } + SPDie = new DIE(dwarf::DW_TAG_subprogram); // DW_TAG_inlined_subroutine may refer to this DIE. @@ -952,8 +958,13 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) { // If this DIE is going to refer declaration info using AT_specification // then there is no need to add other attributes. - if (SP.getFunctionDeclaration().isSubprogram()) + if (DeclDie) { + // Refer function declaration directly. + addDIEEntry(SPDie, dwarf::DW_AT_specification, dwarf::DW_FORM_ref4, + DeclDie); + return SPDie; + } // Constructors and operators for anonymous aggregates do not have names. if (!SP.getName().empty()) diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 5d05a3cc3aa..581f04bf2bf 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -598,20 +598,8 @@ void DwarfDebug::constructSubprogramDIE(CompileUnit *TheCU, // class type. return; - DISubprogram SPDecl = SP.getFunctionDeclaration(); - DIE *DeclDie = NULL; - if (SPDecl.isSubprogram()) { - DeclDie = TheCU->getOrCreateSubprogramDIE(SPDecl); - } - DIE *SubprogramDie = TheCU->getOrCreateSubprogramDIE(SP); - if (DeclDie) { - // Refer function declaration directly. - TheCU->addDIEEntry(SubprogramDie, dwarf::DW_AT_specification, - dwarf::DW_FORM_ref4, DeclDie); - } - // Add to map. TheCU->insertDIE(N, SubprogramDie); |