[lld] 60f5614 - [ELF] SharedFile::parse: cache symbols size for a loop. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 22:45:40 PST 2021


Author: Fangrui Song
Date: 2021-12-15T22:45:28-08:00
New Revision: 60f5614931b43871791393df74689d3b2b05c329

URL: https://github.com/llvm/llvm-project/commit/60f5614931b43871791393df74689d3b2b05c329
DIFF: https://github.com/llvm/llvm-project/commit/60f5614931b43871791393df74689d3b2b05c329.diff

LOG: [ELF] SharedFile::parse: cache symbols size for a loop. NFC

Added: 
    

Modified: 
    lld/ELF/InputFiles.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index ab4be24ff82b..fb1fca1c7f0f 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -1492,7 +1492,7 @@ template <class ELFT> void SharedFile::parse() {
 
   // Add symbols to the symbol table.
   ArrayRef<Elf_Sym> syms = this->getGlobalELFSyms<ELFT>();
-  for (size_t i = 0; i < syms.size(); ++i) {
+  for (size_t i = 0, e = syms.size(); i != e; ++i) {
     const Elf_Sym &sym = syms[i];
 
     // ELF spec requires that all local symbols precede weak or global


        


More information about the llvm-commits mailing list