[lld] r280237 - Delete unnecessary template.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 31 06:28:33 PDT 2016
Author: rafael
Date: Wed Aug 31 08:28:33 2016
New Revision: 280237
URL: http://llvm.org/viewvc/llvm-project?rev=280237&view=rev
Log:
Delete unnecessary template.
Modified:
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/InputSection.h
lld/trunk/ELF/LinkerScript.h
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/Symbols.cpp
lld/trunk/ELF/Symbols.h
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=280237&r1=280236&r2=280237&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Aug 31 08:28:33 2016
@@ -698,8 +698,7 @@ bool MipsAbiFlagsInputSection<ELFT>::cla
}
template <class ELFT>
-CommonInputSection<ELFT>::CommonInputSection(
- std::vector<DefinedCommon<ELFT> *> Syms)
+CommonInputSection<ELFT>::CommonInputSection(std::vector<DefinedCommon *> Syms)
: InputSection<ELFT>(nullptr, &Hdr) {
Hdr.sh_size = 0;
Hdr.sh_type = SHT_NOBITS;
@@ -707,12 +706,12 @@ CommonInputSection<ELFT>::CommonInputSec
this->Live = true;
// Sort the common symbols by alignment as an heuristic to pack them better.
- std::stable_sort(Syms.begin(), Syms.end(), [](const DefinedCommon<ELFT> *A,
- const DefinedCommon<ELFT> *B) {
- return A->Alignment > B->Alignment;
- });
+ std::stable_sort(Syms.begin(), Syms.end(),
+ [](const DefinedCommon *A, const DefinedCommon *B) {
+ return A->Alignment > B->Alignment;
+ });
- for (DefinedCommon<ELFT> *Sym : Syms) {
+ for (DefinedCommon *Sym : Syms) {
this->Alignment = std::max<uintX_t>(this->Alignment, Sym->Alignment);
Hdr.sh_size = alignTo(Hdr.sh_size, Sym->Alignment);
Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=280237&r1=280236&r2=280237&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Wed Aug 31 08:28:33 2016
@@ -21,11 +21,11 @@
namespace lld {
namespace elf {
+class DefinedCommon;
class SymbolBody;
template <class ELFT> class ICF;
template <class ELFT> class DefinedRegular;
-template <class ELFT> class DefinedCommon;
template <class ELFT> class ObjectFile;
template <class ELFT> class OutputSection;
template <class ELFT> class OutputSectionBase;
@@ -287,7 +287,7 @@ template <class ELFT> class CommonInputS
typedef typename ELFT::uint uintX_t;
public:
- CommonInputSection(std::vector<DefinedCommon<ELFT> *> Syms);
+ CommonInputSection(std::vector<DefinedCommon *> Syms);
// The singleton instance of this class.
static CommonInputSection<ELFT> *X;
Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=280237&r1=280236&r2=280237&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Wed Aug 31 08:28:33 2016
@@ -20,12 +20,12 @@
namespace lld {
namespace elf {
+class DefinedCommon;
class ScriptParser;
class SymbolBody;
template <class ELFT> class InputSectionBase;
template <class ELFT> class OutputSectionBase;
template <class ELFT> class OutputSectionFactory;
-template <class ELFT> class DefinedCommon;
template <class ELFT> class LayoutInputSection;
typedef std::function<uint64_t(uint64_t)> Expr;
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=280237&r1=280236&r2=280237&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Wed Aug 31 08:28:33 2016
@@ -326,7 +326,6 @@ static int compareDefined(Symbol *S, boo
// We have a new non-common defined symbol with the specified binding. Return 1
// if the new symbol should win, -1 if the new symbol should lose, or 0 if there
// is a conflict. If the new symbol wins, also update the binding.
-template <class ELFT>
static int compareDefinedNonCommon(Symbol *S, bool WasInserted,
uint8_t Binding) {
if (int Cmp = compareDefined(S, WasInserted, Binding)) {
@@ -334,7 +333,7 @@ static int compareDefinedNonCommon(Symbo
S->Binding = Binding;
return Cmp;
}
- if (isa<DefinedCommon<ELFT>>(S->body())) {
+ if (isa<DefinedCommon>(S->body())) {
// Non-common symbols take precedence over common symbols.
if (Config->WarnCommon)
warning("common " + S->body()->getName() + " is overridden");
@@ -356,10 +355,9 @@ Symbol *SymbolTable<ELFT>::addCommon(Str
int Cmp = compareDefined(S, WasInserted, Binding);
if (Cmp > 0) {
S->Binding = Binding;
- replaceBody<DefinedCommon<ELFT>>(S, N, Size, Alignment, StOther, Type,
- File);
+ replaceBody<DefinedCommon>(S, N, Size, Alignment, StOther, Type, File);
} else if (Cmp == 0) {
- auto *C = dyn_cast<DefinedCommon<ELFT>>(S->body());
+ auto *C = dyn_cast<DefinedCommon>(S->body());
if (!C) {
// Non-common symbols take precedence over common symbols.
if (Config->WarnCommon)
@@ -395,7 +393,7 @@ Symbol *SymbolTable<ELFT>::addRegular(St
Name, Sym.getType(), Sym.getVisibility(),
/*CanOmitFromDynSym*/ false, /*HasUnnamedAddr*/ false,
/*IsUsedInRegularObj*/ true, Section ? Section->getFile() : nullptr);
- int Cmp = compareDefinedNonCommon<ELFT>(S, WasInserted, Sym.getBinding());
+ int Cmp = compareDefinedNonCommon(S, WasInserted, Sym.getBinding());
if (Cmp > 0)
replaceBody<DefinedRegular<ELFT>>(S, Name, Sym, Section);
else if (Cmp == 0)
@@ -411,7 +409,7 @@ Symbol *SymbolTable<ELFT>::addRegular(St
std::tie(S, WasInserted) =
insert(Name, STT_NOTYPE, StOther & 3, /*CanOmitFromDynSym*/ false,
/*HasUnnamedAddr*/ false, /*IsUsedInRegularObj*/ true, nullptr);
- int Cmp = compareDefinedNonCommon<ELFT>(S, WasInserted, Binding);
+ int Cmp = compareDefinedNonCommon(S, WasInserted, Binding);
if (Cmp > 0)
replaceBody<DefinedRegular<ELFT>>(S, Name, StOther);
else if (Cmp == 0)
@@ -429,7 +427,7 @@ Symbol *SymbolTable<ELFT>::addSynthetic(
/*CanOmitFromDynSym*/ false,
/*HasUnnamedAddr*/ false,
/*IsUsedInRegularObj*/ true, nullptr);
- int Cmp = compareDefinedNonCommon<ELFT>(S, WasInserted, STB_GLOBAL);
+ int Cmp = compareDefinedNonCommon(S, WasInserted, STB_GLOBAL);
if (Cmp > 0)
replaceBody<DefinedSynthetic<ELFT>>(S, N, Value, Section);
else if (Cmp == 0)
@@ -469,7 +467,7 @@ Symbol *SymbolTable<ELFT>::addBitcode(St
std::tie(S, WasInserted) =
insert(Name, Type, StOther & 3, CanOmitFromDynSym, HasUnnamedAddr,
/*IsUsedInRegularObj*/ false, F);
- int Cmp = compareDefinedNonCommon<ELFT>(S, WasInserted, Binding);
+ int Cmp = compareDefinedNonCommon(S, WasInserted, Binding);
if (Cmp > 0)
replaceBody<DefinedRegular<ELFT>>(S, Name, StOther, Type, F);
else if (Cmp == 0)
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=280237&r1=280236&r2=280237&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Wed Aug 31 08:28:33 2016
@@ -66,7 +66,7 @@ static typename ELFT::uint getSymVA(cons
case SymbolBody::DefinedCommonKind:
return CommonInputSection<ELFT>::X->OutSec->getVA() +
CommonInputSection<ELFT>::X->OutSecOff +
- cast<DefinedCommon<ELFT>>(Body).Offset;
+ cast<DefinedCommon>(Body).Offset;
case SymbolBody::SharedKind: {
auto &SS = cast<SharedSymbol<ELFT>>(Body);
if (!SS.NeedsCopyOrPltAddr)
@@ -175,7 +175,7 @@ template <class ELFT> typename ELFT::uin
}
template <class ELFT> typename ELFT::uint SymbolBody::getSize() const {
- if (const auto *C = dyn_cast<DefinedCommon<ELFT>>(this))
+ if (const auto *C = dyn_cast<DefinedCommon>(this))
return C->Size;
if (const auto *DR = dyn_cast<DefinedRegular<ELFT>>(this))
return DR->Size;
@@ -208,10 +208,8 @@ DefinedSynthetic<ELFT>::DefinedSynthetic
: Defined(SymbolBody::DefinedSyntheticKind, N, STV_HIDDEN, 0 /* Type */),
Value(Value), Section(Section) {}
-template <class ELFT>
-DefinedCommon<ELFT>::DefinedCommon(StringRef N, uint64_t Size,
- uint64_t Alignment, uint8_t StOther,
- uint8_t Type, InputFile *File)
+DefinedCommon::DefinedCommon(StringRef N, uint64_t Size, uint64_t Alignment,
+ uint8_t StOther, uint8_t Type, InputFile *File)
: Defined(SymbolBody::DefinedCommonKind, N, StOther, Type),
Alignment(Alignment), Size(Size) {
this->File = File;
@@ -321,8 +319,3 @@ template class elf::DefinedSynthetic<ELF
template class elf::DefinedSynthetic<ELF32BE>;
template class elf::DefinedSynthetic<ELF64LE>;
template class elf::DefinedSynthetic<ELF64BE>;
-
-template class elf::DefinedCommon<ELF32LE>;
-template class elf::DefinedCommon<ELF32BE>;
-template class elf::DefinedCommon<ELF64LE>;
-template class elf::DefinedCommon<ELF64BE>;
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=280237&r1=280236&r2=280237&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Wed Aug 31 08:28:33 2016
@@ -158,7 +158,7 @@ public:
static bool classof(const SymbolBody *S) { return S->isDefined(); }
};
-template <class ELFT> class DefinedCommon : public Defined {
+class DefinedCommon : public Defined {
public:
DefinedCommon(StringRef N, uint64_t Size, uint64_t Alignment, uint8_t StOther,
uint8_t Type, InputFile *File);
@@ -436,11 +436,10 @@ struct Symbol {
// large and aligned enough to store any derived class of SymbolBody. We
// assume that the size and alignment of ELF64LE symbols is sufficient for any
// ELFT, and we verify this with the static_asserts in replaceBody.
- llvm::AlignedCharArrayUnion<DefinedCommon<llvm::object::ELF64LE>,
- DefinedRegular<llvm::object::ELF64LE>,
- DefinedSynthetic<llvm::object::ELF64LE>,
- Undefined, SharedSymbol<llvm::object::ELF64LE>,
- LazyArchive, LazyObject>
+ llvm::AlignedCharArrayUnion<
+ DefinedCommon, DefinedRegular<llvm::object::ELF64LE>,
+ DefinedSynthetic<llvm::object::ELF64LE>, Undefined,
+ SharedSymbol<llvm::object::ELF64LE>, LazyArchive, LazyObject>
Body;
SymbolBody *body() { return reinterpret_cast<SymbolBody *>(Body.buffer); }
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=280237&r1=280236&r2=280237&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Aug 31 08:28:33 2016
@@ -229,11 +229,10 @@ template <class ELFT> void elf::writeRes
Out<ELFT>::Pool.clear();
}
-template <class ELFT>
-static std::vector<DefinedCommon<ELFT> *> getCommonSymbols() {
- std::vector<DefinedCommon<ELFT> *> V;
+template <class ELFT> static std::vector<DefinedCommon *> getCommonSymbols() {
+ std::vector<DefinedCommon *> V;
for (Symbol *S : Symtab<ELFT>::X->getSymbols())
- if (auto *B = dyn_cast<DefinedCommon<ELFT>>(S->body()))
+ if (auto *B = dyn_cast<DefinedCommon>(S->body()))
V.push_back(B);
return V;
}
More information about the llvm-commits
mailing list