Skip to content

Conversation

@charles-zablit
Copy link
Contributor

This patch fixes a implicit copy instead of using a reference to a STARTUPINFOW instance.

This is a followup to #170301.

@llvmbot
Copy link
Member

llvmbot commented Dec 4, 2025

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

Changes

This patch fixes a implicit copy instead of using a reference to a STARTUPINFOW instance.

This is a followup to #170301.


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

1 Files Affected:

  • (modified) lldb/source/Host/windows/ProcessLauncherWindows.cpp (+1-1)
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
index 2f78ef80f385e..f22a5ffefc19a 100644
--- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -198,7 +198,7 @@ llvm::ErrorOr<std::vector<HANDLE>> ProcessLauncherWindows::GetInheritedHandles(
     const ProcessLaunchInfo &launch_info, STARTUPINFOEXW &startupinfoex,
     HANDLE stdout_handle, HANDLE stderr_handle, HANDLE stdin_handle) {
   std::vector<HANDLE> inherited_handles;
-  STARTUPINFOW startupinfo = startupinfoex.StartupInfo;
+  STARTUPINFOW &startupinfo = startupinfoex.StartupInfo;
 
   startupinfo.hStdError =
       stderr_handle ? stderr_handle : GetStdHandle(STD_ERROR_HANDLE);

Copy link
Member

@dzhidzhoev dzhidzhoev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to just reference the startupinfoex.StartupInfo locally? It is a bit unobvious that you are intending to mutate that member. Alternatively, we could simply take a STARTUPINFOW & instead of STARTUPINFOEXW & in the parameter list.

@charles-zablit
Copy link
Contributor Author

charles-zablit commented Dec 4, 2025

It is a bit unobvious that you are intending to mutate that member.

For what it's worth, we are doing something similar here: https://github.com/llvm/llvm-project/pull/170653/files#diff-e88204c0b3183c22166588028caaa5bc946c63fc9e90af696f60603325b1d08dR91

Alternatively, we could simply take a STARTUPINFOW & instead of STARTUPINFOEXW & in the parameter list.

STARTUPINFOEXW &startupinfoex is used in that function, we have to pass it as well.

Alternatively, we could simply take a STARTUPINFOW & instead of STARTUPINFOEXW & in the parameter list.

Happy to do that, it's going to increase verbosity a bit, but that's fine I think.

@charles-zablit
Copy link
Contributor Author

Merging this to fix the bots ASAP, I will open up a follow up PR to address #170653 (review).

@charles-zablit charles-zablit merged commit 5b87337 into llvm:main Dec 4, 2025
12 checks passed
@charles-zablit charles-zablit deleted the charles-zablit/lldb/windows/fix-reference-issue branch December 4, 2025 14:26
@charles-zablit
Copy link
Contributor Author

@compnerd I opened #170669 as a follow up.

kcloudy0717 pushed a commit to kcloudy0717/llvm-project that referenced this pull request Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants