[lld] r297292 - Remove unnecessary template. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 08:03:41 PST 2017


Author: rafael
Date: Wed Mar  8 10:03:41 2017
New Revision: 297292

URL: http://llvm.org/viewvc/llvm-project?rev=297292&view=rev
Log:
Remove unnecessary template. NFC.

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

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=297292&r1=297291&r2=297292&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Mar  8 10:03:41 2017
@@ -99,7 +99,6 @@ uint64_t InputSectionBase::getOffsetInFi
   return SecStart - FileStart;
 }
 
-template <class ELFT>
 uint64_t InputSectionBase::getOffset(uint64_t Offset) const {
   switch (kind()) {
   case Regular:
@@ -153,9 +152,8 @@ template <class ELFT> void InputSectionB
   Data = ArrayRef<uint8_t>((uint8_t *)OutputBuf, Size);
 }
 
-template <class ELFT>
 uint64_t InputSectionBase::getOffset(const DefinedRegular &Sym) const {
-  return getOffset<ELFT>(Sym.Value);
+  return getOffset(Sym.Value);
 }
 
 template <class ELFT>
@@ -238,7 +236,7 @@ void InputSection::copyRelocations(uint8
     // Output section VA is zero for -r, so r_offset is an offset within the
     // section, but for --emit-relocs it is an virtual address.
     P->r_offset = RelocatedSection->OutSec->Addr +
-                  RelocatedSection->getOffset<ELFT>(Rel.r_offset);
+                  RelocatedSection->getOffset(Rel.r_offset);
     P->setSymbolAndType(In<ELFT>::SymTab->getSymbolIndex(&Body), Type,
                         Config->isMips64EL());
 
@@ -456,7 +454,7 @@ void InputSection::relocateNonAlloc(uint
   typedef typename ELFT::uint uintX_t;
   for (const RelTy &Rel : Rels) {
     uint32_t Type = Rel.getType(Config->isMips64EL());
-    uintX_t Offset = this->getOffset<ELFT>(Rel.r_offset);
+    uint64_t Offset = getOffset(Rel.r_offset);
     uint8_t *BufLoc = Buf + Offset;
     int64_t Addend = getAddend<ELFT>(Rel);
     if (!RelTy::IsRela)
@@ -501,7 +499,7 @@ void InputSectionBase::relocate(uint8_t
   typedef typename ELFT::uint uintX_t;
   const unsigned Bits = sizeof(uintX_t) * 8;
   for (const Relocation &Rel : Relocations) {
-    uintX_t Offset = getOffset<ELFT>(Rel.Offset);
+    uint64_t Offset = getOffset(Rel.Offset);
     uint8_t *BufLoc = Buf + Offset;
     uint32_t Type = Rel.Type;
 
@@ -822,20 +820,6 @@ template InputSectionBase *InputSection:
 template InputSectionBase *InputSection::getRelocatedSection<ELF64LE>();
 template InputSectionBase *InputSection::getRelocatedSection<ELF64BE>();
 
-template uint64_t
-InputSectionBase::getOffset<ELF32LE>(const DefinedRegular &Sym) const;
-template uint64_t
-InputSectionBase::getOffset<ELF32BE>(const DefinedRegular &Sym) const;
-template uint64_t
-InputSectionBase::getOffset<ELF64LE>(const DefinedRegular &Sym) const;
-template uint64_t
-InputSectionBase::getOffset<ELF64BE>(const DefinedRegular &Sym) const;
-
-template uint64_t InputSectionBase::getOffset<ELF32LE>(uint64_t Offset) const;
-template uint64_t InputSectionBase::getOffset<ELF32BE>(uint64_t Offset) const;
-template uint64_t InputSectionBase::getOffset<ELF64LE>(uint64_t Offset) const;
-template uint64_t InputSectionBase::getOffset<ELF64BE>(uint64_t Offset) const;
-
 template elf::ObjectFile<ELF32LE> *InputSectionBase::getFile<ELF32LE>() const;
 template elf::ObjectFile<ELF32BE> *InputSectionBase::getFile<ELF32BE>() const;
 template elf::ObjectFile<ELF64LE> *InputSectionBase::getFile<ELF64LE>() const;

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=297292&r1=297291&r2=297292&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Wed Mar  8 10:03:41 2017
@@ -121,12 +121,12 @@ public:
     return getFile<ELFT>()->getObj();
   }
 
-  template <class ELFT> uint64_t getOffset(const DefinedRegular &Sym) const;
+  uint64_t getOffset(const DefinedRegular &Sym) const;
 
   template <class ELFT> InputSectionBase *getLinkOrderDep() const;
   // Translate an offset in the input section to an offset in the output
   // section.
-  template <class ELFT> uint64_t getOffset(uint64_t Offset) const;
+  uint64_t getOffset(uint64_t Offset) const;
 
   template <class ELFT> void uncompress();
 

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=297292&r1=297291&r2=297292&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Wed Mar  8 10:03:41 2017
@@ -97,7 +97,7 @@ static typename ELFT::uint getSymVA(cons
     // If you understand the data structures involved with this next
     // line (and how they get built), then you have a pretty good
     // understanding of the linker.
-    uint64_t VA = (OutSec ? OutSec->Addr : 0) + IS->getOffset<ELFT>(Offset);
+    uint64_t VA = (OutSec ? OutSec->Addr : 0) + IS->getOffset(Offset);
 
     if (D.isTls() && !Config->Relocatable) {
       if (!Out::TlsPhdr)

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=297292&r1=297291&r2=297292&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Wed Mar  8 10:03:41 2017
@@ -1202,7 +1202,7 @@ template <class ELFT> void DynamicSectio
 
 template <class ELFT>
 typename ELFT::uint DynamicReloc<ELFT>::getOffset() const {
-  return InputSec->OutSec->Addr + InputSec->getOffset<ELFT>(OffsetInSec);
+  return InputSec->OutSec->Addr + InputSec->getOffset(OffsetInSec);
 }
 
 template <class ELFT> int64_t DynamicReloc<ELFT>::getAddend() const {
@@ -1878,8 +1878,7 @@ template <class ELFT> void GdbIndexSecti
 
   // Write the address area.
   for (AddressEntry &E : AddressArea) {
-    uintX_t BaseAddr =
-        E.Section->OutSec->Addr + E.Section->template getOffset<ELFT>(0);
+    uintX_t BaseAddr = E.Section->OutSec->Addr + E.Section->getOffset(0);
     write64le(Buf, BaseAddr + E.LowAddress);
     write64le(Buf + 8, BaseAddr + E.HighAddress);
     write32le(Buf + 16, E.CuIndex);
@@ -2237,7 +2236,7 @@ void ARMExidxSentinelSection<ELFT>::writ
   auto RI = cast<OutputSection>(this->OutSec)->Sections.rbegin();
   InputSection *LE = *(++RI);
   InputSection *LC = cast<InputSection>(LE->template getLinkOrderDep<ELFT>());
-  uint64_t S = LC->OutSec->Addr + LC->template getOffset<ELFT>(LC->getSize());
+  uint64_t S = LC->OutSec->Addr + LC->getOffset(LC->getSize());
   uint64_t P = this->getVA();
   Target->relocateOne(Buf, R_ARM_PREL31, S - P);
   write32le(Buf + 4, 0x1);




More information about the llvm-commits mailing list