[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
This commit is contained in:
Alexey Samsonov
2014-03-14 14:22:49 +00:00
parent 0eba2c94fd
commit 6f07b35b8f
9 changed files with 77 additions and 90 deletions

View File

@ -325,16 +325,14 @@ static void DisassembleInputMachO2(StringRef Filename,
bool symbolTableWorked = false;
// Parse relocations.
std::vector<std::pair<uint64_t, SymbolRef> > Relocs;
for (relocation_iterator RI = Sections[SectIdx].relocation_begin(),
RE = Sections[SectIdx].relocation_end();
RI != RE; ++RI) {
std::vector<std::pair<uint64_t, SymbolRef>> Relocs;
for (const RelocationRef &Reloc : Sections[SectIdx].relocations()) {
uint64_t RelocOffset, SectionAddress;
RI->getOffset(RelocOffset);
Reloc.getOffset(RelocOffset);
Sections[SectIdx].getAddress(SectionAddress);
RelocOffset -= SectionAddress;
symbol_iterator RelocSym = RI->getSymbol();
symbol_iterator RelocSym = Reloc.getSymbol();
Relocs.push_back(std::make_pair(RelocOffset, *RelocSym));
}