Use range loop. NFC.

llvm-svn: 283447
This commit is contained in:
Rafael Espindola 2016-10-06 13:11:12 +00:00
parent 459a1c9f2b
commit 28c63d3ed8
2 changed files with 15 additions and 14 deletions

View File

@ -2082,19 +2082,19 @@ template <class ELFT> void MipsGOTParser<ELFT>::parsePLT() {
switch (PLTRelShdr->sh_type) {
case ELF::SHT_REL:
for (const Elf_Rel *RI = Obj->rel_begin(PLTRelShdr),
*RE = Obj->rel_end(PLTRelShdr);
RI != RE && It != PLTEnd; ++RI, ++It) {
const Elf_Sym *Sym = Obj->getRelocationSymbol(&*RI, SymTable);
for (const Elf_Rel &Rel : Obj->rels(PLTRelShdr)) {
const Elf_Sym *Sym = Obj->getRelocationSymbol(&Rel, SymTable);
printPLTEntry(PLTShdr->sh_addr, PLTBegin, It, StrTable, Sym);
if (++It == PLTEnd)
break;
}
break;
case ELF::SHT_RELA:
for (const Elf_Rela *RI = Obj->rela_begin(PLTRelShdr),
*RE = Obj->rela_end(PLTRelShdr);
RI != RE && It != PLTEnd; ++RI, ++It) {
const Elf_Sym *Sym = Obj->getRelocationSymbol(&*RI, SymTable);
for (const Elf_Rela &Rel : Obj->relas(PLTRelShdr)) {
const Elf_Sym *Sym = Obj->getRelocationSymbol(&Rel, SymTable);
printPLTEntry(PLTShdr->sh_addr, PLTBegin, It, StrTable, Sym);
if (++It == PLTEnd)
break;
}
break;
}

View File

@ -24,6 +24,8 @@ class ELFDumper {
typedef object::Elf_Sym_Impl<ELFT> Elf_Sym;
typedef typename object::ELFFile<ELFT>::Elf_Shdr Elf_Shdr;
typedef typename object::ELFFile<ELFT>::Elf_Word Elf_Word;
typedef typename object::ELFFile<ELFT>::Elf_Rel Elf_Rel;
typedef typename object::ELFFile<ELFT>::Elf_Rela Elf_Rela;
const object::ELFFile<ELFT> &Obj;
ArrayRef<Elf_Word> ShndxTable;
@ -284,9 +286,9 @@ ELFDumper<ELFT>::dumpRelSection(const Elf_Shdr *Shdr) {
return EC;
const Elf_Shdr *SymTab = *SymTabOrErr;
for (auto RI = Obj.rel_begin(Shdr), RE = Obj.rel_end(Shdr); RI != RE; ++RI) {
for (const Elf_Rel &Rel : Obj.rels(Shdr)) {
ELFYAML::Relocation R;
if (std::error_code EC = dumpRelocation(&*RI, SymTab, R))
if (std::error_code EC = dumpRelocation(&Rel, SymTab, R))
return EC;
S->Relocations.push_back(R);
}
@ -308,12 +310,11 @@ ELFDumper<ELFT>::dumpRelaSection(const Elf_Shdr *Shdr) {
return EC;
const Elf_Shdr *SymTab = *SymTabOrErr;
for (auto RI = Obj.rela_begin(Shdr), RE = Obj.rela_end(Shdr); RI != RE;
++RI) {
for (const Elf_Rela &Rel : Obj.relas(Shdr)) {
ELFYAML::Relocation R;
if (std::error_code EC = dumpRelocation(&*RI, SymTab, R))
if (std::error_code EC = dumpRelocation(&Rel, SymTab, R))
return EC;
R.Addend = RI->r_addend;
R.Addend = Rel.r_addend;
S->Relocations.push_back(R);
}