[lld] r295909 - Reduce templating a bit. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 16:02:04 PST 2017


Author: rafael
Date: Wed Feb 22 18:02:03 2017
New Revision: 295909

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

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

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=295909&r1=295908&r2=295909&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Wed Feb 22 18:02:03 2017
@@ -163,8 +163,7 @@ template <class ELFT> void OutputSection
 }
 
 template <class ELFT>
-void OutputSection<ELFT>::sort(
-    std::function<int(InputSection<ELFT> *S)> Order) {
+void OutputSection<ELFT>::sort(std::function<int(InputSectionData *S)> Order) {
   typedef std::pair<unsigned, InputSection<ELFT> *> Pair;
   auto Comp = [](const Pair &A, const Pair &B) { return A.first < B.first; };
 
@@ -185,7 +184,7 @@ void OutputSection<ELFT>::sort(
 // For more detail, read the section of the GCC's manual about init_priority.
 template <class ELFT> void OutputSection<ELFT>::sortInitFini() {
   // Sort sections by priority.
-  sort([](InputSection<ELFT> *S) { return getPriority(S->Name); });
+  sort([](InputSectionData *S) { return getPriority(S->Name); });
 }
 
 // Returns true if S matches /Filename.?\.o$/.

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=295909&r1=295908&r2=295909&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Wed Feb 22 18:02:03 2017
@@ -112,7 +112,7 @@ public:
   typedef typename ELFT::uint uintX_t;
   OutputSection(StringRef Name, uint32_t Type, uintX_t Flags);
   void addSection(InputSectionData *C) override;
-  void sort(std::function<int(InputSection<ELFT> *S)> Order);
+  void sort(std::function<int(InputSectionData *S)> Order);
   void sortInitFini();
   void sortCtorsDtors();
   void writeTo(uint8_t *Buf) override;

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=295909&r1=295908&r2=295909&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Feb 22 18:02:03 2017
@@ -885,7 +885,7 @@ static void sortBySymbolsOrder(ArrayRef<
     SymbolOrder.insert({S, Priority++});
 
   // Build a map from sections to their priorities.
-  DenseMap<InputSectionBase<ELFT> *, int> SectionOrder;
+  DenseMap<InputSectionData *, int> SectionOrder;
   for (elf::ObjectFile<ELFT> *File : Symtab<ELFT>::X->getObjectFiles()) {
     for (SymbolBody *Body : File->getSymbols()) {
       auto *D = dyn_cast<DefinedRegular<ELFT>>(Body);
@@ -899,7 +899,7 @@ static void sortBySymbolsOrder(ArrayRef<
   // Sort sections by priority.
   for (OutputSectionBase *Base : OutputSections)
     if (auto *Sec = dyn_cast<OutputSection<ELFT>>(Base))
-      Sec->sort([&](InputSection<ELFT> *S) { return SectionOrder.lookup(S); });
+      Sec->sort([&](InputSectionData *S) { return SectionOrder.lookup(S); });
 }
 
 template <class ELFT>




More information about the llvm-commits mailing list