diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h @@ -64,14 +64,13 @@ mutable std::optional 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 diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/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(); } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp +++ b/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)