[llvm] r193568 - Debug Info: use createAndAddDIE to wrap around "new DIE" in DwarfDebug.
Manman Ren
manman.ren at gmail.com
Mon Oct 28 18:03:02 PDT 2013
Author: mren
Date: Mon Oct 28 20:03:01 2013
New Revision: 193568
URL: http://llvm.org/viewvc/llvm-project?rev=193568&view=rev
Log:
Debug Info: use createAndAddDIE to wrap around "new DIE" in DwarfDebug.
This commit ensures DIEs are constructed within a compile unit and
immediately added to their parents.
Reviewed off-list by Eric.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=193568&r1=193567&r2=193568&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Oct 28 20:03:01 2013
@@ -378,9 +378,8 @@ DIE *DwarfDebug::updateSubprogramScopeDI
// concrete DIE twice.
if (DIE *AbsSPDIE = AbstractSPDies.lookup(SPNode)) {
// Pick up abstract subprogram DIE.
- SPDie = new DIE(dwarf::DW_TAG_subprogram);
+ SPDie = SPCU->createAndAddDIE(dwarf::DW_TAG_subprogram, *SPCU->getCUDie());
SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin, AbsSPDIE);
- SPCU->addDie(SPDie);
} else {
DISubprogram SPDecl = SP.getFunctionDeclaration();
if (!SPDecl.isSubprogram()) {
@@ -401,19 +400,19 @@ DIE *DwarfDebug::updateSubprogramScopeDI
uint16_t SPTag = SPTy.getTag();
if (SPTag == dwarf::DW_TAG_subroutine_type)
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
- DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
+ DIE *Arg =
+ SPCU->createAndAddDIE(dwarf::DW_TAG_formal_parameter, *SPDie);
DIType ATy = DIType(Args.getElement(i));
SPCU->addType(Arg, ATy);
if (ATy.isArtificial())
SPCU->addFlag(Arg, dwarf::DW_AT_artificial);
if (ATy.isObjectPointer())
SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg);
- SPDie->addChild(Arg);
}
DIE *SPDeclDie = SPDie;
- SPDie = new DIE(dwarf::DW_TAG_subprogram);
+ SPDie =
+ SPCU->createAndAddDIE(dwarf::DW_TAG_subprogram, *SPCU->getCUDie());
SPCU->addDIEEntry(SPDie, dwarf::DW_AT_specification, SPDeclDie);
- SPCU->addDie(SPDie);
}
}
}
More information about the llvm-commits
mailing list