[Lldb-commits] [lldb] [lldb] Use llvm::find (NFC) (PR #143338)
via lldb-commits
lldb-commits at lists.llvm.org
Sun Jun 8 21:02:20 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
This patch should be mostly obvious, but in one place, this patch changes:
const auto &it = std::find(...)
to:
auto it = llvm::find(...)
We do not need to bind to a temporary with const ref.
---
Full diff: https://github.com/llvm/llvm-project/pull/143338.diff
4 Files Affected:
- (modified) lldb/source/Breakpoint/WatchpointResource.cpp (+1-2)
- (modified) lldb/source/Expression/FunctionCaller.cpp (+1-2)
- (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (+1-1)
- (modified) lldb/source/Target/Process.cpp (+1-1)
``````````diff
diff --git a/lldb/source/Breakpoint/WatchpointResource.cpp b/lldb/source/Breakpoint/WatchpointResource.cpp
index 49d9d12aadfc3..c2f510f03638f 100644
--- a/lldb/source/Breakpoint/WatchpointResource.cpp
+++ b/lldb/source/Breakpoint/WatchpointResource.cpp
@@ -56,8 +56,7 @@ void WatchpointResource::AddConstituent(const WatchpointSP &wp_sp) {
void WatchpointResource::RemoveConstituent(WatchpointSP &wp_sp) {
std::lock_guard<std::mutex> guard(m_constituents_mutex);
- const auto &it =
- std::find(m_constituents.begin(), m_constituents.end(), wp_sp);
+ auto it = llvm::find(m_constituents, wp_sp);
if (it != m_constituents.end())
m_constituents.erase(it);
}
diff --git a/lldb/source/Expression/FunctionCaller.cpp b/lldb/source/Expression/FunctionCaller.cpp
index 83cac130ba728..6c93d94f691cb 100644
--- a/lldb/source/Expression/FunctionCaller.cpp
+++ b/lldb/source/Expression/FunctionCaller.cpp
@@ -323,8 +323,7 @@ bool FunctionCaller::FetchFunctionResults(ExecutionContext &exe_ctx,
void FunctionCaller::DeallocateFunctionResults(ExecutionContext &exe_ctx,
lldb::addr_t args_addr) {
std::list<lldb::addr_t>::iterator pos;
- pos = std::find(m_wrapper_args_addrs.begin(), m_wrapper_args_addrs.end(),
- args_addr);
+ pos = llvm::find(m_wrapper_args_addrs, args_addr);
if (pos != m_wrapper_args_addrs.end())
m_wrapper_args_addrs.erase(pos);
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 420c84b496d15..f18bdd5175f2e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1728,7 +1728,7 @@ ThreadSP ProcessGDBRemote::SetThreadStopInfo(
reg_ctx_sp->InvalidateIfNeeded(true);
- auto iter = std::find(m_thread_ids.begin(), m_thread_ids.end(), tid);
+ auto iter = llvm::find(m_thread_ids, tid);
if (iter != m_thread_ids.end())
SetThreadPc(thread_sp, iter - m_thread_ids.begin());
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 58edf972ddbe7..61a3d05bc3746 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -5838,7 +5838,7 @@ void Process::ClearPreResumeActions() { m_pre_resume_actions.clear(); }
void Process::ClearPreResumeAction(PreResumeActionCallback callback, void *baton)
{
PreResumeCallbackAndBaton element(callback, baton);
- auto found_iter = std::find(m_pre_resume_actions.begin(), m_pre_resume_actions.end(), element);
+ auto found_iter = llvm::find(m_pre_resume_actions, element);
if (found_iter != m_pre_resume_actions.end())
{
m_pre_resume_actions.erase(found_iter);
``````````
</details>
https://github.com/llvm/llvm-project/pull/143338
More information about the lldb-commits
mailing list