[Mlir-commits] [mlir] [LSP] Use std::string for storing the Reply method (PR #92464)

Walter Erquinigo llvmlistbot at llvm.org
Thu May 16 14:59:41 PDT 2024


https://github.com/walter-erquinigo created https://github.com/llvm/llvm-project/pull/92464

This was using a StringRef, which is very unsafe because the method name might just get disposed due to the async nature of the response.


>From 5bb25b3da163b28ac959e978a016401b0d47c3bd Mon Sep 17 00:00:00 2001
From: walter erquinigo <walter at modular.com>
Date: Thu, 16 May 2024 23:51:28 +0200
Subject: [PATCH] [LSP] Use std::string for storing the Reply method

This was using a StringRef, which is very unsafe because the method name might just get disposed due to the async nature of the response.
---
 mlir/lib/Tools/lsp-server-support/Transport.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Tools/lsp-server-support/Transport.cpp b/mlir/lib/Tools/lsp-server-support/Transport.cpp
index 1e90ab32281f5..ca7ffdf78d3a1 100644
--- a/mlir/lib/Tools/lsp-server-support/Transport.cpp
+++ b/mlir/lib/Tools/lsp-server-support/Transport.cpp
@@ -41,7 +41,7 @@ class Reply {
   void operator()(llvm::Expected<llvm::json::Value> reply);
 
 private:
-  StringRef method;
+  std::string method;
   std::atomic<bool> replied = {false};
   llvm::json::Value id;
   JSONTransport *transport;



More information about the Mlir-commits mailing list