diff options
| author | Fangrui Song <maskray@google.com> | 2019-04-23 02:42:06 +0000 |
|---|---|---|
| committer | Fangrui Song <maskray@google.com> | 2019-04-23 02:42:06 +0000 |
| commit | 32c0ebe615772f25b4cadb82bc3ad809afa62641 (patch) | |
| tree | 5564546e03882865d6d4a22e3a8ce625e6d0a71a /lld/ELF/OutputSections.cpp | |
| parent | ab66e34c637b966acdced76a8480a12a77aa33e2 (diff) | |
| download | bcm5719-llvm-32c0ebe615772f25b4cadb82bc3ad809afa62641.tar.gz bcm5719-llvm-32c0ebe615772f25b4cadb82bc3ad809afa62641.zip | |
Use llvm::stable_sort
Make some small adjustment while touching the code: make parameters
const, use less_first(), etc.
Differential Revision: https://reviews.llvm.org/D60989
llvm-svn: 358943
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
| -rw-r--r-- | lld/ELF/OutputSections.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 6a80b5b104f..6919ec465a0 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -138,13 +138,10 @@ void OutputSection::addSection(InputSection *IS) { static void sortByOrder(MutableArrayRef<InputSection *> In, llvm::function_ref<int(InputSectionBase *S)> Order) { - using Pair = std::pair<int, InputSection *>; - auto Comp = [](const Pair &A, const Pair &B) { return A.first < B.first; }; - - std::vector<Pair> V; + std::vector<std::pair<int, InputSection *>> V; for (InputSection *S : In) V.push_back({Order(S), S}); - std::stable_sort(V.begin(), V.end(), Comp); + llvm::stable_sort(V, less_first()); for (size_t I = 0; I < V.size(); ++I) In[I] = V[I].second; @@ -369,7 +366,7 @@ static bool compCtors(const InputSection *A, const InputSection *B) { void OutputSection::sortCtorsDtors() { assert(SectionCommands.size() == 1); auto *ISD = cast<InputSectionDescription>(SectionCommands[0]); - std::stable_sort(ISD->Sections.begin(), ISD->Sections.end(), compCtors); + llvm::stable_sort(ISD->Sections, compCtors); } // If an input string is in the form of "foo.N" where N is a number, |

