-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
Conversation
When building with MSVC 2019 using `std::future<llvm::Error>` causes a compile time build error. ``` C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(196): error C2248: 'llvm::Error::Error': cannot access protected member declared in class 'llvm::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/Error.h(181): note: see declaration of 'llvm::Error::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/FormatVariadicDetails.h(20): note: see declaration of 'llvm::Error' C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(193): note: while compiling class template member function 'std::_Associated_state<_Ty>::_Associated_state(std::_Deleter_base<_Ty> *)' with [ _Ty=llvm::Error ] C:\work\main\llvm-project\lldb\tools\lldb-dap\DAP.cpp(854): note: see reference to class template instantiation 'std::future<llvm::Error>' being compiled ``` To work around this, swapping to a lldb::SBError for now.
@llvm/pr-subscribers-lldb Author: John Harrison (ashgti) ChangesWhen building with MSVC 2019 using
To work around this, swapping to a lldb::SBError for now. Full diff: https://github.com/llvm/llvm-project/pull/137388.diff 1 Files Affected:
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 185b475cfcad6..1813d8f853cda 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -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.
@@ -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);
@@ -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([&]() {
@@ -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) {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, I wonder what the protected member is that the error is talking about. Anyway, this seems fine.
It seems to work with MSVC 2022, so I guess its something to do with the way |
It's the default constructor. I guess the implementation tries to default construct the object on some (maybe not dynamically reachable) code path. |
When building with MSVC 2019 using `std::future<llvm::Error>` causes a compile time build error. ``` C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(196): error C2248: 'llvm::Error::Error': cannot access protected member declared in class 'llvm::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/Error.h(181): note: see declaration of 'llvm::Error::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/FormatVariadicDetails.h(20): note: see declaration of 'llvm::Error' C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(193): note: while compiling class template member function 'std::_Associated_state<_Ty>::_Associated_state(std::_Deleter_base<_Ty> *)' with [ _Ty=llvm::Error ] C:\work\main\llvm-project\lldb\tools\lldb-dap\DAP.cpp(854): note: see reference to class template instantiation 'std::future<llvm::Error>' being compiled ``` To work around this, swapping to a lldb::SBError for now.
When building with MSVC 2019 using `std::future<llvm::Error>` causes a compile time build error. ``` C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(196): error C2248: 'llvm::Error::Error': cannot access protected member declared in class 'llvm::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/Error.h(181): note: see declaration of 'llvm::Error::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/FormatVariadicDetails.h(20): note: see declaration of 'llvm::Error' C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(193): note: while compiling class template member function 'std::_Associated_state<_Ty>::_Associated_state(std::_Deleter_base<_Ty> *)' with [ _Ty=llvm::Error ] C:\work\main\llvm-project\lldb\tools\lldb-dap\DAP.cpp(854): note: see reference to class template instantiation 'std::future<llvm::Error>' being compiled ``` To work around this, swapping to a lldb::SBError for now.
When building with MSVC 2019 using `std::future<llvm::Error>` causes a compile time build error. ``` C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(196): error C2248: 'llvm::Error::Error': cannot access protected member declared in class 'llvm::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/Error.h(181): note: see declaration of 'llvm::Error::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/FormatVariadicDetails.h(20): note: see declaration of 'llvm::Error' C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(193): note: while compiling class template member function 'std::_Associated_state<_Ty>::_Associated_state(std::_Deleter_base<_Ty> *)' with [ _Ty=llvm::Error ] C:\work\main\llvm-project\lldb\tools\lldb-dap\DAP.cpp(854): note: see reference to class template instantiation 'std::future<llvm::Error>' being compiled ``` To work around this, swapping to a lldb::SBError for now.
When building with MSVC 2019 using `std::future<llvm::Error>` causes a compile time build error. ``` C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(196): error C2248: 'llvm::Error::Error': cannot access protected member declared in class 'llvm::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/Error.h(181): note: see declaration of 'llvm::Error::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/FormatVariadicDetails.h(20): note: see declaration of 'llvm::Error' C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(193): note: while compiling class template member function 'std::_Associated_state<_Ty>::_Associated_state(std::_Deleter_base<_Ty> *)' with [ _Ty=llvm::Error ] C:\work\main\llvm-project\lldb\tools\lldb-dap\DAP.cpp(854): note: see reference to class template instantiation 'std::future<llvm::Error>' being compiled ``` To work around this, swapping to a lldb::SBError for now.
When building with MSVC 2019 using `std::future<llvm::Error>` causes a compile time build error. ``` C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(196): error C2248: 'llvm::Error::Error': cannot access protected member declared in class 'llvm::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/Error.h(181): note: see declaration of 'llvm::Error::Error' C:\work\main\llvm-project\llvm\include\llvm/Support/FormatVariadicDetails.h(20): note: see declaration of 'llvm::Error' C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(193): note: while compiling class template member function 'std::_Associated_state<_Ty>::_Associated_state(std::_Deleter_base<_Ty> *)' with [ _Ty=llvm::Error ] C:\work\main\llvm-project\lldb\tools\lldb-dap\DAP.cpp(854): note: see reference to class template instantiation 'std::future<llvm::Error>' being compiled ``` To work around this, swapping to a lldb::SBError for now.
When building with MSVC 2019 using
std::future<llvm::Error>
causes a compile time build error.To work around this, swapping to a lldb::SBError for now.