[llvm-readobj] Remove redundant local variables to reduce the code. NFC

llvm-svn: 319617
This commit is contained in:
Simon Atanasyan 2017-12-02 13:06:40 +00:00
parent d4b693bfb8
commit c8c5a6b277
1 changed files with 5 additions and 9 deletions

View File

@ -2028,10 +2028,7 @@ template <class ELFT> void MipsGOTParser<ELFT>::parseGOT() {
return; return;
} }
StringRef StrTable = Dumper->getDynamicStringTable(); std::size_t DynSymTotal = Dumper->dynamic_symbols().size();
const Elf_Sym *DynSymBegin = Dumper->dynamic_symbols().begin();
const Elf_Sym *DynSymEnd = Dumper->dynamic_symbols().end();
std::size_t DynSymTotal = std::size_t(std::distance(DynSymBegin, DynSymEnd));
if (*DtGotSym > DynSymTotal) if (*DtGotSym > DynSymTotal)
report_fatal_error("MIPS_GOTSYM exceeds a number of dynamic symbols"); report_fatal_error("MIPS_GOTSYM exceeds a number of dynamic symbols");
@ -2060,13 +2057,12 @@ template <class ELFT> void MipsGOTParser<ELFT>::parseGOT() {
ListScope GS(W, "Global entries"); ListScope GS(W, "Global entries");
const GOTEntry *GotBegin = makeGOTIter(GOT, 0); const GOTEntry *GotBegin = makeGOTIter(GOT, 0);
const GOTEntry *GotGlobalEnd = const GOTEntry *GotEnd = makeGOTIter(GOT, *DtLocalGotNum + GlobalGotNum);
makeGOTIter(GOT, *DtLocalGotNum + GlobalGotNum); const Elf_Sym *GotDynSym = Dumper->dynamic_symbols().begin() + *DtGotSym;
const Elf_Sym *GotDynSym = DynSymBegin + *DtGotSym; for (auto It = makeGOTIter(GOT, *DtLocalGotNum); It != GotEnd; ++It) {
for (auto It = makeGOTIter(GOT, *DtLocalGotNum); It != GotGlobalEnd; ++It) {
DictScope D(W, "Entry"); DictScope D(W, "Entry");
printGlobalGotEntry(GOTShdr->sh_addr, GotBegin, It, GotDynSym++, printGlobalGotEntry(GOTShdr->sh_addr, GotBegin, It, GotDynSym++,
StrTable); Dumper->getDynamicStringTable());
} }
} }