[Lldb-commits] [lldb] [lldb-dap] Adding support for well typed events. (PR #130104)
Adrian Vogelsgesang via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 6 13:58:34 PST 2025
================
@@ -345,6 +356,10 @@ struct DAP {
request_handlers[Handler::getCommand()] = std::make_unique<Handler>(*this);
}
+ /// Registeres an event handler for sending Debug Adapter Protocol events.
+ template <typename Body>
+ OutgoingEvent<Body> RegisterEvent(llvm::StringLiteral Event);
----------------
vogelsgesang wrote:
what is the benefit of registering the events?
With the `static const char* eventType` proposed in the other comment, I think we could simply write
```
template<typename T>
concept EventBodyType = requires(T a)
{
{ T::eventType } -> std::is_same_v<const char*>;
};
template <EventBodyType E>
void SendEvent(E event) {
protocol::Event Evt;
Evt.event = E::eventType;
Evt.rawBody = std::move(B);
SendJSON(std::move(Evt));
}
```
https://github.com/llvm/llvm-project/pull/130104
More information about the lldb-commits
mailing list