Reorder code to improve readability. NFC.

llvm-svn: 260467
This commit is contained in:
Rui Ueyama 2016-02-10 23:43:16 +00:00
parent 4064174892
commit 704da023cc
1 changed files with 3 additions and 3 deletions

View File

@ -769,12 +769,12 @@ static int getPriority(StringRef S) {
template <class ELFT> void OutputSection<ELFT>::sortByPriority() {
// Sort sections by priority.
typedef std::pair<int, InputSection<ELFT> *> Pair;
auto Comp = [](const Pair &A, const Pair &B) { return A.first < B.first; };
std::vector<Pair> V;
for (InputSection<ELFT> *S : Sections)
V.push_back({getPriority(S->getSectionName()), S});
std::stable_sort(V.begin(), V.end(), [](const Pair &A, const Pair &B) {
return A.first < B.first;
});
std::stable_sort(V.begin(), V.end(), Comp);
Sections.clear();
for (Pair &P : V)
Sections.push_back(P.second);