[ELF] llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)

Summary: The convenience wrapper in STLExtras is available since rL342102.

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, mgrang, llvm-commits

Differential Revision: https://reviews.llvm.org/D52569

llvm-svn: 343146
This commit is contained in:
Fangrui Song
2018-09-26 20:54:42 +00:00
parent ed5bb932a2
commit dbaeec6892
3 changed files with 19 additions and 24 deletions

View File

@@ -873,14 +873,13 @@ static void switchMorestackCallsToMorestackNonSplit(
}
// Sort both collections to compare addresses efficiently.
llvm::sort(MorestackCalls.begin(), MorestackCalls.end(),
[](const Relocation *L, const Relocation *R) {
return L->Offset < R->Offset;
});
llvm::sort(MorestackCalls, [](const Relocation *L, const Relocation *R) {
return L->Offset < R->Offset;
});
std::vector<Defined *> Functions(Prologues.begin(), Prologues.end());
llvm::sort(
Functions.begin(), Functions.end(),
[](const Defined *L, const Defined *R) { return L->Value < R->Value; });
llvm::sort(Functions, [](const Defined *L, const Defined *R) {
return L->Value < R->Value;
});
auto It = MorestackCalls.begin();
for (Defined *F : Functions) {

View File

@@ -1626,10 +1626,9 @@ bool AndroidPackedRelocationSection<ELFT>::updateAllocSize() {
NonRelatives.push_back(R);
}
llvm::sort(Relatives.begin(), Relatives.end(),
[](const Elf_Rel &A, const Elf_Rel &B) {
return A.r_offset < B.r_offset;
});
llvm::sort(Relatives, [](const Elf_Rel &A, const Elf_Rel &B) {
return A.r_offset < B.r_offset;
});
// Try to find groups of relative relocations which are spaced one word
// apart from one another. These generally correspond to vtable entries. The
@@ -1707,10 +1706,9 @@ bool AndroidPackedRelocationSection<ELFT>::updateAllocSize() {
}
// Finally the non-relative relocations.
llvm::sort(NonRelatives.begin(), NonRelatives.end(),
[](const Elf_Rela &A, const Elf_Rela &B) {
return A.r_offset < B.r_offset;
});
llvm::sort(NonRelatives, [](const Elf_Rela &A, const Elf_Rela &B) {
return A.r_offset < B.r_offset;
});
if (!NonRelatives.empty()) {
Add(NonRelatives.size());
Add(HasAddendIfRela);

View File

@@ -1135,11 +1135,10 @@ sortISDBySectionOrder(InputSectionDescription *ISD,
}
OrderedSections.push_back({IS, I->second});
}
llvm::sort(
OrderedSections.begin(), OrderedSections.end(),
[&](std::pair<InputSection *, int> A, std::pair<InputSection *, int> B) {
return A.second < B.second;
});
llvm::sort(OrderedSections, [&](std::pair<InputSection *, int> A,
std::pair<InputSection *, int> B) {
return A.second < B.second;
});
// Find an insertion point for the ordered section list in the unordered
// section list. On targets with limited-range branches, this is the mid-point
@@ -2133,10 +2132,9 @@ struct SectionOffset {
// load and virtual adresses).
static void checkOverlap(StringRef Name, std::vector<SectionOffset> &Sections,
bool IsVirtualAddr) {
llvm::sort(Sections.begin(), Sections.end(),
[=](const SectionOffset &A, const SectionOffset &B) {
return A.Offset < B.Offset;
});
llvm::sort(Sections, [=](const SectionOffset &A, const SectionOffset &B) {
return A.Offset < B.Offset;
});
// Finding overlap is easy given a vector is sorted by start position.
// If an element starts before the end of the previous element, they overlap.