================
@@ -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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to