From 235d82cd0a6d5a63bed4d40d05a9be82e1f9c618 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 2 Nov 2016 14:42:20 +0000 Subject: [PATCH] Don't use getNumSections. It is just the size of sections() which we were already calling. llvm-svn: 285811 --- lld/ELF/InputFiles.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 5850b30ca0d9..f8e80062c608 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -286,12 +286,13 @@ bool elf::ObjectFile::shouldMerge(const Elf_Shdr &Sec) { template void elf::ObjectFile::initializeSections( DenseSet &ComdatGroups) { - uint64_t Size = this->ELFObj.getNumSections(); + const ELFFile &Obj = this->ELFObj; + ArrayRef ObjSections = check(Obj.sections()); + uint64_t Size = ObjSections.size(); Sections.resize(Size); unsigned I = -1; - const ELFFile &Obj = this->ELFObj; StringRef SectionStringTable = check(Obj.getSectionStringTable()); - for (const Elf_Shdr &Sec : check(Obj.sections())) { + for (const Elf_Shdr &Sec : ObjSections) { ++I; if (Sections[I] == &InputSection::Discarded) continue;