-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[lld] Use llvm::unique (NFC) #136453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_range_unique_lld
Apr 19, 2025
Merged
[lld] Use llvm::unique (NFC) #136453
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_range_unique_lld
Apr 19, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
|
@llvm/pr-subscribers-platform-windows @llvm/pr-subscribers-lld-coff Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/136453.diff 7 Files Affected:
diff --git a/lld/COFF/MapFile.cpp b/lld/COFF/MapFile.cpp
index eb98bb484f9f4..9b7c05b9e68b9 100644
--- a/lld/COFF/MapFile.cpp
+++ b/lld/COFF/MapFile.cpp
@@ -75,10 +75,9 @@ static void sortUniqueSymbols(std::vector<Defined *> &syms,
// Remove duplicate symbol pointers
parallelSort(v, std::less<SortEntry>());
- auto end = std::unique(v.begin(), v.end(),
- [](const SortEntry &a, const SortEntry &b) {
- return a.first == b.first;
- });
+ auto end = llvm::unique(v, [](const SortEntry &a, const SortEntry &b) {
+ return a.first == b.first;
+ });
v.erase(end, v.end());
// Sort by RVA then original order
diff --git a/lld/ELF/AArch64ErrataFix.cpp b/lld/ELF/AArch64ErrataFix.cpp
index b5641e5d9ce55..e2b1cf14daa72 100644
--- a/lld/ELF/AArch64ErrataFix.cpp
+++ b/lld/ELF/AArch64ErrataFix.cpp
@@ -461,12 +461,12 @@ void AArch64Err843419Patcher::init() {
llvm::stable_sort(mapSyms, [](const Defined *a, const Defined *b) {
return a->value < b->value;
});
- mapSyms.erase(
- std::unique(mapSyms.begin(), mapSyms.end(),
- [=](const Defined *a, const Defined *b) {
- return isCodeMapSymbol(a) == isCodeMapSymbol(b);
- }),
- mapSyms.end());
+ mapSyms.erase(llvm::unique(mapSyms,
+ [=](const Defined *a, const Defined *b) {
+ return isCodeMapSymbol(a) ==
+ isCodeMapSymbol(b);
+ }),
+ mapSyms.end());
// Always start with a Code Mapping Symbol.
if (!mapSyms.empty() && !isCodeMapSymbol(mapSyms.front()))
mapSyms.erase(mapSyms.begin());
diff --git a/lld/ELF/ARMErrataFix.cpp b/lld/ELF/ARMErrataFix.cpp
index a7120c43e51d3..d14d28ee43a2f 100644
--- a/lld/ELF/ARMErrataFix.cpp
+++ b/lld/ELF/ARMErrataFix.cpp
@@ -354,11 +354,11 @@ void ARMErr657417Patcher::init() {
llvm::stable_sort(mapSyms, [](const Defined *a, const Defined *b) {
return a->value < b->value;
});
- mapSyms.erase(std::unique(mapSyms.begin(), mapSyms.end(),
- [=](const Defined *a, const Defined *b) {
- return (isThumbMapSymbol(a) ==
- isThumbMapSymbol(b));
- }),
+ mapSyms.erase(llvm::unique(mapSyms,
+ [=](const Defined *a, const Defined *b) {
+ return (isThumbMapSymbol(a) ==
+ isThumbMapSymbol(b));
+ }),
mapSyms.end());
// Always start with a Thumb Mapping Symbol
if (!mapSyms.empty() && !isThumbMapSymbol(mapSyms.front()))
diff --git a/lld/ELF/BPSectionOrderer.cpp b/lld/ELF/BPSectionOrderer.cpp
index 4adb42ef4ff93..793176c7725a3 100644
--- a/lld/ELF/BPSectionOrderer.cpp
+++ b/lld/ELF/BPSectionOrderer.cpp
@@ -53,7 +53,7 @@ struct BPOrdererELF : lld::BPOrderer<BPOrdererELF> {
hashes.push_back(byte);
llvm::sort(hashes);
- hashes.erase(std::unique(hashes.begin(), hashes.end()), hashes.end());
+ hashes.erase(llvm::unique(hashes), hashes.end());
}
static StringRef getSymName(const Defined &sym) { return sym.getName(); }
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 196ecc4fee8c8..2531227cb99b7 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -590,7 +590,7 @@ SmallVector<EhFrameSection::FdeData, 0> EhFrameSection::getFdeData() const {
auto eq = [](const FdeData &a, const FdeData &b) {
return a.pcRel == b.pcRel;
};
- ret.erase(std::unique(ret.begin(), ret.end(), eq), ret.end());
+ ret.erase(llvm::unique(ret, eq), ret.end());
return ret;
}
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 950afd0421f06..1295d21cad8a1 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -73,7 +73,7 @@ struct BPOrdererMachO : lld::BPOrderer<BPOrdererMachO> {
}
llvm::sort(hashes);
- hashes.erase(std::unique(hashes.begin(), hashes.end()), hashes.end());
+ hashes.erase(llvm::unique(hashes), hashes.end());
}
static llvm::StringRef getSymName(const Defined &sym) {
diff --git a/lld/include/lld/Common/BPSectionOrdererBase.inc b/lld/include/lld/Common/BPSectionOrdererBase.inc
index b19d3670d34cc..51dfb6471644a 100644
--- a/lld/include/lld/Common/BPSectionOrdererBase.inc
+++ b/lld/include/lld/Common/BPSectionOrdererBase.inc
@@ -260,7 +260,7 @@ auto BPOrderer<D>::computeOrder(
auto &uns = startupSectionIdxUNs[sectionIdx];
uns.append(compressionUns);
llvm::sort(uns);
- uns.erase(std::unique(uns.begin(), uns.end()), uns.end());
+ uns.erase(llvm::unique(uns), uns.end());
}
}
|
kuhar
approved these changes
Apr 19, 2025
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.