[Mlir-commits] [mlir] [mlir-lsp] Support outgoing requests (PR #90078)

River Riddle llvmlistbot at llvm.org
Thu Apr 25 14:04:35 PDT 2024


================
@@ -117,21 +117,17 @@ bool MessageHandler::onCall(llvm::StringRef method, llvm::json::Value params,
 
 bool MessageHandler::onReply(llvm::json::Value id,
                              llvm::Expected<llvm::json::Value> result) {
-  // TODO: Add support for reply callbacks when support for outgoing messages is
-  // added. For now, we just log an error on any replies received.
-  Callback<llvm::json::Value> replyHandler =
-      [&id](llvm::Expected<llvm::json::Value> result) {
-        Logger::error(
-            "received a reply with ID {0}, but there was no such call", id);
-        if (!result)
-          llvm::consumeError(result.takeError());
-      };
-
-  // Log and run the reply handler.
-  if (result)
-    replyHandler(std::move(result));
-  else
-    replyHandler(result.takeError());
+  auto it = responseHandlers.find(debugString(id));
----------------
River707 wrote:

The access here needs to be guarded, given we could insert a reply while this is being accessed?

Should we drop the entry after the callback has been invoked? Do you know what clangd does in this case?

https://github.com/llvm/llvm-project/pull/90078


More information about the Mlir-commits mailing list