[lld] r303959 - Simplify. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu May 25 19:17:31 PDT 2017
Author: ruiu
Date: Thu May 25 21:17:30 2017
New Revision: 303959
URL: http://llvm.org/viewvc/llvm-project?rev=303959&view=rev
Log:
Simplify. NFC.
Modified:
lld/trunk/ELF/InputFiles.cpp
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=303959&r1=303958&r2=303959&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Thu May 25 21:17:30 2017
@@ -281,18 +281,20 @@ bool elf::ObjectFile<ELFT>::shouldMerge(
template <class ELFT>
void elf::ObjectFile<ELFT>::initializeSections(
DenseSet<CachedHashStringRef> &ComdatGroups) {
+ const ELFFile<ELFT> &Obj = this->getObj();
+
ArrayRef<Elf_Shdr> ObjSections =
check(this->getObj().sections(), toString(this));
- const ELFFile<ELFT> &Obj = this->getObj();
uint64_t Size = ObjSections.size();
this->Sections.resize(Size);
- unsigned I = -1;
+
StringRef SectionStringTable =
check(Obj.getSectionStringTable(ObjSections), toString(this));
- for (const Elf_Shdr &Sec : ObjSections) {
- ++I;
+
+ for (size_t I = 0, E = ObjSections.size(); I < E; I++) {
if (this->Sections[I] == &InputSection::Discarded)
continue;
+ const Elf_Shdr &Sec = ObjSections[I];
// SHF_EXCLUDE'ed sections are discarded by the linker. However,
// if -r is given, we'll let the final link discard such sections.
More information about the llvm-commits
mailing list