[PATCH] D28040: Don't store the NULL DIEs in the DIE array in the DWARFUnit.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 17:04:53 PST 2016


aprantl added inline comments.


================
Comment at: lib/DebugInfo/DWARF/DWARFDie.cpp:359
   if (!isValid())
-    return;
+    return -1U;
   DataExtractor debug_info_data = U->getDebugInfoExtractor();
----------------
Is there a better alternative to returning a magic value?


================
Comment at: tools/dsymutil/DwarfLinker.cpp:1799
   if (DIE.hasChildren())
-    for (auto Child = DIE.getFirstChild(); Child && !Child.isNULL();
-         Child = Child.getSibling())
+    for (auto Child = DIE.getFirstChild(); Child; Child = Child.getSibling())
       Info.Prune &= analyzeContextInfo(Child, MyIdx, CU, CurrentDeclContext,
----------------
Might make sense to add a method that returns something like a SiblingIterator at some point in the future?


================
Comment at: unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp:1050
   auto B2 = B1.getSibling();
-  EXPECT_TRUE(B2.getSibling().isNULL());
+  EXPECT_FALSE(B2.getSibling().isValid());
   
----------------
Should we introduce something like a hasSibling() method? This almost sounds like it has a corrupted sibling DIE.


https://reviews.llvm.org/D28040





More information about the llvm-commits mailing list