[Lldb-commits] [lldb] [lldb] Use a range-based for loop instead of llvm::for_each (NFC) (PR #149541)

via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 18 09:12:22 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

LLVM Coding Standards discourages llvm::for_each unless we already
have a callable.


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


1 Files Affected:

- (modified) lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp (+1-2) 


``````````diff
diff --git a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
index f9aa6b1a98765..b775ec98c9a17 100644
--- a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
+++ b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
@@ -87,9 +87,8 @@ class PluginProperties : public Properties {
   void ServerURLsChangedCallback() {
     m_server_urls = GetDebugInfoDURLs();
     llvm::SmallVector<llvm::StringRef> dbginfod_urls;
-    llvm::for_each(m_server_urls, [&](const auto &obj) {
+    for (const auto &obj : m_server_urls)
       dbginfod_urls.push_back(obj.ref());
-    });
     llvm::setDefaultDebuginfodUrls(dbginfod_urls);
   }
   // Storage for the StringRef's used within the Debuginfod library.

``````````

</details>


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


More information about the lldb-commits mailing list