diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/DebugInfo/DWARFContext.cpp | 14 | ||||
-rw-r--r-- | lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 13 | ||||
-rw-r--r-- | lib/MC/MCObjectSymbolizer.cpp | 12 |
3 files changed, 16 insertions, 23 deletions
diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp index 8a245a0301..0afe6ef6e1 100644 --- a/lib/DebugInfo/DWARFContext.cpp +++ b/lib/DebugInfo/DWARFContext.cpp @@ -699,26 +699,24 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) if (Section.relocation_begin() != Section.relocation_end()) { uint64_t SectionSize; RelocatedSection->getSize(SectionSize); - for (object::relocation_iterator reloc_i = Section.relocation_begin(), - reloc_e = Section.relocation_end(); - reloc_i != reloc_e; ++reloc_i) { + for (const RelocationRef &Reloc : Section.relocations()) { uint64_t Address; - reloc_i->getOffset(Address); + Reloc.getOffset(Address); uint64_t Type; - reloc_i->getType(Type); + Reloc.getType(Type); uint64_t SymAddr = 0; // ELF relocations may need the symbol address if (Obj->isELF()) { - object::symbol_iterator Sym = reloc_i->getSymbol(); + object::symbol_iterator Sym = Reloc.getSymbol(); Sym->getAddress(SymAddr); } object::RelocVisitor V(Obj->getFileFormatName()); // The section address is always 0 for debug sections. - object::RelocToApply R(V.visit(Type, *reloc_i, 0, SymAddr)); + object::RelocToApply R(V.visit(Type, Reloc, 0, SymAddr)); if (V.error()) { SmallString<32> Name; - error_code ec(reloc_i->getTypeName(Name)); + error_code ec(Reloc.getTypeName(Name)); if (ec) { errs() << "Aaaaaa! Nameless relocation! Aaaaaa!\n"; } diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 723a790b87..5d6a2c0f12 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -166,9 +166,7 @@ ObjectImage* RuntimeDyldImpl::loadObject(ObjectImage *InputObject) { StubMap Stubs; section_iterator RelocatedSection = SI->getRelocatedSection(); - for (relocation_iterator I = SI->relocation_begin(), - E = SI->relocation_end(); - I != E; ++I) { + for (const RelocationRef &Reloc : SI->relocations()) { // If it's the first relocation in this section, find its SectionID if (IsFirstRelocation) { bool IsCode = false; @@ -179,7 +177,7 @@ ObjectImage* RuntimeDyldImpl::loadObject(ObjectImage *InputObject) { IsFirstRelocation = false; } - processRelocationRef(SectionID, *I, *Obj, LocalSections, LocalSymbols, + processRelocationRef(SectionID, Reloc, *Obj, LocalSections, LocalSymbols, Stubs); } } @@ -306,13 +304,12 @@ unsigned RuntimeDyldImpl::computeSectionStubBufSize(ObjectImage &Obj, if (!(RelSecI == Section)) continue; - for (relocation_iterator I = SI->relocation_begin(), - E = SI->relocation_end(); - I != E; ++I) { + for (const RelocationRef &Reloc : SI->relocations()) { + (void)Reloc; StubBufSize += StubSize; } } - + // Get section data size and alignment uint64_t Alignment64; uint64_t DataSize; diff --git a/lib/MC/MCObjectSymbolizer.cpp b/lib/MC/MCObjectSymbolizer.cpp index 4548a7d425..ee2d9553ec 100644 --- a/lib/MC/MCObjectSymbolizer.cpp +++ b/lib/MC/MCObjectSymbolizer.cpp @@ -263,9 +263,7 @@ void MCObjectSymbolizer::buildRelocationByAddrMap() { RelSecI->isRequiredForExecution(RequiredForExec); if (RequiredForExec == false || Size == 0) continue; - for (relocation_iterator RI = Section.relocation_begin(), - RE = Section.relocation_end(); - RI != RE; ++RI) { + for (const RelocationRef &Reloc : Section.relocations()) { // FIXME: libObject is inconsistent regarding error handling. The // overwhelming majority of methods always return object_error::success, // and assert for simple errors.. Here, ELFObjectFile::getRelocationOffset @@ -277,18 +275,18 @@ void MCObjectSymbolizer::buildRelocationByAddrMap() { if (ELFObj == 0) break; if (ELFObj->getELFFile()->getHeader()->e_type == ELF::ET_REL) { - RI->getOffset(Offset); + Reloc.getOffset(Offset); Offset += StartAddr; } else { - RI->getAddress(Offset); + Reloc.getAddress(Offset); } } else { - RI->getOffset(Offset); + Reloc.getOffset(Offset); Offset += StartAddr; } // At a specific address, only keep the first relocation. if (AddrToReloc.find(Offset) == AddrToReloc.end()) - AddrToReloc[Offset] = *RI; + AddrToReloc[Offset] = Reloc; } } } |