[lld] r315667 - Hide SymbolBody::IsLocal.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 20:37:26 PDT 2017


Author: ruiu
Date: Thu Oct 12 20:37:26 2017
New Revision: 315667

URL: http://llvm.org/viewvc/llvm-project?rev=315667&view=rev
Log:
Hide SymbolBody::IsLocal.

IsLocal member is initialized by the constructor and will never change.
So we don't want to make it directly accessible.

Modified:
    lld/trunk/ELF/Symbols.cpp
    lld/trunk/ELF/Symbols.h
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=315667&r1=315666&r2=315667&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Thu Oct 12 20:37:26 2017
@@ -121,7 +121,7 @@ static uint64_t getSymVA(const SymbolBod
 
 SymbolBody::SymbolBody(Kind K, StringRefZ Name, bool IsLocal, uint8_t StOther,
                        uint8_t Type)
-    : SymbolKind(K), NeedsPltAddr(false), IsLocal(IsLocal),
+    : SymbolKind(K), IsLocal(IsLocal), NeedsPltAddr(false),
       IsInGlobalMipsGot(false), Is32BitMipsGot(false), IsInIplt(false),
       IsInIgot(false), IsPreemptible(false), Type(Type), StOther(StOther),
       Name(Name) {}

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=315667&r1=315666&r2=315667&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Thu Oct 12 20:37:26 2017
@@ -108,14 +108,13 @@ protected:
 
   const unsigned SymbolKind : 8;
 
+  // True if this is a local symbol.
+  unsigned IsLocal : 1;
+
 public:
   // True the symbol should point to its PLT entry.
   // For SharedSymbol only.
   unsigned NeedsPltAddr : 1;
-
-  // True if this is a local symbol.
-  unsigned IsLocal : 1;
-
   // True if this symbol has an entry in the global part of MIPS GOT.
   unsigned IsInGlobalMipsGot : 1;
 

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=315667&r1=315666&r2=315667&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Thu Oct 12 20:37:26 2017
@@ -75,7 +75,7 @@ template <class ELFT> void elf::createCo
     // Replace all DefinedCommon symbols with DefinedRegular symbols so that we
     // don't have to care about DefinedCommon symbols beyond this point.
     replaceBody<DefinedRegular>(S, Sym->getFile(), Sym->getName(),
-                                static_cast<bool>(Sym->IsLocal), Sym->StOther,
+                                static_cast<bool>(Sym->isLocal()), Sym->StOther,
                                 Sym->Type, 0, Sym->getSize<ELFT>(), Section);
   }
 }

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=315667&r1=315666&r2=315667&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Oct 12 20:37:26 2017
@@ -444,7 +444,7 @@ template <class ELFT> void Writer<ELFT>:
   for (InputFile *File : ObjectFiles) {
     ObjFile<ELFT> *F = cast<ObjFile<ELFT>>(File);
     for (SymbolBody *B : F->getLocalSymbols()) {
-      if (!B->IsLocal)
+      if (!B->isLocal())
         fatal(toString(F) +
               ": broken object: getLocalSymbols returns a non-local symbol");
       auto *DR = dyn_cast<DefinedRegular>(B);




More information about the llvm-commits mailing list