Skip to content

[LSP] Use std::string for storing the Reply method #92464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2024

Conversation

walter-erquinigo
Copy link
Member

@walter-erquinigo walter-erquinigo commented May 16, 2024

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.
This was causing weird characters being printed in the output logs.

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.
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels May 16, 2024
@llvmbot
Copy link
Member

llvmbot commented May 16, 2024

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-core

Author: Walter Erquinigo (walter-erquinigo)

Changes

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

@walter-erquinigo walter-erquinigo merged commit d90159a into llvm:main May 17, 2024
7 checks passed
@walter-erquinigo walter-erquinigo deleted the walter/string branch May 17, 2024 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:core MLIR Core Infrastructure mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants