DwarfDebug: Emit dwo_id+dwo_name for DICompileUnits that provide a dwoId.
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfFile.cpp
index cafaabba5a365ccd4683f419e3bb5c682c6950d7..51b27b462a7c67a5bdbbecc0414484df32f0da1c 100644 (file)
@@ -20,7 +20,10 @@ namespace llvm {
 DwarfFile::DwarfFile(AsmPrinter *AP, StringRef Pref, BumpPtrAllocator &DA)
     : Asm(AP), StrPool(DA, *Asm, Pref) {}
 
-DwarfFile::~DwarfFile() {}
+DwarfFile::~DwarfFile() {
+  for (DIEAbbrev *Abbrev : Abbreviations)
+    Abbrev->~DIEAbbrev();
+}
 
 // Define a unique number for the abbreviation.
 //
@@ -100,18 +103,15 @@ unsigned DwarfFile::computeSizeAndOffset(DIE &Die, unsigned Offset) {
   // Size the DIE attribute values.
   for (const auto &V : Die.values())
     // Size attribute value.
-    Offset += V.SizeOf(Asm, V.getForm());
-
-  // Get the children.
-  const auto &Children = Die.getChildren();
+    Offset += V.SizeOf(Asm);
 
   // Size the DIE children if any.
-  if (!Children.empty()) {
+  if (Die.hasChildren()) {
     (void)Abbrev;
     assert(Abbrev.hasChildren() && "Children flag not set");
 
-    for (auto &Child : Children)
-      Offset = computeSizeAndOffset(*Child, Offset);
+    for (auto &Child : Die.children())
+      Offset = computeSizeAndOffset(Child, Offset);
 
     // End of children marker.
     Offset += sizeof(int8_t);