Index: lib/DebugInfo/DWARFCompileUnit.h =================================================================== --- lib/DebugInfo/DWARFCompileUnit.h +++ lib/DebugInfo/DWARFCompileUnit.h @@ -17,10 +17,8 @@ class DWARFCompileUnit : public DWARFUnit { public: DWARFCompileUnit(DWARFContext &Context, const DWARFSection &Section, - const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS, - StringRef SOS, StringRef AOS, bool LE, - const DWARFUnitSectionBase &UnitSection) - : DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LE, UnitSection) {} + bool IsDWO, const DWARFUnitSectionBase &UnitSection) + : DWARFUnit(Context, Section, IsDWO, UnitSection) {} void dump(raw_ostream &OS); // VTable anchor. ~DWARFCompileUnit() override; Index: lib/DebugInfo/DWARFTypeUnit.h =================================================================== --- lib/DebugInfo/DWARFTypeUnit.h +++ lib/DebugInfo/DWARFTypeUnit.h @@ -19,11 +19,9 @@ uint64_t TypeHash; uint32_t TypeOffset; public: - DWARFTypeUnit(DWARFContext &Context, const DWARFSection &Section, - const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS, - StringRef SOS, StringRef AOS, bool LE, + DWARFTypeUnit(DWARFContext &Context, const DWARFSection &Section, bool IsDWO, const DWARFUnitSectionBase &UnitSection) - : DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LE, UnitSection) {} + : DWARFUnit(Context, Section, IsDWO, UnitSection) {} uint32_t getHeaderSize() const override { return DWARFUnit::getHeaderSize() + 12; } Index: lib/DebugInfo/DWARFUnit.h =================================================================== --- lib/DebugInfo/DWARFUnit.h +++ lib/DebugInfo/DWARFUnit.h @@ -42,8 +42,7 @@ protected: virtual void parseImpl(DWARFContext &Context, const DWARFSection &Section, - const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS, - StringRef SOS, StringRef AOS, bool isLittleEndian) = 0; + bool IsDWO, bool isLittleEndian) = 0; ~DWARFUnitSectionBase() {} }; @@ -80,16 +79,14 @@ } private: - void parseImpl(DWARFContext &Context, const DWARFSection &Section, - const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS, - StringRef SOS, StringRef AOS, bool LE) override { + void parseImpl(DWARFContext &Context, const DWARFSection &Section, bool IsDWO, + bool LE) override { if (Parsed) return; DataExtractor Data(Section.Data, LE, 0); uint32_t Offset = 0; while (Data.isValidOffset(Offset)) { - auto U = llvm::make_unique(Context, Section, DA, RS, SS, SOS, - AOS, LE, *this); + auto U = llvm::make_unique(Context, Section, IsDWO, *this); if (!U->extract(Data, &Offset)) break; this->push_back(std::move(U)); @@ -139,9 +136,7 @@ virtual uint32_t getHeaderSize() const { return 11; } public: - DWARFUnit(DWARFContext &Context, const DWARFSection &Section, - const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS, - StringRef SOS, StringRef AOS, bool LE, + DWARFUnit(DWARFContext &Context, const DWARFSection &Section, bool IsDWO, const DWARFUnitSectionBase &UnitSection); virtual ~DWARFUnit(); Index: lib/DebugInfo/DWARFUnit.cpp =================================================================== --- lib/DebugInfo/DWARFUnit.cpp +++ lib/DebugInfo/DWARFUnit.cpp @@ -18,25 +18,23 @@ using namespace dwarf; void DWARFUnitSectionBase::parse(DWARFContext &C, const DWARFSection &Section) { - parseImpl(C, Section, C.getDebugAbbrev(), C.getRangeSection(), - C.getStringSection(), StringRef(), C.getAddrSection(), - C.isLittleEndian()); + parseImpl(C, Section, false, C.isLittleEndian()); } void DWARFUnitSectionBase::parseDWO(DWARFContext &C, const DWARFSection &DWOSection) { - parseImpl(C, DWOSection, C.getDebugAbbrevDWO(), C.getRangeDWOSection(), - C.getStringDWOSection(), C.getStringOffsetDWOSection(), - C.getAddrSection(), C.isLittleEndian()); + parseImpl(C, DWOSection, true, C.isLittleEndian()); } -DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section, - const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS, - StringRef SOS, StringRef AOS, bool LE, +DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section, bool IsDWO, const DWARFUnitSectionBase &UnitSection) - : Context(DC), InfoSection(Section), Abbrev(DA), RangeSection(RS), - StringSection(SS), StringOffsetSection(SOS), AddrOffsetSection(AOS), - isLittleEndian(LE), UnitSection(UnitSection) { + : Context(DC), InfoSection(Section), + Abbrev(IsDWO ? DC.getDebugAbbrevDWO() : DC.getDebugAbbrev()), + RangeSection(IsDWO ? DC.getRangeDWOSection() : DC.getRangeSection()), + StringSection(IsDWO ? DC.getStringDWOSection() : DC.getStringSection()), + StringOffsetSection(IsDWO ? DC.getStringOffsetDWOSection() : StringRef()), + AddrOffsetSection(DC.getAddrSection()), + isLittleEndian(DC.isLittleEndian()), UnitSection(UnitSection) { clear(); }