AsmPrinter: Return added DIE from DIE::addChild()
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfUnit.cpp
index fc57f2611884bd5428cac745be45e35df866d1f9..907f6706bc6a92e1ab384a2f1d0c45824f199ae4 100644 (file)
@@ -290,8 +290,7 @@ void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute,
 DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N) {
   assert(Tag != dwarf::DW_TAG_auto_variable &&
          Tag != dwarf::DW_TAG_arg_variable);
-  Parent.addChild(make_unique<DIE>((dwarf::Tag)Tag));
-  DIE &Die = *Parent.getChildren().back();
+  DIE &Die = Parent.addChild(make_unique<DIE>((dwarf::Tag)Tag));
   if (N)
     insertDIE(N, &Die);
   return Die;