Skip to content

Commit f3f6f22

Browse files
authored
[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.
1 parent 712d7db commit f3f6f22

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mlir/lib/Tools/lsp-server-support/Transport.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ class Reply {
5151

5252
Reply::Reply(const llvm::json::Value &id, llvm::StringRef method,
5353
JSONTransport &transport, std::mutex &transportOutputMutex)
54-
: id(id), transport(&transport),
54+
: method(method), id(id), transport(&transport),
5555
transportOutputMutex(transportOutputMutex) {}
5656

5757
Reply::Reply(Reply &&other)
58-
: replied(other.replied.load()), id(std::move(other.id)),
59-
transport(other.transport),
58+
: method(other.method), replied(other.replied.load()),
59+
id(std::move(other.id)), transport(other.transport),
6060
transportOutputMutex(other.transportOutputMutex) {
6161
other.transport = nullptr;
6262
}

0 commit comments

Comments
 (0)