source: Pass trivial dap::*Event by value

This commit is contained in:
Daniel Pfeifer
2025-07-15 20:21:48 +02:00
committed by Brad King
parent 0bcb8d6e3c
commit 99c10afc26
4 changed files with 11 additions and 21 deletions

View File

@@ -164,8 +164,7 @@ cmDebuggerAdapter::cmDebuggerAdapter(
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Threads
Session->registerHandler([this](dap::ThreadsRequest const& req) {
(void)req;
Session->registerHandler([this](dap::ThreadsRequest /*unused*/) {
std::unique_lock<std::mutex> lock(Mutex);
dap::ThreadsResponse response;
@@ -196,7 +195,7 @@ cmDebuggerAdapter::cmDebuggerAdapter(
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Scopes
Session->registerHandler([this](dap::ScopesRequest const& request)
Session->registerHandler([this](dap::ScopesRequest request)
-> dap::ResponseOrError<dap::ScopesResponse> {
std::unique_lock<std::mutex> lock(Mutex);
return DefaultThread->GetScopesResponse(request.frameId,
@@ -210,8 +209,7 @@ cmDebuggerAdapter::cmDebuggerAdapter(
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Pause
Session->registerHandler([this](dap::PauseRequest const& req) {
(void)req;
Session->registerHandler([this](dap::PauseRequest /*unused*/) {
PauseRequest.store(true);
return dap::PauseResponse();
});
@@ -286,8 +284,7 @@ cmDebuggerAdapter::cmDebuggerAdapter(
// The ConfigurationDone request is made by the client once all configuration
// requests have been made.
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_ConfigurationDone
Session->registerHandler([this](dap::ConfigurationDoneRequest const& req) {
(void)req;
Session->registerHandler([this](dap::ConfigurationDoneRequest /*unused*/) {
ConfigurationDoneEvent->Fire();
return dap::ConfigurationDoneResponse();
});

View File

@@ -25,8 +25,7 @@ cmDebuggerExceptionManager::cmDebuggerExceptionManager(
});
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_ExceptionInfo
DapSession->registerHandler([&](dap::ExceptionInfoRequest const& request) {
(void)request;
DapSession->registerHandler([&](dap::ExceptionInfoRequest /*unused*/) {
return HandleExceptionInfoRequest();
});

View File

@@ -83,16 +83,13 @@ bool runTest(std::function<bool(dap::Session&)> onThreadExitedEvent)
auto connection = std::make_shared<DebuggerLocalConnection>();
std::unique_ptr<dap::Session> client = dap::Session::create();
client->registerHandler([&](dap::InitializedEvent const& e) {
(void)e;
client->registerHandler([&](dap::InitializedEvent /*unused*/) {
initializedEventReceivedPromise.set_value(true);
});
client->registerHandler([&](dap::ExitedEvent const& e) {
(void)e;
client->registerHandler([&](dap::ExitedEvent /*unused*/) {
exitedEventReceivedPromise.set_value(true);
});
client->registerHandler([&](dap::TerminatedEvent const& e) {
(void)e;
client->registerHandler([&](dap::TerminatedEvent const& /*unused*/) {
terminatedEventReceivedPromise.set_value(true);
});
client->registerHandler([&](dap::ThreadEvent const& e) {

View File

@@ -76,16 +76,13 @@ bool testProtocolWithPipes()
#endif
std::unique_ptr<dap::Session> client = dap::Session::create();
client->registerHandler([&](dap::InitializedEvent const& e) {
(void)e;
client->registerHandler([&](dap::InitializedEvent /*unused*/) {
initializedEventReceivedPromise.set_value(true);
});
client->registerHandler([&](dap::ExitedEvent const& e) {
(void)e;
client->registerHandler([&](dap::ExitedEvent /*unused*/) {
exitedEventReceivedPromise.set_value(true);
});
client->registerHandler([&](dap::TerminatedEvent const& e) {
(void)e;
client->registerHandler([&](dap::TerminatedEvent const& /*unused*/) {
terminatedEventReceivedPromise.set_value(true);
});
client->registerHandler([&](dap::ThreadEvent const& e) {