Author: Charles Zablit
Date: 2026-06-10T14:15:17+01:00
New Revision: 7fe41b00f5698395fa8998388de3ee8f2af5e2d5

URL: 
https://github.com/llvm/llvm-project/commit/7fe41b00f5698395fa8998388de3ee8f2af5e2d5
DIFF: 
https://github.com/llvm/llvm-project/commit/7fe41b00f5698395fa8998388de3ee8f2af5e2d5.diff

LOG: [NFC][lldb][Windows] Clean up NativeProcessWindows (#202720)

A second pass over NativeProcessWindows after b1142bf99486:

- Fix "implemenation" typo in CacheLoadedModules.
- Simplify OnExitThread to use llvm::erase_if.

Added: 
    

Modified: 
    lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp

Removed: 
    


################################################################################
diff  --git 
a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp 
b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
index 1cdc7918d7859..80ecb321209ed 100644
--- a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
@@ -355,7 +355,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;
@@ -693,18 +693,10 @@ 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;
-    }
-  }
+  std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
+  llvm::erase_if(m_threads, [thread_id](const auto &t) {
+    return t->GetID() == thread_id;
+  });
 }
 
 void NativeProcessWindows::OnLoadDll(const ModuleSpec &module_spec,


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to