[PATCH] D154655: [DebugInfo] Force users of DWARFDebugAbbrev to call parse before iterating

Alex Langford via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 11:26:25 PDT 2023


bulbazord updated this revision to Diff 539652.
bulbazord marked an inline comment as done.
bulbazord added a comment.

Remove deleted BOLT code


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154655/new/

https://reviews.llvm.org/D154655

Files:
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
  llvm/tools/obj2yaml/dwarf2yaml.cpp


Index: llvm/tools/obj2yaml/dwarf2yaml.cpp
===================================================================
--- llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -26,6 +26,7 @@
   auto AbbrevSetPtr = DCtx.getDebugAbbrev();
   if (AbbrevSetPtr) {
     uint64_t AbbrevTableID = 0;
+    AbbrevSetPtr->parse();
     for (auto AbbrvDeclSet : *AbbrevSetPtr) {
       Y.DebugAbbrev.emplace_back();
       Y.DebugAbbrev.back().ID = AbbrevTableID++;
@@ -219,6 +220,7 @@
     if (NewUnit.Version >= 5)
       NewUnit.Type = (dwarf::UnitType)CU->getUnitType();
     const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev();
+    DebugAbbrev->parse();
     NewUnit.AbbrevTableID = std::distance(
         DebugAbbrev->begin(),
         llvm::find_if(
Index: llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
===================================================================
--- llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
+++ llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
@@ -73,7 +73,7 @@
   void parse() const;
 
   DWARFAbbreviationDeclarationSetMap::const_iterator begin() const {
-    parse();
+    assert(!Data && "Must call parse before iterating over DWARFDebugAbbrev");
     return AbbrDeclSets.begin();
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154655.539652.patch
Type: text/x-patch
Size: 1261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230712/b503385e/attachment-0001.bin>


More information about the llvm-commits mailing list