Reduce templating a bit. NFC.

llvm-svn: 295909
This commit is contained in:
Rafael Espindola 2017-02-23 00:02:03 +00:00
parent 79a45db7f5
commit a55b86c0e5
3 changed files with 5 additions and 6 deletions

View File

@ -163,8 +163,7 @@ template <class ELFT> void OutputSection<ELFT>::assignOffsets() {
}
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$/.

View File

@ -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;

View File

@ -885,7 +885,7 @@ static void sortBySymbolsOrder(ArrayRef<OutputSectionBase *> OutputSections) {
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<OutputSectionBase *> OutputSections) {
// 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>