Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lldb/source/Host/windows/ProcessLauncherWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,6 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
::CloseHandle(stderr_handle);
});

auto inherited_handles_or_err = GetInheritedHandles(
launch_info, startupinfoex, stdout_handle, stderr_handle, stdin_handle);
if (!inherited_handles_or_err) {
error = Status(inherited_handles_or_err.getError());
return HostProcess();
}
inherited_handles = *inherited_handles_or_err;

SIZE_T attributelist_size = 0;
InitializeProcThreadAttributeList(/*lpAttributeList=*/nullptr,
/*dwAttributeCount=*/1, /*dwFlags=*/0,
Expand All @@ -133,6 +125,14 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
auto delete_attributelist = llvm::make_scope_exit(
[&] { DeleteProcThreadAttributeList(startupinfoex.lpAttributeList); });

auto inherited_handles_or_err = GetInheritedHandles(
Copy link
Member

Choose a reason for hiding this comment

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

I know you're just moving existing code, but this does not conform to LLVM's guidelines regarding auto use. The type isn't obvious from the RHS. I guess the old code was closer to where inherited_handles is declared, but that begs the questions why this is written in C89-style with all the variables declared at the start of the function. Can you move this to line 134?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When #168729 eventually gets merged, inherited_handles will be assigned to in an if statement, and is later used outside of the scope of that if statement. I decided to just declare it at the top of the method as it was the case before #170301 was merged: https://github.com/llvm/llvm-project/pull/170301/files#diff-e88204c0b3183c22166588028caaa5bc946c63fc9e90af696f60603325b1d08dL116

Outside of the context of #168729, it does not make much sense, I reverted that change and moved it to line 134.

launch_info, startupinfoex, stdout_handle, stderr_handle, stdin_handle);
if (!inherited_handles_or_err) {
error = Status(inherited_handles_or_err.getError());
return HostProcess();
}
inherited_handles = *inherited_handles_or_err;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
inherited_handles = *inherited_handles_or_err;
std::vector<HANDLE> inherited_handles; = *inherited_handles_or_err;


const char *hide_console_var =
getenv("LLDB_LAUNCH_INFERIORS_WITHOUT_CONSOLE");
if (hide_console_var &&
Expand Down
Loading