[llvm] r319617 - [llvm-readobj] Remove redundant local variables to reduce the code. NFC
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 2 05:06:40 PST 2017
Author: atanasyan
Date: Sat Dec 2 05:06:40 2017
New Revision: 319617
URL: http://llvm.org/viewvc/llvm-project?rev=319617&view=rev
Log:
[llvm-readobj] Remove redundant local variables to reduce the code. NFC
Modified:
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=319617&r1=319616&r2=319617&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Sat Dec 2 05:06:40 2017
@@ -2028,10 +2028,7 @@ template <class ELFT> void MipsGOTParser
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 <class ELFT> void MipsGOTParser
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());
}
}
More information about the llvm-commits
mailing list