-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
[lld] Use *Set::insert_range (NFC) #132590
[lld] Use *Set::insert_range (NFC) #132590
Conversation
DenseSet, SmallPtrSet, SmallSet, SetVector, and StringSet recently gained C++23-style insert_range. This patch replaces: Dest.insert(Src.begin(), Src.end()); with: Dest.insert_range(Src);
@llvm/pr-subscribers-lld-wasm @llvm/pr-subscribers-lld-elf Author: Kazu Hirata (kazutakahirata) ChangesDenseSet, SmallPtrSet, SmallSet, SetVector, and StringSet recently Dest.insert(Src.begin(), Src.end()); with: Dest.insert_range(Src); Full diff: https://github.com/llvm/llvm-project/pull/132590.diff 2 Files Affected:
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 0d5b383f4b596..e19823f2ea752 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -797,7 +797,7 @@ void LinkerScript::processSectionCommands() {
if (!potentialSpillLists.empty()) {
DenseSet<StringRef> insertNames;
for (InsertCommand &ic : insertCommands)
- insertNames.insert(ic.names.begin(), ic.names.end());
+ insertNames.insert_range(ic.names);
for (SectionCommand *&base : sectionCommands) {
auto *osd = dyn_cast<OutputDesc>(base);
if (!osd)
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index cf315de76b4ca..f4ba182ee5079 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -588,7 +588,7 @@ void Writer::populateTargetFeatures() {
if (ctx.arg.extraFeatures.has_value()) {
auto &extraFeatures = *ctx.arg.extraFeatures;
- allowed.insert(extraFeatures.begin(), extraFeatures.end());
+ allowed.insert_range(extraFeatures);
}
// Only infer used features if user did not specify features
@@ -596,7 +596,7 @@ void Writer::populateTargetFeatures() {
if (!inferFeatures) {
auto &explicitFeatures = *ctx.arg.features;
- allowed.insert(explicitFeatures.begin(), explicitFeatures.end());
+ allowed.insert_range(explicitFeatures);
if (!ctx.arg.checkFeatures)
goto done;
}
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/18707 Here is the relevant piece of the build log for the reference
|
DenseSet, SmallPtrSet, SmallSet, SetVector, and StringSet recently
gained C++23-style insert_range. This patch replaces:
Dest.insert(Src.begin(), Src.end());
with:
Dest.insert_range(Src);