From 76b6bd355d274f6eb74417a40ea87e8734d8baa4 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 8 Mar 2017 15:44:30 +0000 Subject: [PATCH] Remove unnecessary template. NFC. llvm-svn: 297287 --- lld/ELF/ICF.cpp | 5 ++--- lld/ELF/InputSection.cpp | 9 ++------- lld/ELF/InputSection.h | 2 +- lld/ELF/LinkerScript.cpp | 2 +- lld/ELF/MapFile.cpp | 8 ++++---- lld/ELF/OutputSections.cpp | 2 +- lld/ELF/Relocations.cpp | 2 +- lld/ELF/SyntheticSections.cpp | 6 ++---- lld/ELF/Target.cpp | 2 +- 9 files changed, 15 insertions(+), 23 deletions(-) diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp index 38cc63f25641..84d4bf0caa8e 100644 --- a/lld/ELF/ICF.cpp +++ b/lld/ELF/ICF.cpp @@ -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 static uint32_t getHash(InputSection *S) { - return hash_combine(S->Flags, S->template getSize(), 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::constantEq(ArrayRef RelsA, ArrayRef RelsB) { template bool ICF::equalsConstant(const InputSection *A, const InputSection *B) { if (A->NumRelocations != B->NumRelocations || A->Flags != B->Flags || - A->template getSize() != B->template getSize() || - A->Data != B->Data) + A->getSize() != B->getSize() || A->Data != B->Data) return false; if (A->AreRelocsRela) diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index c9d70ac6215d..218fcdbccafa 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -86,7 +86,7 @@ InputSectionBase::InputSectionBase(elf::ObjectFile *File, SectionKind) { } -template size_t InputSectionBase::getSize() const { +size_t InputSectionBase::getSize() const { if (auto *S = dyn_cast(this)) return S->getSize(); @@ -108,7 +108,7 @@ uint64_t InputSectionBase::getOffset(uint64_t Offset) const { // For synthetic sections we treat offset -1 as the end of the section. // The same approach is used for synthetic symbols (DefinedSynthetic). return cast(this)->OutSecOff + - (Offset == uint64_t(-1) ? getSize() : 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::getOffset(uint64_t Offset) const; template uint64_t InputSectionBase::getOffset(uint64_t Offset) const; template uint64_t InputSectionBase::getOffset(uint64_t Offset) const; -template size_t InputSectionBase::getSize() const; -template size_t InputSectionBase::getSize() const; -template size_t InputSectionBase::getSize() const; -template size_t InputSectionBase::getSize() const; - template elf::ObjectFile *InputSectionBase::getFile() const; template elf::ObjectFile *InputSectionBase::getFile() const; template elf::ObjectFile *InputSectionBase::getFile() const; diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index 78bd576c2905..f7081beb7f67 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -111,7 +111,7 @@ public: llvm::TinyPtrVector DependentSections; // Returns the size of this section (even if this is a common or BSS.) - template size_t getSize() const; + size_t getSize() const; template OutputSection *getOutputSection() const; diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 6f93859f744a..45727ee96cbc 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -407,7 +407,7 @@ template void LinkerScript::output(InputSection *S) { uintX_t Pos = IsTbss ? Dot + ThreadBssOffset : Dot; Pos = alignTo(Pos, S->Alignment); S->OutSecOff = Pos - CurOutSec->Addr; - Pos += S->template getSize(); + Pos += S->getSize(); // Update output section size after adding each section. This is so that // SIZEOF works correctly in the case below: diff --git a/lld/ELF/MapFile.cpp b/lld/ELF/MapFile.cpp index 97b913705cae..e1194b5bf411 100644 --- a/lld/ELF/MapFile.cpp +++ b/lld/ELF/MapFile.cpp @@ -66,8 +66,8 @@ static void writeInputSection(raw_fd_ostream &OS, const InputSection *IS, int Width = ELFT::Is64Bits ? 16 : 8; StringRef Name = IS->Name; if (Name != PrevName) { - writeInSecLine(OS, Width, IS->OutSec->Addr + IS->OutSecOff, - IS->template getSize(), 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_ostream &OS, const InputSection *IS, elf::ObjectFile *File = IS->template getFile(); if (!File) return; - writeFileLine(OS, Width, IS->OutSec->Addr + IS->OutSecOff, - IS->template getSize(), 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()) { diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index b697e1a3484b..c7b0182d834d 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -134,7 +134,7 @@ template void OutputSection::assignOffsets() { for (InputSection *S : Sections) { Off = alignTo(Off, S->Alignment); S->OutSecOff = Off; - Off += S->template getSize(); + Off += S->getSize(); } this->Size = Off; } diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index c8039e667de4..82724bb55a46 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -928,7 +928,7 @@ bool createThunks(ArrayRef OutputSections) { if (TS == nullptr) { uint32_t Off = 0; for (auto *IS : OS->Sections) { - Off = IS->OutSecOff + IS->template getSize(); + Off = IS->OutSecOff + IS->getSize(); if ((IS->Flags & SHF_EXECINSTR) == 0) break; } diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 6a93079b85b9..637f2ea499f4 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -1733,8 +1733,7 @@ static InputSectionBase *findSection(ArrayRef Arr, uint64_t Offset) { for (InputSectionBase *S : Arr) if (S && S != &InputSection::Discarded) - if (Offset >= S->getOffset() && - Offset < S->getOffset() + S->getSize()) + if (Offset >= S->getOffset() && Offset < S->getOffset() + S->getSize()) return S; return nullptr; } @@ -2237,8 +2236,7 @@ void ARMExidxSentinelSection::writeTo(uint8_t *Buf) { auto RI = cast(this->OutSec)->Sections.rbegin(); InputSection *LE = *(++RI); InputSection *LC = cast(LE->template getLinkOrderDep()); - uint64_t S = LC->OutSec->Addr + - LC->template getOffset(LC->template getSize()); + uint64_t S = LC->OutSec->Addr + LC->template getOffset(LC->getSize()); uint64_t P = this->getVA(); Target->relocateOne(Buf, R_ARM_PREL31, S - P); write32le(Buf + 4, 0x1); diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 85cac56967e9..e5269fc080f8 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -66,7 +66,7 @@ template static std::string getErrorLoc(uint8_t *Loc) { continue; uint8_t *ISLoc = cast(IS->OutSec)->Loc + IS->OutSecOff; - if (ISLoc <= Loc && Loc < ISLoc + IS->template getSize()) + if (ISLoc <= Loc && Loc < ISLoc + IS->getSize()) return IS->template getLocation(Loc - ISLoc) + ": "; } return "";