[Lldb-commits] [lldb] [NFC][lldb][windows] cleanup ProcessLauncherWindows result check (PR #200804)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 1 05:58:42 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

Currently, `result` is checked 3 times without being mutated. Remove all three checks but one.

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


1 Files Affected:

- (modified) lldb/source/Host/windows/ProcessLauncherWindows.cpp (+7-11) 


``````````diff
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
index a796e3627fb3c..08750ebb95113 100644
--- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -244,21 +244,17 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
 
   if (!result) {
     // Call GetLastError before we make any other system calls.
-    error = Status(::GetLastError(), eErrorTypeWin32);
     // Note that error 50 ("The request is not supported") will occur if you
     // try debug a 64-bit inferior from a 32-bit LLDB.
+    error = Status(::GetLastError(), eErrorTypeWin32);
+    return HostProcess();
   }
 
-  if (result) {
-    // Do not call CloseHandle on pi.hProcess, since we want to pass that back
-    // through the HostProcess.
-    ::CloseHandle(pi.hThread);
-    if (pty_mode == PseudoConsole::Mode::Pipe)
-      launch_info.GetPTY().CloseAnonymousPipes();
-  }
-
-  if (!result)
-    return HostProcess();
+  // Do not call CloseHandle on pi.hProcess, since we want to pass that back
+  // through the HostProcess.
+  ::CloseHandle(pi.hThread);
+  if (pty_mode == PseudoConsole::Mode::Pipe)
+    launch_info.GetPTY().CloseAnonymousPipes();
 
   return HostProcess(pi.hProcess);
 }

``````````

</details>


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


More information about the lldb-commits mailing list