[lld] r328740 - Rename NonLocal -> Global.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 28 15:55:40 PDT 2018


Author: ruiu
Date: Wed Mar 28 15:55:40 2018
New Revision: 328740

URL: http://llvm.org/viewvc/llvm-project?rev=328740&view=rev
Log:
Rename NonLocal -> Global.

NonLocal is technically more accurate, but we already use the term
"Global" to specify the non-local part of the symbol table, and
Local <-> Global is easier to digest.

Modified:
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/ELF/InputFiles.h

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=328740&r1=328739&r2=328740&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Wed Mar 28 15:55:40 2018
@@ -233,7 +233,7 @@ ELFFileBase<ELFT>::ELFFileBase(Kind K, M
 
 template <class ELFT>
 typename ELFT::SymRange ELFFileBase<ELFT>::getGlobalELFSyms() {
-  return makeArrayRef(ELFSyms.begin() + FirstNonLocal, ELFSyms.end());
+  return makeArrayRef(ELFSyms.begin() + FirstGlobal, ELFSyms.end());
 }
 
 template <class ELFT>
@@ -244,9 +244,9 @@ uint32_t ELFFileBase<ELFT>::getSectionIn
 template <class ELFT>
 void ELFFileBase<ELFT>::initSymtab(ArrayRef<Elf_Shdr> Sections,
                                    const Elf_Shdr *Symtab) {
-  FirstNonLocal = Symtab->sh_info;
+  FirstGlobal = Symtab->sh_info;
   ELFSyms = CHECK(getObj().symbols(Symtab), this);
-  if (FirstNonLocal == 0 || FirstNonLocal > ELFSyms.size())
+  if (FirstGlobal == 0 || FirstGlobal > ELFSyms.size())
     fatal(toString(this) + ": invalid sh_info in symbol table");
 
   StringTable =
@@ -262,11 +262,11 @@ ObjFile<ELFT>::ObjFile(MemoryBufferRef M
 template <class ELFT> ArrayRef<Symbol *> ObjFile<ELFT>::getLocalSymbols() {
   if (this->Symbols.empty())
     return {};
-  return makeArrayRef(this->Symbols).slice(1, this->FirstNonLocal - 1);
+  return makeArrayRef(this->Symbols).slice(1, this->FirstGlobal - 1);
 }
 
 template <class ELFT> ArrayRef<Symbol *> ObjFile<ELFT>::getGlobalSymbols() {
-  return makeArrayRef(this->Symbols).slice(this->FirstNonLocal);
+  return makeArrayRef(this->Symbols).slice(this->FirstGlobal);
 }
 
 template <class ELFT>
@@ -796,14 +796,14 @@ template <class ELFT> void SharedFile<EL
 // Parses ".gnu.version" section which is a parallel array for the symbol table.
 // If a given file doesn't have ".gnu.version" section, returns VER_NDX_GLOBAL.
 template <class ELFT> std::vector<uint32_t> SharedFile<ELFT>::parseVersyms() {
-  size_t Size = this->ELFSyms.size() - this->FirstNonLocal;
+  size_t Size = this->ELFSyms.size() - this->FirstGlobal;
   if (!VersymSec)
     return std::vector<uint32_t>(Size, VER_NDX_GLOBAL);
 
   const char *Base = this->MB.getBuffer().data();
   const Elf_Versym *Versym =
       reinterpret_cast<const Elf_Versym *>(Base + VersymSec->sh_offset) +
-      this->FirstNonLocal;
+      this->FirstGlobal;
 
   std::vector<uint32_t> Ret(Size);
   for (size_t I = 0; I < Size; ++I)
@@ -1178,11 +1178,11 @@ template <class ELFT> void LazyObjFile::
       continue;
 
     typename ELFT::SymRange Syms = CHECK(Obj.symbols(&Sec), this);
-    uint32_t FirstNonLocal = Sec.sh_info;
+    uint32_t FirstGlobal = Sec.sh_info;
     StringRef StringTable =
         CHECK(Obj.getStringTableForSymtab(Sec, Sections), this);
 
-    for (const typename ELFT::Sym &Sym : Syms.slice(FirstNonLocal))
+    for (const typename ELFT::Sym &Sym : Syms.slice(FirstGlobal))
       if (Sym.st_shndx != SHN_UNDEF)
         Symtab->addLazyObject<ELFT>(CHECK(Sym.getName(StringTable), this),
                                     *this);
@@ -1212,11 +1212,11 @@ template <class ELFT> void elf::readJust
       continue;
 
     Elf_Sym_Range Syms = CHECK(Obj.symbols(&Sec), ObjName);
-    uint32_t FirstNonLocal = Sec.sh_info;
+    uint32_t FirstGlobal = Sec.sh_info;
     StringRef StringTable =
         CHECK(Obj.getStringTableForSymtab(Sec, Sections), ObjName);
 
-    for (const Elf_Sym &Sym : Syms.slice(FirstNonLocal))
+    for (const Elf_Sym &Sym : Syms.slice(FirstGlobal))
       if (Sym.st_shndx != SHN_UNDEF)
         Symtab->addRegular(CHECK(Sym.getName(StringTable), ObjName),
                            Sym.st_other, Sym.getType(), Sym.st_value,

Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=328740&r1=328739&r2=328740&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Wed Mar 28 15:55:40 2018
@@ -142,7 +142,7 @@ public:
 
 protected:
   ArrayRef<Elf_Sym> ELFSyms;
-  uint32_t FirstNonLocal = 0;
+  uint32_t FirstGlobal = 0;
   ArrayRef<Elf_Word> SymtabSHNDX;
   StringRef StringTable;
   void initSymtab(ArrayRef<Elf_Shdr> Sections, const Elf_Shdr *Symtab);




More information about the llvm-commits mailing list