llvm.org GIT mirror llvm / a29287d
[DebugInfo] Pass DWARFSection into DWARFUnitSection constructor (NFC). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219259 91177308-0d34-0410-b5e6-96231b3b80d8 Alexey Samsonov 5 years ago
3 changed file(s) with 25 addition(s) and 27 deletion(s). Raw diff Collapse all Expand all
313313 }
314314
315315 void DWARFContext::parseCompileUnits() {
316 CUs.parse(*this, getInfoSection().Data, getInfoSection().Relocs);
316 CUs.parse(*this, getInfoSection());
317317 }
318318
319319 void DWARFContext::parseTypeUnits() {
321321 return;
322322 for (const auto &I : getTypesSections()) {
323323 TUs.push_back(DWARFUnitSection());
324 TUs.back().parse(*this, I.second.Data, I.second.Relocs);
324 TUs.back().parse(*this, I.second);
325325 }
326326 }
327327
328328 void DWARFContext::parseDWOCompileUnits() {
329 DWOCUs.parseDWO(*this, getInfoDWOSection().Data, getInfoDWOSection().Relocs);
329 DWOCUs.parseDWO(*this, getInfoDWOSection());
330330 }
331331
332332 void DWARFContext::parseDWOTypeUnits() {
334334 return;
335335 for (const auto &I : getTypesDWOSections()) {
336336 DWOTUs.push_back(DWARFUnitSection());
337 DWOTUs.back().parseDWO(*this, I.second.Data, I.second.Relocs);
337 DWOTUs.back().parseDWO(*this, I.second);
338338 }
339339 }
340340
1616 using namespace llvm;
1717 using namespace dwarf;
1818
19
20 void DWARFUnitSectionBase::parse(DWARFContext &C, StringRef SectionData,
21 const RelocAddrMap &Map) {
22 parseImpl(C, C.getDebugAbbrev(), SectionData, C.getRangeSection(),
23 C.getStringSection(), StringRef(), C.getAddrSection(), Map,
19 void DWARFUnitSectionBase::parse(DWARFContext &C, const DWARFSection &Section) {
20 parseImpl(C, Section, C.getDebugAbbrev(), C.getRangeSection(),
21 C.getStringSection(), StringRef(), C.getAddrSection(),
2422 C.isLittleEndian());
2523 }
2624
27 void DWARFUnitSectionBase::parseDWO(DWARFContext &C, StringRef SectionData,
28 const RelocAddrMap &Map) {
29 parseImpl(C, C.getDebugAbbrevDWO(), SectionData, C.getRangeDWOSection(),
25 void DWARFUnitSectionBase::parseDWO(DWARFContext &C,
26 const DWARFSection &DWOSection) {
27 parseImpl(C, DWOSection, C.getDebugAbbrevDWO(), C.getRangeDWOSection(),
3028 C.getStringDWOSection(), C.getStringOffsetDWOSection(),
31 C.getAddrSection(), Map, C.isLittleEndian());
29 C.getAddrSection(), C.isLittleEndian());
3230 }
3331
3432 DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFDebugAbbrev *DA,
1313 #include "DWARFDebugInfoEntry.h"
1414 #include "DWARFDebugRangeList.h"
1515 #include "DWARFRelocMap.h"
16 #include "DWARFSection.h"
1617 #include
1718
1819 namespace llvm {
2324
2425 class DWARFContext;
2526 class DWARFDebugAbbrev;
27 class DWARFUnit;
2628 class StringRef;
2729 class raw_ostream;
28 class DWARFUnit;
2930
3031 /// Base class for all DWARFUnitSection classes. This provides the
3132 /// functionality common to all unit types.
3536 /// same section this Unit originated from.
3637 virtual DWARFUnit *getUnitForOffset(uint32_t Offset) const = 0;
3738
38 void parse(DWARFContext &C, StringRef SectionData, const RelocAddrMap &Map);
39 void parseDWO(DWARFContext &C, StringRef SectionData, const RelocAddrMap &Map);
39 void parse(DWARFContext &C, const DWARFSection &Section);
40 void parseDWO(DWARFContext &C, const DWARFSection &DWOSection);
4041
4142 protected:
42 virtual void parseImpl(DWARFContext &Context, const DWARFDebugAbbrev *DA,
43 StringRef Section, StringRef RS, StringRef SS,
44 StringRef SOS, StringRef AOS, const RelocAddrMap &M,
45 bool isLittleEndian) = 0;
43 virtual void parseImpl(DWARFContext &Context, const DWARFSection &Section,
44 const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
45 StringRef SOS, StringRef AOS, bool isLittleEndian) = 0;
4646
4747 ~DWARFUnitSectionBase() {}
4848 };
7878 return nullptr;
7979 }
8080
81 private:
82 void parseImpl(DWARFContext &Context, const DWARFDebugAbbrev *DA,
83 StringRef Section, StringRef RS, StringRef SS, StringRef SOS,
84 StringRef AOS, const RelocAddrMap &M, bool LE) override {
81 private:
82 void parseImpl(DWARFContext &Context, const DWARFSection &Section,
83 const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
84 StringRef SOS, StringRef AOS, bool LE) override {
8585 if (Parsed)
8686 return;
87 DataExtractor Data(Section, LE, 0);
87 DataExtractor Data(Section.Data, LE, 0);
8888 uint32_t Offset = 0;
8989 while (Data.isValidOffset(Offset)) {
9090 auto U =
91 llvm::make_unique(Context, DA, Section, RS, SS, SOS, AOS,
92 &M, Data.isLittleEndian(), *this);
91 llvm::make_unique(Context, DA, Section.Data, RS, SS, SOS,
92 AOS, &Section.Relocs, LE, *this);
9393 if (!U->extract(Data, &Offset))
9494 break;
9595 this->push_back(std::move(U));