From a29287d90da7b3b37e06345fd50b863b2cf1731a Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Wed, 8 Oct 2014 00:07:53 +0000 Subject: [PATCH] [DebugInfo] Pass DWARFSection into DWARFUnitSection constructor (NFC). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219259 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/DWARFContext.cpp | 8 ++++---- lib/DebugInfo/DWARFUnit.cpp | 16 +++++++--------- lib/DebugInfo/DWARFUnit.h | 28 ++++++++++++++-------------- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp index ceaff053ef8..2cacfd9b949 100644 --- a/lib/DebugInfo/DWARFContext.cpp +++ b/lib/DebugInfo/DWARFContext.cpp @@ -314,7 +314,7 @@ DWARFContext::getLineTableForUnit(DWARFUnit *cu) { } void DWARFContext::parseCompileUnits() { - CUs.parse(*this, getInfoSection().Data, getInfoSection().Relocs); + CUs.parse(*this, getInfoSection()); } void DWARFContext::parseTypeUnits() { @@ -322,12 +322,12 @@ void DWARFContext::parseTypeUnits() { return; for (const auto &I : getTypesSections()) { TUs.push_back(DWARFUnitSection()); - TUs.back().parse(*this, I.second.Data, I.second.Relocs); + TUs.back().parse(*this, I.second); } } void DWARFContext::parseDWOCompileUnits() { - DWOCUs.parseDWO(*this, getInfoDWOSection().Data, getInfoDWOSection().Relocs); + DWOCUs.parseDWO(*this, getInfoDWOSection()); } void DWARFContext::parseDWOTypeUnits() { @@ -335,7 +335,7 @@ void DWARFContext::parseDWOTypeUnits() { return; for (const auto &I : getTypesDWOSections()) { DWOTUs.push_back(DWARFUnitSection()); - DWOTUs.back().parseDWO(*this, I.second.Data, I.second.Relocs); + DWOTUs.back().parseDWO(*this, I.second); } } diff --git a/lib/DebugInfo/DWARFUnit.cpp b/lib/DebugInfo/DWARFUnit.cpp index 46a765c7046..092eb32d2a1 100644 --- a/lib/DebugInfo/DWARFUnit.cpp +++ b/lib/DebugInfo/DWARFUnit.cpp @@ -17,19 +17,17 @@ using namespace llvm; using namespace dwarf; - -void DWARFUnitSectionBase::parse(DWARFContext &C, StringRef SectionData, - const RelocAddrMap &Map) { - parseImpl(C, C.getDebugAbbrev(), SectionData, C.getRangeSection(), - C.getStringSection(), StringRef(), C.getAddrSection(), Map, +void DWARFUnitSectionBase::parse(DWARFContext &C, const DWARFSection &Section) { + parseImpl(C, Section, C.getDebugAbbrev(), C.getRangeSection(), + C.getStringSection(), StringRef(), C.getAddrSection(), C.isLittleEndian()); } -void DWARFUnitSectionBase::parseDWO(DWARFContext &C, StringRef SectionData, - const RelocAddrMap &Map) { - parseImpl(C, C.getDebugAbbrevDWO(), SectionData, C.getRangeDWOSection(), +void DWARFUnitSectionBase::parseDWO(DWARFContext &C, + const DWARFSection &DWOSection) { + parseImpl(C, DWOSection, C.getDebugAbbrevDWO(), C.getRangeDWOSection(), C.getStringDWOSection(), C.getStringOffsetDWOSection(), - C.getAddrSection(), Map, C.isLittleEndian()); + C.getAddrSection(), C.isLittleEndian()); } DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFDebugAbbrev *DA, diff --git a/lib/DebugInfo/DWARFUnit.h b/lib/DebugInfo/DWARFUnit.h index a4dd276b101..91245c46ff7 100644 --- a/lib/DebugInfo/DWARFUnit.h +++ b/lib/DebugInfo/DWARFUnit.h @@ -14,6 +14,7 @@ #include "DWARFDebugInfoEntry.h" #include "DWARFDebugRangeList.h" #include "DWARFRelocMap.h" +#include "DWARFSection.h" #include namespace llvm { @@ -24,9 +25,9 @@ class ObjectFile; class DWARFContext; class DWARFDebugAbbrev; +class DWARFUnit; class StringRef; class raw_ostream; -class DWARFUnit; /// Base class for all DWARFUnitSection classes. This provides the /// functionality common to all unit types. @@ -36,14 +37,13 @@ public: /// same section this Unit originated from. virtual DWARFUnit *getUnitForOffset(uint32_t Offset) const = 0; - void parse(DWARFContext &C, StringRef SectionData, const RelocAddrMap &Map); - void parseDWO(DWARFContext &C, StringRef SectionData, const RelocAddrMap &Map); + void parse(DWARFContext &C, const DWARFSection &Section); + void parseDWO(DWARFContext &C, const DWARFSection &DWOSection); protected: - virtual void parseImpl(DWARFContext &Context, const DWARFDebugAbbrev *DA, - StringRef Section, StringRef RS, StringRef SS, - StringRef SOS, StringRef AOS, const RelocAddrMap &M, - bool isLittleEndian) = 0; + virtual void parseImpl(DWARFContext &Context, const DWARFSection &Section, + const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS, + StringRef SOS, StringRef AOS, bool isLittleEndian) = 0; ~DWARFUnitSectionBase() {} }; @@ -79,18 +79,18 @@ public: return nullptr; } - private: - void parseImpl(DWARFContext &Context, const DWARFDebugAbbrev *DA, - StringRef Section, StringRef RS, StringRef SS, StringRef SOS, - StringRef AOS, const RelocAddrMap &M, bool LE) override { +private: + void parseImpl(DWARFContext &Context, const DWARFSection &Section, + const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS, + StringRef SOS, StringRef AOS, bool LE) override { if (Parsed) return; - DataExtractor Data(Section, LE, 0); + DataExtractor Data(Section.Data, LE, 0); uint32_t Offset = 0; while (Data.isValidOffset(Offset)) { auto U = - llvm::make_unique(Context, DA, Section, RS, SS, SOS, AOS, - &M, Data.isLittleEndian(), *this); + llvm::make_unique(Context, DA, Section.Data, RS, SS, SOS, + AOS, &Section.Relocs, LE, *this); if (!U->extract(Data, &Offset)) break; this->push_back(std::move(U)); -- 2.40.0