[lld] r297287 - Remove unnecessary template. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 07:44:31 PST 2017


Author: rafael
Date: Wed Mar  8 09:44:30 2017
New Revision: 297287

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

Modified:
    lld/trunk/ELF/ICF.cpp
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/InputSection.h
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/ELF/MapFile.cpp
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/ELF/Target.cpp

Modified: lld/trunk/ELF/ICF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ICF.cpp?rev=297287&r1=297286&r2=297287&view=diff
==============================================================================
--- lld/trunk/ELF/ICF.cpp (original)
+++ lld/trunk/ELF/ICF.cpp Wed Mar  8 09:44:30 2017
@@ -154,7 +154,7 @@ private:
 // Returns a hash value for S. Note that the information about
 // relocation targets is not included in the hash value.
 template <class ELFT> static uint32_t getHash(InputSection *S) {
-  return hash_combine(S->Flags, S->template getSize<ELFT>(), S->NumRelocations);
+  return hash_combine(S->Flags, S->getSize(), S->NumRelocations);
 }
 
 // Returns true if section S is subject of ICF.
@@ -222,8 +222,7 @@ bool ICF<ELFT>::constantEq(ArrayRef<RelT
 template <class ELFT>
 bool ICF<ELFT>::equalsConstant(const InputSection *A, const InputSection *B) {
   if (A->NumRelocations != B->NumRelocations || A->Flags != B->Flags ||
-      A->template getSize<ELFT>() != B->template getSize<ELFT>() ||
-      A->Data != B->Data)
+      A->getSize() != B->getSize() || A->Data != B->Data)
     return false;
 
   if (A->AreRelocsRela)

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=297287&r1=297286&r2=297287&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Mar  8 09:44:30 2017
@@ -86,7 +86,7 @@ InputSectionBase::InputSectionBase(elf::
                        SectionKind) {
 }
 
-template <class ELFT> size_t InputSectionBase::getSize() const {
+size_t InputSectionBase::getSize() const {
   if (auto *S = dyn_cast<SyntheticSection>(this))
     return S->getSize();
 
@@ -108,7 +108,7 @@ uint64_t InputSectionBase::getOffset(uin
     // For synthetic sections we treat offset -1 as the end of the section.
     // The same approach is used for synthetic symbols (DefinedSynthetic).
     return cast<InputSection>(this)->OutSecOff +
-           (Offset == uint64_t(-1) ? getSize<ELFT>() : Offset);
+           (Offset == uint64_t(-1) ? getSize() : Offset);
   case EHFrame:
     // The file crtbeginT.o has relocations pointing to the start of an empty
     // .eh_frame that is known to be the first in the link. It does that to
@@ -836,11 +836,6 @@ template uint64_t InputSectionBase::getO
 template uint64_t InputSectionBase::getOffset<ELF64LE>(uint64_t Offset) const;
 template uint64_t InputSectionBase::getOffset<ELF64BE>(uint64_t Offset) const;
 
-template size_t InputSectionBase::getSize<ELF32LE>() const;
-template size_t InputSectionBase::getSize<ELF32BE>() const;
-template size_t InputSectionBase::getSize<ELF64LE>() const;
-template size_t InputSectionBase::getSize<ELF64BE>() 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=297287&r1=297286&r2=297287&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Wed Mar  8 09:44:30 2017
@@ -111,7 +111,7 @@ public:
   llvm::TinyPtrVector<InputSectionBase *> DependentSections;
 
   // Returns the size of this section (even if this is a common or BSS.)
-  template <class ELFT> size_t getSize() const;
+  size_t getSize() const;
 
   template <class ELFT> OutputSection *getOutputSection() const;
 

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=297287&r1=297286&r2=297287&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Mar  8 09:44:30 2017
@@ -407,7 +407,7 @@ template <class ELFT> void LinkerScript<
   uintX_t Pos = IsTbss ? Dot + ThreadBssOffset : Dot;
   Pos = alignTo(Pos, S->Alignment);
   S->OutSecOff = Pos - CurOutSec->Addr;
-  Pos += S->template getSize<ELFT>();
+  Pos += S->getSize();
 
   // Update output section size after adding each section. This is so that
   // SIZEOF works correctly in the case below:

Modified: lld/trunk/ELF/MapFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MapFile.cpp?rev=297287&r1=297286&r2=297287&view=diff
==============================================================================
--- lld/trunk/ELF/MapFile.cpp (original)
+++ lld/trunk/ELF/MapFile.cpp Wed Mar  8 09:44:30 2017
@@ -66,8 +66,8 @@ static void writeInputSection(raw_fd_ost
   int Width = ELFT::Is64Bits ? 16 : 8;
   StringRef Name = IS->Name;
   if (Name != PrevName) {
-    writeInSecLine(OS, Width, IS->OutSec->Addr + IS->OutSecOff,
-                   IS->template getSize<ELFT>(), IS->Alignment, Name);
+    writeInSecLine(OS, Width, IS->OutSec->Addr + IS->OutSecOff, IS->getSize(),
+                   IS->Alignment, Name);
     OS << '\n';
     PrevName = Name;
   }
@@ -75,8 +75,8 @@ static void writeInputSection(raw_fd_ost
   elf::ObjectFile<ELFT> *File = IS->template getFile<ELFT>();
   if (!File)
     return;
-  writeFileLine(OS, Width, IS->OutSec->Addr + IS->OutSecOff,
-                IS->template getSize<ELFT>(), IS->Alignment, toString(File));
+  writeFileLine(OS, Width, IS->OutSec->Addr + IS->OutSecOff, IS->getSize(),
+                IS->Alignment, toString(File));
   OS << '\n';
 
   for (SymbolBody *Sym : File->getSymbols()) {

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=297287&r1=297286&r2=297287&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Wed Mar  8 09:44:30 2017
@@ -134,7 +134,7 @@ template <class ELFT> void OutputSection
   for (InputSection *S : Sections) {
     Off = alignTo(Off, S->Alignment);
     S->OutSecOff = Off;
-    Off += S->template getSize<ELFT>();
+    Off += S->getSize();
   }
   this->Size = Off;
 }

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=297287&r1=297286&r2=297287&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Wed Mar  8 09:44:30 2017
@@ -928,7 +928,7 @@ bool createThunks(ArrayRef<OutputSection
     if (TS == nullptr) {
       uint32_t Off = 0;
       for (auto *IS : OS->Sections) {
-        Off = IS->OutSecOff + IS->template getSize<ELFT>();
+        Off = IS->OutSecOff + IS->getSize();
         if ((IS->Flags & SHF_EXECINSTR) == 0)
           break;
       }

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=297287&r1=297286&r2=297287&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Wed Mar  8 09:44:30 2017
@@ -1733,8 +1733,7 @@ static InputSectionBase *findSection(Arr
                                      uint64_t Offset) {
   for (InputSectionBase *S : Arr)
     if (S && S != &InputSection::Discarded)
-      if (Offset >= S->getOffset() &&
-          Offset < S->getOffset() + S->getSize<ELFT>())
+      if (Offset >= S->getOffset() && Offset < S->getOffset() + S->getSize())
         return S;
   return nullptr;
 }
@@ -2237,8 +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->template getSize<ELFT>());
+  uint64_t S = LC->OutSec->Addr + LC->template getOffset<ELFT>(LC->getSize());
   uint64_t P = this->getVA();
   Target->relocateOne(Buf, R_ARM_PREL31, S - P);
   write32le(Buf + 4, 0x1);

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=297287&r1=297286&r2=297287&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Mar  8 09:44:30 2017
@@ -66,7 +66,7 @@ template <class ELFT> static std::string
       continue;
 
     uint8_t *ISLoc = cast<OutputSection>(IS->OutSec)->Loc + IS->OutSecOff;
-    if (ISLoc <= Loc && Loc < ISLoc + IS->template getSize<ELFT>())
+    if (ISLoc <= Loc && Loc < ISLoc + IS->getSize())
       return IS->template getLocation<ELFT>(Loc - ISLoc) + ": ";
   }
   return "";




More information about the llvm-commits mailing list