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 | bbdd02cc303d0f38f7739b64f419d645ca17b533 (patch) | |
tree | ca555cce9d2cf9433d337eded22ab6467f726ac7 /lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | |
parent | 1a5e787f701c45ac2487d400faf6f6d4def6dcef (diff) | |
download | llvm-bbdd02cc303d0f38f7739b64f419d645ca17b533.tar.gz llvm-bbdd02cc303d0f38f7739b64f419d645ca17b533.tar.bz2 llvm-bbdd02cc303d0f38f7739b64f419d645ca17b533.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193567 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index f58bddf99c..8528ab7edf 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/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()) |