From a55b86c0e5eca17b382c8bbe207bcc95be825887 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 23 Feb 2017 00:02:03 +0000 Subject: [PATCH] Reduce templating a bit. NFC. llvm-svn: 295909 --- lld/ELF/OutputSections.cpp | 5 ++--- lld/ELF/OutputSections.h | 2 +- lld/ELF/Writer.cpp | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 9eff851c7e32..15d467a7922f 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -163,8 +163,7 @@ template void OutputSection::assignOffsets() { } template -void OutputSection::sort( - std::function *S)> Order) { +void OutputSection::sort(std::function Order) { typedef std::pair *> Pair; auto Comp = [](const Pair &A, const Pair &B) { return A.first < B.first; }; @@ -185,7 +184,7 @@ void OutputSection::sort( // For more detail, read the section of the GCC's manual about init_priority. template void OutputSection::sortInitFini() { // Sort sections by priority. - sort([](InputSection *S) { return getPriority(S->Name); }); + sort([](InputSectionData *S) { return getPriority(S->Name); }); } // Returns true if S matches /Filename.?\.o$/. diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index f5b8157696b8..a2ab3b049a22 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -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 *S)> Order); + void sort(std::function Order); void sortInitFini(); void sortCtorsDtors(); void writeTo(uint8_t *Buf) override; diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index a2064e3cfd86..abdf61a8e7a6 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -885,7 +885,7 @@ static void sortBySymbolsOrder(ArrayRef OutputSections) { SymbolOrder.insert({S, Priority++}); // Build a map from sections to their priorities. - DenseMap *, int> SectionOrder; + DenseMap SectionOrder; for (elf::ObjectFile *File : Symtab::X->getObjectFiles()) { for (SymbolBody *Body : File->getSymbols()) { auto *D = dyn_cast>(Body); @@ -899,7 +899,7 @@ static void sortBySymbolsOrder(ArrayRef OutputSections) { // Sort sections by priority. for (OutputSectionBase *Base : OutputSections) if (auto *Sec = dyn_cast>(Base)) - Sec->sort([&](InputSection *S) { return SectionOrder.lookup(S); }); + Sec->sort([&](InputSectionData *S) { return SectionOrder.lookup(S); }); } template