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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu May 16 15:00:09 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-core

Author: Walter Erquinigo (walter-erquinigo)

<details>
<summary>Changes</summary>

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.


---
Full diff: https://github.com/llvm/llvm-project/pull/92464.diff


1 Files Affected:

- (modified) mlir/lib/Tools/lsp-server-support/Transport.cpp (+1-1) 


``````````diff
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;

``````````

</details>


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


More information about the Mlir-commits mailing list