[lld] r267018 - Reduce templating. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 10:37:12 PDT 2016


Author: rafael
Date: Thu Apr 21 12:37:11 2016
New Revision: 267018

URL: http://llvm.org/viewvc/llvm-project?rev=267018&view=rev
Log:
Reduce templating. NFC.

Modified:
    lld/trunk/ELF/Target.cpp
    lld/trunk/ELF/Target.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=267018&r1=267017&r2=267018&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Thu Apr 21 12:37:11 2016
@@ -222,18 +222,16 @@ uint64_t TargetInfo::getVAStart() const
 
 bool TargetInfo::needsCopyRelImpl(uint32_t Type) const { return false; }
 
-template <typename ELFT> static bool mayNeedCopy(const SymbolBody &S) {
+static bool mayNeedCopy(const SymbolBody &S) {
   if (Config->Shared)
     return false;
-  auto *SS = dyn_cast<SharedSymbol<ELFT>>(&S);
-  if (!SS)
+  if (!S.isShared())
     return false;
-  return SS->isObject();
+  return S.isObject();
 }
 
-template <class ELFT>
 bool TargetInfo::needsCopyRel(uint32_t Type, const SymbolBody &S) const {
-  return mayNeedCopy<ELFT>(S) && needsCopyRelImpl(Type);
+  return mayNeedCopy(S) && needsCopyRelImpl(Type);
 }
 
 bool TargetInfo::isHintRel(uint32_t Type) const { return false; }
@@ -1699,14 +1697,5 @@ template uint32_t getMipsGpAddr<ELF32LE>
 template uint32_t getMipsGpAddr<ELF32BE>();
 template uint64_t getMipsGpAddr<ELF64LE>();
 template uint64_t getMipsGpAddr<ELF64BE>();
-
-template bool TargetInfo::needsCopyRel<ELF32LE>(uint32_t,
-                                                const SymbolBody &) const;
-template bool TargetInfo::needsCopyRel<ELF32BE>(uint32_t,
-                                                const SymbolBody &) const;
-template bool TargetInfo::needsCopyRel<ELF64LE>(uint32_t,
-                                                const SymbolBody &) const;
-template bool TargetInfo::needsCopyRel<ELF64BE>(uint32_t,
-                                                const SymbolBody &) const;
 }
 }

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=267018&r1=267017&r2=267018&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Thu Apr 21 12:37:11 2016
@@ -62,7 +62,6 @@ public:
 
   virtual RelExpr getRelExpr(uint32_t Type, const SymbolBody &S) const = 0;
   virtual void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const = 0;
-  template <class ELFT>
   bool needsCopyRel(uint32_t Type, const SymbolBody &S) const;
   virtual ~TargetInfo();
 

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=267018&r1=267017&r2=267018&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Apr 21 12:37:11 2016
@@ -558,7 +558,7 @@ void Writer<ELFT>::scanRelocs(InputSecti
     // in a read-only section, we need to create a copy relocation for the
     // symbol.
     if (auto *B = dyn_cast<SharedSymbol<ELFT>>(&Body)) {
-      if (IsAlloc && !IsWrite && Target->needsCopyRel<ELFT>(Type, *B)) {
+      if (IsAlloc && !IsWrite && Target->needsCopyRel(Type, *B)) {
         if (!B->needsCopy())
           addCopyRelSymbol(B);
         C.Relocations.push_back({Expr, Type, Offset, Addend, &Body});




More information about the llvm-commits mailing list