[Mlir-commits] [mlir] f3f6f22 - [mlir-lsp] Initialize Reply::method member (#89857)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Apr 24 12:44:16 PDT 2024
Author: Brian Gesiak
Date: 2024-04-24T15:44:07-04:00
New Revision: f3f6f22dfcced21116710a477c78e0739c942139
URL: https://github.com/llvm/llvm-project/commit/f3f6f22dfcced21116710a477c78e0739c942139
DIFF: https://github.com/llvm/llvm-project/commit/f3f6f22dfcced21116710a477c78e0739c942139.diff
LOG: [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.
Added:
Modified:
mlir/lib/Tools/lsp-server-support/Transport.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Tools/lsp-server-support/Transport.cpp b/mlir/lib/Tools/lsp-server-support/Transport.cpp
index 64dea35614c070..339c5f3825165d 100644
--- a/mlir/lib/Tools/lsp-server-support/Transport.cpp
+++ b/mlir/lib/Tools/lsp-server-support/Transport.cpp
@@ -51,12 +51,12 @@ class Reply {
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;
}
More information about the Mlir-commits
mailing list