[lld] r249791 - Remove getters/setters that don't provide much abstraction.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 17:42:07 PDT 2015


Author: ruiu
Date: Thu Oct  8 19:42:06 2015
New Revision: 249791

URL: http://llvm.org/viewvc/llvm-project?rev=249791&view=rev
Log:
Remove getters/setters that don't provide much abstraction.

Modified:
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/Symbols.h

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=249791&r1=249790&r2=249791&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Thu Oct  8 19:42:06 2015
@@ -83,14 +83,14 @@ GotSection<ELFT>::GotSection()
 }
 
 template <class ELFT> void GotSection<ELFT>::addEntry(SymbolBody *Sym) {
-  Sym->setGotIndex(Entries.size());
+  Sym->GotIndex = Entries.size();
   Entries.push_back(Sym);
 }
 
 template <class ELFT>
 typename GotSection<ELFT>::uintX_t
 GotSection<ELFT>::getEntryAddr(const SymbolBody &B) const {
-  return this->getVA() + B.getGotIndex() * this->getAddrSize();
+  return this->getVA() + B.GotIndex * this->getAddrSize();
 }
 
 template <class ELFT> void GotSection<ELFT>::writeTo(uint8_t *Buf) {
@@ -124,14 +124,14 @@ template <class ELFT> void PltSection<EL
 }
 
 template <class ELFT> void PltSection<ELFT>::addEntry(SymbolBody *Sym) {
-  Sym->setPltIndex(Entries.size());
+  Sym->PltIndex = Entries.size();
   Entries.push_back(Sym);
 }
 
 template <class ELFT>
 typename PltSection<ELFT>::uintX_t
 PltSection<ELFT>::getEntryAddr(const SymbolBody &B) const {
-  return this->getVA() + B.getPltIndex() * Target->getPltEntrySize();
+  return this->getVA() + B.PltIndex * Target->getPltEntrySize();
 }
 
 template <class ELFT>

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=249791&r1=249790&r2=249791&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Thu Oct  8 19:42:06 2015
@@ -76,13 +76,10 @@ public:
   }
   void setDynamicSymbolTableIndex(unsigned V) { DynamicSymbolTableIndex = V; }
 
-  unsigned getGotIndex() const { return GotIndex; }
+  uint32_t GotIndex = -1;
+  uint32_t PltIndex = -1;
   bool isInGot() const { return GotIndex != -1U; }
-  void setGotIndex(unsigned I) { GotIndex = I; }
-
-  unsigned getPltIndex() const { return PltIndex; }
   bool isInPlt() const { return PltIndex != -1U; }
-  void setPltIndex(unsigned I) { PltIndex = I; }
 
   // A SymbolBody has a backreference to a Symbol. Originally they are
   // doubly-linked. A backreference will never change. But the pointer
@@ -112,8 +109,6 @@ protected:
   unsigned IsUsedInRegularObj : 1;
   unsigned IsUsedInDynamicReloc : 1;
   unsigned DynamicSymbolTableIndex = 0;
-  unsigned GotIndex = -1;
-  unsigned PltIndex = -1;
   StringRef Name;
   Symbol *Backref = nullptr;
 };




More information about the llvm-commits mailing list