Skip to content

[lldb-dap] Mitigate a build error on Windows. #137388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025
Merged
Changes from all commits
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
17 changes: 11 additions & 6 deletions lldb/tools/lldb-dap/DAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,10 @@ static std::optional<T> getArgumentsIfRequest(const Message &pm,
}

llvm::Error DAP::Loop() {
std::future<llvm::Error> queue_reader =
std::async(std::launch::async, [&]() -> llvm::Error {
// Can't use \a std::future<llvm::Error> because it doesn't compile on
// Windows.
std::future<lldb::SBError> queue_reader =
std::async(std::launch::async, [&]() -> lldb::SBError {
llvm::set_thread_name(transport.GetClientName() + ".transport_handler");
auto cleanup = llvm::make_scope_exit([&]() {
// Ensure we're marked as disconnecting when the reader exits.
Expand All @@ -867,8 +869,11 @@ llvm::Error DAP::Loop() {
continue;
}

if (llvm::Error err = next.takeError())
return err;
if (llvm::Error err = next.takeError()) {
lldb::SBError errWrapper;
errWrapper.SetErrorString(llvm::toString(std::move(err)).c_str());
return errWrapper;
}

if (const protocol::Request *req =
std::get_if<protocol::Request>(&*next);
Expand Down Expand Up @@ -906,7 +911,7 @@ llvm::Error DAP::Loop() {
m_queue_cv.notify_one();
}

return llvm::Error::success();
return lldb::SBError();
});

auto cleanup = llvm::make_scope_exit([&]() {
Expand All @@ -930,7 +935,7 @@ llvm::Error DAP::Loop() {
"unhandled packet");
}

return queue_reader.get();
return ToError(queue_reader.get());
}

lldb::SBError DAP::WaitForProcessToStop(std::chrono::seconds seconds) {
Expand Down
Loading