[PATCH] D52569: [ELF] llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 26 13:12:47 PDT 2018
MaskRay created this revision.
MaskRay added a reviewer: ruiu.
Herald added subscribers: llvm-commits, mgrang, arichardson, emaste.
Herald added a reviewer: espindola.
The convenience wrapper in STLExtras is available since https://reviews.llvm.org/rL342102.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D52569
Files:
ELF/InputSection.cpp
ELF/SyntheticSections.cpp
ELF/Writer.cpp
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -1135,11 +1135,10 @@
}
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 @@
// 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.
Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -1626,10 +1626,9 @@
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 @@
}
// 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);
Index: ELF/InputSection.cpp
===================================================================
--- ELF/InputSection.cpp
+++ ELF/InputSection.cpp
@@ -873,14 +873,13 @@
}
// 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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52569.167182.patch
Type: text/x-patch
Size: 3440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180926/a239492f/attachment-0001.bin>
More information about the llvm-commits
mailing list