From c8c5a6b277a341e1ea855407d4046c9c32bb2b7b Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Sat, 2 Dec 2017 13:06:40 +0000 Subject: [PATCH] [llvm-readobj] Remove redundant local variables to reduce the code. NFC llvm-svn: 319617 --- llvm/tools/llvm-readobj/ELFDumper.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp index 8bc088afe430..9678667abffe 100644 --- a/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -2028,10 +2028,7 @@ template void MipsGOTParser::parseGOT() { return; } - StringRef StrTable = Dumper->getDynamicStringTable(); - 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)); + std::size_t DynSymTotal = Dumper->dynamic_symbols().size(); if (*DtGotSym > DynSymTotal) report_fatal_error("MIPS_GOTSYM exceeds a number of dynamic symbols"); @@ -2060,13 +2057,12 @@ template void MipsGOTParser::parseGOT() { ListScope GS(W, "Global entries"); const GOTEntry *GotBegin = makeGOTIter(GOT, 0); - const GOTEntry *GotGlobalEnd = - makeGOTIter(GOT, *DtLocalGotNum + GlobalGotNum); - const Elf_Sym *GotDynSym = DynSymBegin + *DtGotSym; - for (auto It = makeGOTIter(GOT, *DtLocalGotNum); It != GotGlobalEnd; ++It) { + const GOTEntry *GotEnd = makeGOTIter(GOT, *DtLocalGotNum + GlobalGotNum); + const Elf_Sym *GotDynSym = Dumper->dynamic_symbols().begin() + *DtGotSym; + for (auto It = makeGOTIter(GOT, *DtLocalGotNum); It != GotEnd; ++It) { DictScope D(W, "Entry"); printGlobalGotEntry(GOTShdr->sh_addr, GotBegin, It, GotDynSym++, - StrTable); + Dumper->getDynamicStringTable()); } }