[PATCH] D152947: [DebugInfo] Change DWARFDebugAbbrev initialization

Alex Langford via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 11:19:27 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0356ceedf2e9: [DebugInfo] Change DWARFDebugAbbrev initialization (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152947

Files:
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
  llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp


Index: llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
@@ -102,17 +102,8 @@
   return Buffer;
 }
 
-DWARFDebugAbbrev::DWARFDebugAbbrev() { clear(); }
-
-void DWARFDebugAbbrev::clear() {
-  AbbrDeclSets.clear();
-  PrevAbbrOffsetPos = AbbrDeclSets.end();
-}
-
-void DWARFDebugAbbrev::extract(DataExtractor Data) {
-  clear();
-  this->Data = Data;
-}
+DWARFDebugAbbrev::DWARFDebugAbbrev(DataExtractor Data)
+    : AbbrDeclSets(), PrevAbbrOffsetPos(AbbrDeclSets.end()), Data(Data) {}
 
 void DWARFDebugAbbrev::parse() const {
   if (!Data)
Index: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -938,9 +938,7 @@
     return Abbrev.get();
 
   DataExtractor abbrData(DObj->getAbbrevSection(), isLittleEndian(), 0);
-
-  Abbrev.reset(new DWARFDebugAbbrev());
-  Abbrev->extract(abbrData);
+  Abbrev.reset(new DWARFDebugAbbrev(abbrData));
   return Abbrev.get();
 }
 
@@ -949,8 +947,7 @@
     return AbbrevDWO.get();
 
   DataExtractor abbrData(DObj->getAbbrevDWOSection(), isLittleEndian(), 0);
-  AbbrevDWO.reset(new DWARFDebugAbbrev());
-  AbbrevDWO->extract(abbrData);
+  AbbrevDWO.reset(new DWARFDebugAbbrev(abbrData));
   return AbbrevDWO.get();
 }
 
Index: llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
===================================================================
--- llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
+++ llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
@@ -64,14 +64,13 @@
   mutable std::optional<DataExtractor> Data;
 
 public:
-  DWARFDebugAbbrev();
+  DWARFDebugAbbrev(DataExtractor Data);
 
   const DWARFAbbreviationDeclarationSet *
   getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const;
 
   void dump(raw_ostream &OS) const;
   void parse() const;
-  void extract(DataExtractor Data);
 
   DWARFAbbreviationDeclarationSetMap::const_iterator begin() const {
     parse();
@@ -81,9 +80,6 @@
   DWARFAbbreviationDeclarationSetMap::const_iterator end() const {
     return AbbrDeclSets.end();
   }
-
-private:
-  void clear();
 };
 
 } // end namespace llvm


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152947.532246.patch
Type: text/x-patch
Size: 2334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230616/d7f05442/attachment.bin>


More information about the llvm-commits mailing list