[lld] r265372 - ELF: Make SymbolBody::compare a non-template function.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 17:47:58 PDT 2016


Author: pcc
Date: Mon Apr  4 19:47:58 2016
New Revision: 265372

URL: http://llvm.org/viewvc/llvm-project?rev=265372&view=rev
Log:
ELF: Make SymbolBody::compare a non-template function.

Differential Revision: http://reviews.llvm.org/D18781

Modified:
    lld/trunk/ELF/SymbolTable.cpp
    lld/trunk/ELF/Symbols.cpp
    lld/trunk/ELF/Symbols.h

Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=265372&r1=265371&r2=265372&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Mon Apr  4 19:47:58 2016
@@ -240,7 +240,7 @@ template <class ELFT> void SymbolTable<E
 
   // compare() returns -1, 0, or 1 if the lhs symbol is less preferable,
   // equivalent (conflicting), or more preferable, respectively.
-  int Comp = Existing->compare<ELFT>(New);
+  int Comp = Existing->compare(New);
   if (Comp == 0) {
     std::string S = "duplicate symbol: " + conflictMsg(Existing, New);
     if (Config->AllowMultipleDefinition)

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=265372&r1=265371&r2=265372&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Mon Apr  4 19:47:58 2016
@@ -184,7 +184,7 @@ static int compareCommons(DefinedCommon
 
 // Returns 1, 0 or -1 if this symbol should take precedence
 // over the Other, tie or lose, respectively.
-template <class ELFT> int SymbolBody::compare(SymbolBody *Other) {
+int SymbolBody::compare(SymbolBody *Other) {
   assert(!isLazy() && !Other->isLazy());
   std::tuple<bool, bool, bool> L(isDefined(), !isShared(), !isWeak());
   std::tuple<bool, bool, bool> R(Other->isDefined(), !Other->isShared(),
@@ -192,7 +192,7 @@ template <class ELFT> int SymbolBody::co
 
   // Normalize
   if (L > R)
-    return -Other->compare<ELFT>(this);
+    return -Other->compare(this);
 
   uint8_t V = getMinVisibility(getVisibility(), Other->getVisibility());
   setVisibility(V);
@@ -347,11 +347,6 @@ template uint32_t SymbolBody::template g
 template uint64_t SymbolBody::template getThunkVA<ELF64LE>() const;
 template uint64_t SymbolBody::template getThunkVA<ELF64BE>() const;
 
-template int SymbolBody::compare<ELF32LE>(SymbolBody *Other);
-template int SymbolBody::compare<ELF32BE>(SymbolBody *Other);
-template int SymbolBody::compare<ELF64LE>(SymbolBody *Other);
-template int SymbolBody::compare<ELF64BE>(SymbolBody *Other);
-
 template class elf::UndefinedElf<ELF32LE>;
 template class elf::UndefinedElf<ELF32BE>;
 template class elf::UndefinedElf<ELF64LE>;

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=265372&r1=265371&r2=265372&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Mon Apr  4 19:47:58 2016
@@ -121,7 +121,7 @@ public:
   // Decides which symbol should "win" in the symbol table, this or
   // the Other. Returns 1 if this wins, -1 if the Other wins, or 0 if
   // they are duplicate (conflicting) symbols.
-  template <class ELFT> int compare(SymbolBody *Other);
+  int compare(SymbolBody *Other);
 
 protected:
   SymbolBody(Kind K, StringRef Name, uint8_t Binding, uint8_t StOther,




More information about the llvm-commits mailing list