Skip to content
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

Merged

Conversation

kazutakahirata
Copy link
Contributor

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);

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);
@llvmbot
Copy link
Member

llvmbot commented Mar 23, 2025

@llvm/pr-subscribers-lld-wasm
@llvm/pr-subscribers-lld

@llvm/pr-subscribers-lld-elf

Author: Kazu Hirata (kazutakahirata)

Changes

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);


Full diff: https://github.com/llvm/llvm-project/pull/132590.diff

2 Files Affected:

  • (modified) lld/ELF/LinkerScript.cpp (+1-1)
  • (modified) lld/wasm/Writer.cpp (+2-2)
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;
   }

@kazutakahirata kazutakahirata merged commit 00cb966 into llvm:main Mar 23, 2025
15 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_set_use_insert_range_lld branch March 23, 2025 04:57
@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 23, 2025

LLVM Buildbot has detected a new failure on builder lldb-x86_64-debian running on lldb-x86_64-debian while building lld at step 6 "test".

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
Step 6 (test) failure: build (failure)
...
PASS: lldb-shell :: SymbolFile/DWARF/x86/type-definition-search.cpp (309 of 2801)
PASS: lldb-api :: functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py (310 of 2801)
PASS: lldb-api :: tools/lldb-server/commandline/TestStubSetSID.py (311 of 2801)
PASS: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentBreakpointOneDelayBreakpointThreads.py (312 of 2801)
PASS: lldb-api :: commands/expression/call-function/TestCallStdStringFunction.py (313 of 2801)
PASS: lldb-api :: functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py (314 of 2801)
PASS: lldb-api :: functionalities/thread/state_after_expression/TestStateAfterExpression.py (315 of 2801)
PASS: lldb-api :: functionalities/process_group/TestChangeProcessGroup.py (316 of 2801)
PASS: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentDelaySignalBreak.py (317 of 2801)
PASS: lldb-api :: lang/cpp/char1632_t/TestChar1632T.py (318 of 2801)
FAIL: lldb-api :: lang/cpp/const_this/TestConstThis.py (319 of 2801)
******************** TEST 'lldb-api :: lang/cpp/const_this/TestConstThis.py' FAILED ********************
Script:
--
/usr/bin/python3 /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./lib --env LLVM_INCLUDE_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/include --env LLVM_TOOLS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --arch x86_64 --build-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex --lldb-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/lldb --compiler /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/clang --dsymutil /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./bin --lldb-obj-root /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb --lldb-libs-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./lib -t /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/lang/cpp/const_this -p TestConstThis.py
--
Exit Code: -11

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 00cb966209955878cee903068333d4d2d4f7b259)
  clang revision 00cb966209955878cee903068333d4d2d4f7b259
  llvm revision 00cb966209955878cee903068333d4d2d4f7b259
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
Change dir to: /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/lang/cpp/const_this
runCmd: settings clear -all

output: 

runCmd: settings set symbols.enable-external-lookup false

output: 

runCmd: settings set target.inherit-tcc true

output: 

runCmd: settings set target.disable-aslr false

output: 

runCmd: settings set target.detach-on-error false

output: 


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants