diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-11-02 14:42:20 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-11-02 14:42:20 +0000 |
| commit | 235d82cd0a6d5a63bed4d40d05a9be82e1f9c618 (patch) | |
| tree | 6ea7dd169fe82e6014218c8387534e192a6c3229 /lld/ELF/InputFiles.cpp | |
| parent | 6b42a5b0fdc02806ce19e4f8611981bd5b471cba (diff) | |
| download | bcm5719-llvm-235d82cd0a6d5a63bed4d40d05a9be82e1f9c618.tar.gz bcm5719-llvm-235d82cd0a6d5a63bed4d40d05a9be82e1f9c618.zip | |
Don't use getNumSections.
It is just the size of sections() which we were already calling.
llvm-svn: 285811
Diffstat (limited to 'lld/ELF/InputFiles.cpp')
| -rw-r--r-- | lld/ELF/InputFiles.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 5850b30ca0d..f8e80062c60 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -286,12 +286,13 @@ bool elf::ObjectFile<ELFT>::shouldMerge(const Elf_Shdr &Sec) { template <class ELFT> void elf::ObjectFile<ELFT>::initializeSections( DenseSet<CachedHashStringRef> &ComdatGroups) { - uint64_t Size = this->ELFObj.getNumSections(); + const ELFFile<ELFT> &Obj = this->ELFObj; + ArrayRef<Elf_Shdr> ObjSections = check(Obj.sections()); + uint64_t Size = ObjSections.size(); Sections.resize(Size); unsigned I = -1; - const ELFFile<ELFT> &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<ELFT>::Discarded) continue; |

