diff options
author | Manman Ren <manman.ren@gmail.com> | 2013-10-29 00:58:04 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2013-10-29 00:58:04 +0000 |
commit | 73d697c641f18c093a9d801c82f914e255c15072 (patch) | |
tree | 9b7b445c13e0f3e3c42eae713b72caf776021056 /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | |
parent | b987e517f2db1bcb780f460454079d6bea0c83e6 (diff) | |
download | bcm5719-llvm-73d697c641f18c093a9d801c82f914e255c15072.tar.gz bcm5719-llvm-73d697c641f18c093a9d801c82f914e255c15072.zip |
Debug Info: use createAndAddDIE for newly-created Subprogram DIEs.
More patches will be submitted to convert "new DIE(" to use createAddAndDIE in
DwarfCompileUnit.cpp. This will simplify implementation of addDIEEntry where
we have to decide between ref4 and ref_addr, because DIEs that can be shared
across CU will be added to a CU already.
Reviewed off-list by Eric.
llvm-svn: 193567
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index f58bddf99c7..8528ab7edf5 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -1356,12 +1356,14 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) { if (SPDie) return SPDie; - SPDie = new DIE(dwarf::DW_TAG_subprogram); + DISubprogram SPDecl = SP.getFunctionDeclaration(); + if (SPDecl.isSubprogram()) + // Add subprogram definitions to the CU die directly. + ContextDIE = CUDie.get(); // DW_TAG_inlined_subroutine may refer to this DIE. - insertDIE(SP, SPDie); + SPDie = createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, SP); - DISubprogram SPDecl = SP.getFunctionDeclaration(); DIE *DeclDie = NULL; if (SPDecl.isSubprogram()) DeclDie = getOrCreateSubprogramDIE(SPDecl); @@ -1375,15 +1377,9 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) { // Refer function declaration directly. addDIEEntry(SPDie, dwarf::DW_AT_specification, DeclDie); - // Add subprogram definitions to the CU die directly. - addDie(SPDie); - return SPDie; } - // Add to context owner. - ContextDIE->addChild(SPDie); - // Add the linkage name if we have one. StringRef LinkageName = SP.getLinkageName(); if (!LinkageName.empty()) |