[lld] a596a5f - [ELF] ObjFile<ELFT>::initializeSymbols: Simplify this->symbols[i]. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 13:02:42 PST 2021


Author: Fangrui Song
Date: 2021-12-15T13:02:38-08:00
New Revision: a596a5fc128b094373795885b3ab23031063f097

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

LOG: [ELF] ObjFile<ELFT>::initializeSymbols: Simplify this->symbols[i]. NFC

Added: 
    

Modified: 
    lld/ELF/InputFiles.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 81cac483fc92..5319db195a4b 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -1110,11 +1110,12 @@ template <class ELFT> void ObjFile<ELFT>::initializeSymbols() {
       continue;
     }
 
+    Symbol *sym = this->symbols[i];
     if (eSym.st_shndx == SHN_COMMON) {
       if (value == 0 || value >= UINT32_MAX)
         fatal(toString(this) + ": common symbol '" + StringRef(name.data) +
               "' has invalid alignment: " + Twine(value));
-      this->symbols[i]->resolve(
+      sym->resolve(
           CommonSymbol{this, name, binding, stOther, type, value, size});
       continue;
     }
@@ -1126,7 +1127,6 @@ template <class ELFT> void ObjFile<ELFT>::initializeSymbols() {
     // defined symbol in a .eh_frame becomes dangling symbols.
     if (sec == &InputSection::discarded) {
       Undefined und{this, name, binding, stOther, type, secIdx};
-      Symbol *sym = this->symbols[i];
       // !ArchiveFile::parsed or LazyObjFile::extracted means that the file
       // containing this object has not finished processing, i.e. this symbol is
       // a result of a lazy symbol extract. We should demote the lazy symbol to
@@ -1148,7 +1148,7 @@ template <class ELFT> void ObjFile<ELFT>::initializeSymbols() {
     // Handle global defined symbols.
     if (binding == STB_GLOBAL || binding == STB_WEAK ||
         binding == STB_GNU_UNIQUE) {
-      this->symbols[i]->resolve(
+      sym->resolve(
           Defined{this, name, binding, stOther, type, value, size, sec});
       continue;
     }


        


More information about the llvm-commits mailing list