From 6f07b35b8f7cd4e7ad85d25a968db1daa86535ff Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Fri, 14 Mar 2014 14:22:49 +0000 Subject: [C++11] Introduce SectionRef::relocations() to use range-based loops Reviewers: rafael Reviewed By: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3077 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203927 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/DWARFContext.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'lib/DebugInfo/DWARFContext.cpp') 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"; } -- cgit v1.2.3