https://github.com/charles-zablit updated https://github.com/llvm/llvm-project/pull/202720
>From 708176e8a3cb23a798c02fb7adead111f5062953 Mon Sep 17 00:00:00 2001 From: Charles Zablit <[email protected]> Date: Sun, 7 Jun 2026 20:37:07 +0100 Subject: [PATCH 1/2] [NFC][lldb][Windows] Clean up NativeProcessWindows A second pass over NativeProcessWindows after b1142bf99486: - Fix "implemenation" typo in CacheLoadedModules. - Simplify OnExitThread to use llvm::erase_if. --- .../Windows/Common/NativeProcessWindows.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp index b235ab281bad6..93d1859bceeae 100644 --- a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp @@ -350,7 +350,7 @@ Status NativeProcessWindows::CacheLoadedModules() { if (!m_loaded_modules.empty()) return Status(); - // Retrieve loaded modules by a Target/Module free implemenation. + // Retrieve loaded modules by a Target/Module-free implementation. AutoHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetID())); if (snapshot.IsValid()) { MODULEENTRY32W me; @@ -663,17 +663,9 @@ void NativeProcessWindows::OnCreateThread(const HostThread &new_thread) { void NativeProcessWindows::OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) { llvm::sys::ScopedLock lock(m_mutex); - NativeThreadWindows *thread = GetThreadByID(thread_id); - if (!thread) - return; - - for (auto t = m_threads.begin(); t != m_threads.end();) { - if ((*t)->GetID() == thread_id) { - t = m_threads.erase(t); - } else { - ++t; - } - } + llvm::erase_if(m_threads, [thread_id](const auto &t) { + return t->GetID() == thread_id; + }); } void NativeProcessWindows::OnLoadDll(const ModuleSpec &module_spec, >From 78d2d71fb0c5bd4db4679d09f401e6bcab9cef4b Mon Sep 17 00:00:00 2001 From: Charles Zablit <[email protected]> Date: Wed, 10 Jun 2026 11:53:40 +0100 Subject: [PATCH 2/2] fixup! [NFC][lldb][Windows] Clean up NativeProcessWindows --- .../Plugins/Process/Windows/Common/NativeProcessWindows.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp index 93d1859bceeae..f7a5bc6cf6321 100644 --- a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp @@ -662,7 +662,7 @@ void NativeProcessWindows::OnCreateThread(const HostThread &new_thread) { void NativeProcessWindows::OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) { - llvm::sys::ScopedLock lock(m_mutex); + llvm::sys::ScopedLock lock(m_threads_mutex); llvm::erase_if(m_threads, [thread_id](const auto &t) { return t->GetID() == thread_id; }); _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
