[Lldb-commits] [lldb] [NFC][lldb][windows] cleanup ProcessLauncherWindows result check (PR #200804)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 1 05:57:58 PDT 2026
https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/200804
Currently, `result` is checked 3 times without being mutated. Remove all three checks but one.
>From 204a0444b1d8a8927c2ec0f4bee1f8a425513ade Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Mon, 1 Jun 2026 13:56:31 +0100
Subject: [PATCH] [NFC][lldb][windows] cleanup ProcessLauncherWindows result
check
---
.../Host/windows/ProcessLauncherWindows.cpp | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
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);
}
More information about the lldb-commits
mailing list