[mlir-lsp] Initialize Reply::method member (#89857)
When debug level logging is enabled (by adding a call to
`Logger::setLogLevel(Logger::Level::Debug)`), the
`TransportInputTest.RequestWithInvalidParams` unit test logs:
```
[18:35:00.565] --> reply:(92)
```
The format string for this log statement is `"--> reply:{0}({1})"`,
where `{0}` is the original request's method name (that is, the method
name of the request being replied to), and `{1}` is the request ID.
However, because the `Reply` class never initializes its `method`
member, `{0}` is always empty. Initializing it results in the (nicer)
log error below:
```
I[18:35:00.565] --> reply:invalid-params-request(92)
```
Because this is only ever logged for now, its not possible to add a test
case for this. Future patches will rely on `method` being initialized,
however, and will add test cases for this path.
This commit is contained in:
@@ -51,12 +51,12 @@ private:
|
||||
|
||||
Reply::Reply(const llvm::json::Value &id, llvm::StringRef method,
|
||||
JSONTransport &transport, std::mutex &transportOutputMutex)
|
||||
: id(id), transport(&transport),
|
||||
: method(method), id(id), transport(&transport),
|
||||
transportOutputMutex(transportOutputMutex) {}
|
||||
|
||||
Reply::Reply(Reply &&other)
|
||||
: replied(other.replied.load()), id(std::move(other.id)),
|
||||
transport(other.transport),
|
||||
: method(other.method), replied(other.replied.load()),
|
||||
id(std::move(other.id)), transport(other.transport),
|
||||
transportOutputMutex(other.transportOutputMutex) {
|
||||
other.transport = nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user