[lld] r250458 - Remove a getter/setter that don't hide anything.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 15 13:55:22 PDT 2015


Author: ruiu
Date: Thu Oct 15 15:55:22 2015
New Revision: 250458

URL: http://llvm.org/viewvc/llvm-project?rev=250458&view=rev
Log:
Remove a getter/setter that don't hide anything.

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

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=250458&r1=250457&r2=250458&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Thu Oct 15 15:55:22 2015
@@ -154,7 +154,7 @@ template <class ELFT> void RelocationSec
 }
 
 template <class ELFT> void RelocationSection<ELFT>::finalize() {
-  this->Header.sh_link = Out<ELFT>::DynSymTab->getSectionIndex();
+  this->Header.sh_link = Out<ELFT>::DynSymTab->SectionIndex;
   this->Header.sh_size = Relocs.size() * this->Header.sh_entsize;
 }
 
@@ -202,7 +202,7 @@ template <class ELFT> void HashTableSect
 }
 
 template <class ELFT> void HashTableSection<ELFT>::finalize() {
-  this->Header.sh_link = Out<ELFT>::DynSymTab->getSectionIndex();
+  this->Header.sh_link = Out<ELFT>::DynSymTab->SectionIndex;
 
   assert(Out<ELFT>::DynSymTab->getNumSymbols() == Hashes.size() + 1);
   unsigned NumEntries = 2;                 // nbucket and nchain.
@@ -247,7 +247,7 @@ template <class ELFT> void DynamicSectio
     return; // Already finalized.
 
   typename Base::HeaderT &Header = this->Header;
-  Header.sh_link = Out<ELFT>::DynStrTab->getSectionIndex();
+  Header.sh_link = Out<ELFT>::DynStrTab->SectionIndex;
 
   unsigned NumEntries = 0;
   if (Out<ELFT>::RelaDyn->hasRelocs()) {
@@ -574,7 +574,7 @@ SymbolTableSection<ELFT>::SymbolTableSec
 
 template <class ELFT> void SymbolTableSection<ELFT>::finalize() {
   this->Header.sh_size = getNumSymbols() * sizeof(Elf_Sym);
-  this->Header.sh_link = StrTabSec.getSectionIndex();
+  this->Header.sh_link = StrTabSec.SectionIndex;
   this->Header.sh_info = NumLocals + 1;
 }
 
@@ -625,7 +625,7 @@ void SymbolTableSection<ELFT>::writeLoca
               &Sym, File->getSymbolTable(), File->getSymbolTableShndx());
         ArrayRef<InputSection<ELFT> *> Sections = File->getSections();
         const InputSection<ELFT> *Sec = Sections[SecIndex];
-        ESym->st_shndx = Sec->OutSec->getSectionIndex();
+        ESym->st_shndx = Sec->OutSec->SectionIndex;
         VA += Sec->OutSec->getVA() + Sec->OutSecOff;
       }
       ESym->st_value = VA;
@@ -697,7 +697,7 @@ void SymbolTableSection<ELFT>::writeGlob
     if (isa<DefinedAbsolute<ELFT>>(Body))
       ESym->st_shndx = SHN_ABS;
     else if (OutSec)
-      ESym->st_shndx = OutSec->getSectionIndex();
+      ESym->st_shndx = OutSec->SectionIndex;
   }
   if (!StrTabSec.isDynamic())
     std::stable_sort(

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=250458&r1=250457&r2=250458&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Thu Oct 15 15:55:22 2015
@@ -70,8 +70,7 @@ public:
   StringRef getName() { return Name; }
   void setNameOffset(uintX_t Offset) { Header.sh_name = Offset; }
 
-  unsigned getSectionIndex() const { return SectionIndex; }
-  void setSectionIndex(unsigned I) { SectionIndex = I; }
+  unsigned SectionIndex;
 
   // Returns the size of the section in the output file.
   uintX_t getSize() const { return Header.sh_size; }
@@ -91,7 +90,6 @@ public:
 protected:
   StringRef Name;
   HeaderT Header;
-  unsigned SectionIndex;
   ~OutputSectionBase() = default;
 };
 

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=250458&r1=250457&r2=250458&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Oct 15 15:55:22 2015
@@ -492,7 +492,7 @@ template <class ELFT> void Writer<ELFT>:
   OutputSections.push_back(Out<ELFT>::StrTab);
 
   for (unsigned I = 0, N = OutputSections.size(); I < N; ++I)
-    OutputSections[I]->setSectionIndex(I + 1);
+    OutputSections[I]->SectionIndex = I + 1;
 
   // Fill the DynStrTab early.
   Out<ELFT>::Dynamic->finalize();
@@ -692,7 +692,7 @@ template <class ELFT> void Writer<ELFT>:
   EHdr->e_phnum = Phdrs.size();
   EHdr->e_shentsize = sizeof(Elf_Shdr);
   EHdr->e_shnum = getNumSections();
-  EHdr->e_shstrndx = Out<ELFT>::StrTab->getSectionIndex();
+  EHdr->e_shstrndx = Out<ELFT>::StrTab->SectionIndex;
   memcpy(Buf + EHdr->e_phoff, &Phdrs[0], Phdrs.size() * sizeof(Phdrs[0]));
 
   auto SHdrs = reinterpret_cast<Elf_Shdr *>(Buf + EHdr->e_shoff);




More information about the llvm-commits mailing list