[lld] [lld] Use *Set::insert_range (NFC) (PR #133565)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 28 21:10:27 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld-elf

@llvm/pr-subscribers-lld-macho

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


3 Files Affected:

- (modified) lld/COFF/Driver.cpp (+1-2) 
- (modified) lld/ELF/Driver.cpp (+1-2) 
- (modified) lld/MachO/Driver.cpp (+1-2) 


``````````diff
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index bb64a5c0b9e96..9bbab524b1f9a 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -1977,8 +1977,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
 
   // Handle /lldsavetemps
   if (args.hasArg(OPT_lldsavetemps)) {
-    for (const char *s : lldsaveTempsValues)
-      config->saveTempsArgs.insert(s);
+    config->saveTempsArgs.insert_range(lldsaveTempsValues);
   } else {
     for (auto *arg : args.filtered(OPT_lldsavetemps_colon)) {
       StringRef s = arg->getValue();
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 7267171635e17..0a220432333cc 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1467,8 +1467,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
 
   if (args.hasArg(OPT_save_temps)) {
     // --save-temps implies saving all temps.
-    for (const char *s : saveTempsValues)
-      ctx.arg.saveTempsArgs.insert(s);
+    ctx.arg.saveTempsArgs.insert_range(saveTempsValues);
   } else {
     for (auto *arg : args.filtered(OPT_save_temps_eq)) {
       StringRef s = arg->getValue();
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 7070e92ddc4a1..bec94f830e976 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -616,8 +616,7 @@ static bool compileBitcodeFiles() {
         lto->add(*bitcodeFile);
 
   std::vector<ObjFile *> compiled = lto->compile();
-  for (ObjFile *file : compiled)
-    inputFiles.insert(file);
+  inputFiles.insert_range(compiled);
 
   return !compiled.empty();
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/133565


More information about the llvm-commits mailing list