Skip to content

Commit f347a06

Browse files
[lld] Use llvm::unique (NFC) (#136453)
1 parent 9473349 commit f347a06

File tree

7 files changed

+18
-19
lines changed

7 files changed

+18
-19
lines changed

lld/COFF/MapFile.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,9 @@ static void sortUniqueSymbols(std::vector<Defined *> &syms,
7575

7676
// Remove duplicate symbol pointers
7777
parallelSort(v, std::less<SortEntry>());
78-
auto end = std::unique(v.begin(), v.end(),
79-
[](const SortEntry &a, const SortEntry &b) {
80-
return a.first == b.first;
81-
});
78+
auto end = llvm::unique(v, [](const SortEntry &a, const SortEntry &b) {
79+
return a.first == b.first;
80+
});
8281
v.erase(end, v.end());
8382

8483
// Sort by RVA then original order

lld/ELF/AArch64ErrataFix.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,12 @@ void AArch64Err843419Patcher::init() {
461461
llvm::stable_sort(mapSyms, [](const Defined *a, const Defined *b) {
462462
return a->value < b->value;
463463
});
464-
mapSyms.erase(
465-
std::unique(mapSyms.begin(), mapSyms.end(),
466-
[=](const Defined *a, const Defined *b) {
467-
return isCodeMapSymbol(a) == isCodeMapSymbol(b);
468-
}),
469-
mapSyms.end());
464+
mapSyms.erase(llvm::unique(mapSyms,
465+
[=](const Defined *a, const Defined *b) {
466+
return isCodeMapSymbol(a) ==
467+
isCodeMapSymbol(b);
468+
}),
469+
mapSyms.end());
470470
// Always start with a Code Mapping Symbol.
471471
if (!mapSyms.empty() && !isCodeMapSymbol(mapSyms.front()))
472472
mapSyms.erase(mapSyms.begin());

lld/ELF/ARMErrataFix.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,11 @@ void ARMErr657417Patcher::init() {
354354
llvm::stable_sort(mapSyms, [](const Defined *a, const Defined *b) {
355355
return a->value < b->value;
356356
});
357-
mapSyms.erase(std::unique(mapSyms.begin(), mapSyms.end(),
358-
[=](const Defined *a, const Defined *b) {
359-
return (isThumbMapSymbol(a) ==
360-
isThumbMapSymbol(b));
361-
}),
357+
mapSyms.erase(llvm::unique(mapSyms,
358+
[=](const Defined *a, const Defined *b) {
359+
return (isThumbMapSymbol(a) ==
360+
isThumbMapSymbol(b));
361+
}),
362362
mapSyms.end());
363363
// Always start with a Thumb Mapping Symbol
364364
if (!mapSyms.empty() && !isThumbMapSymbol(mapSyms.front()))

lld/ELF/BPSectionOrderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct BPOrdererELF : lld::BPOrderer<BPOrdererELF> {
5353
hashes.push_back(byte);
5454

5555
llvm::sort(hashes);
56-
hashes.erase(std::unique(hashes.begin(), hashes.end()), hashes.end());
56+
hashes.erase(llvm::unique(hashes), hashes.end());
5757
}
5858

5959
static StringRef getSymName(const Defined &sym) { return sym.getName(); }

lld/ELF/SyntheticSections.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ SmallVector<EhFrameSection::FdeData, 0> EhFrameSection::getFdeData() const {
590590
auto eq = [](const FdeData &a, const FdeData &b) {
591591
return a.pcRel == b.pcRel;
592592
};
593-
ret.erase(std::unique(ret.begin(), ret.end(), eq), ret.end());
593+
ret.erase(llvm::unique(ret, eq), ret.end());
594594

595595
return ret;
596596
}

lld/MachO/BPSectionOrderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct BPOrdererMachO : lld::BPOrderer<BPOrdererMachO> {
7373
}
7474

7575
llvm::sort(hashes);
76-
hashes.erase(std::unique(hashes.begin(), hashes.end()), hashes.end());
76+
hashes.erase(llvm::unique(hashes), hashes.end());
7777
}
7878

7979
static llvm::StringRef getSymName(const Defined &sym) {

lld/include/lld/Common/BPSectionOrdererBase.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ auto BPOrderer<D>::computeOrder(
260260
auto &uns = startupSectionIdxUNs[sectionIdx];
261261
uns.append(compressionUns);
262262
llvm::sort(uns);
263-
uns.erase(std::unique(uns.begin(), uns.end()), uns.end());
263+
uns.erase(llvm::unique(uns), uns.end());
264264
}
265265
}
266266

0 commit comments

Comments
 (0)