[Mlir-commits] [mlir] [mlir-lsp] Abstract input and output of the `JSONTransport` (PR #129320)

River Riddle llvmlistbot at llvm.org
Fri Feb 28 13:46:49 PST 2025


================
@@ -43,14 +43,86 @@ enum JSONStreamStyle {
   Delimited
 };
 
+/// An abstract class used by the JSONTransport to read JSON message.
+class JSONTransportInput {
+public:
+  explicit JSONTransportInput(JSONStreamStyle style = JSONStreamStyle::Standard)
+      : style(style) {}
+  virtual ~JSONTransportInput() = default;
+
+  virtual bool getError() const = 0;
+  virtual bool isEndOfInput() const = 0;
+
+  /// Read in a message from the input stream.
+  virtual LogicalResult readMessage(std::string &json) {
----------------
River707 wrote:

Why virtual here? If we already accept and dispatch on the stream style, I don't see this should be overridable.

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


More information about the Mlir-commits mailing list