diff options
Diffstat (limited to 'lib/DebugInfo')
-rw-r--r-- | lib/DebugInfo/DWARFContext.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp index 94935e2568..8a245a0301 100644 --- a/lib/DebugInfo/DWARFContext.cpp +++ b/lib/DebugInfo/DWARFContext.cpp @@ -605,16 +605,14 @@ static bool consumeCompressedDebugSectionHeader(StringRef &data, return true; } -DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : - IsLittleEndian(Obj->isLittleEndian()), - AddressSize(Obj->getBytesInAddress()) { - for (object::section_iterator i = Obj->section_begin(), - e = Obj->section_end(); - i != e; ++i) { +DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) + : IsLittleEndian(Obj->isLittleEndian()), + AddressSize(Obj->getBytesInAddress()) { + for (const SectionRef &Section : Obj->sections()) { StringRef name; - i->getName(name); + Section.getName(name); StringRef data; - i->getContents(data); + Section.getContents(data); name = name.substr(name.find_first_not_of("._")); // Skip . and _ prefixes. @@ -634,7 +632,7 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : UncompressedSections.push_back(std::move(UncompressedSection)); } - StringRef *Section = + StringRef *SectionData = StringSwitch<StringRef *>(name) .Case("debug_info", &InfoSection.Data) .Case("debug_abbrev", &AbbrevSection) @@ -656,8 +654,8 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : .Case("debug_addr", &AddrSection) // Any more debug info sections go here. .Default(0); - if (Section) { - *Section = data; + if (SectionData) { + *SectionData = data; if (name == "debug_ranges") { // FIXME: Use the other dwo range section when we emit it. RangeDWOSection = data; @@ -665,12 +663,12 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : } else if (name == "debug_types") { // Find debug_types data by section rather than name as there are // multiple, comdat grouped, debug_types sections. - TypesSections[*i].Data = data; + TypesSections[Section].Data = data; } else if (name == "debug_types.dwo") { - TypesDWOSections[*i].Data = data; + TypesDWOSections[Section].Data = data; } - section_iterator RelocatedSection = i->getRelocatedSection(); + section_iterator RelocatedSection = Section.getRelocatedSection(); if (RelocatedSection == Obj->section_end()) continue; @@ -698,11 +696,11 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : continue; } - if (i->relocation_begin() != i->relocation_end()) { + if (Section.relocation_begin() != Section.relocation_end()) { uint64_t SectionSize; RelocatedSection->getSize(SectionSize); - for (object::relocation_iterator reloc_i = i->relocation_begin(), - reloc_e = i->relocation_end(); + for (object::relocation_iterator reloc_i = Section.relocation_begin(), + reloc_e = Section.relocation_end(); reloc_i != reloc_e; ++reloc_i) { uint64_t Address; reloc_i->getOffset(Address); |