MLIR 22.0.0git
Protocol.cpp
Go to the documentation of this file.
1//===--- Protocol.cpp - Language Server Protocol Implementation -----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the serialization code for the MLIR specific LSP structs.
10//
11//===----------------------------------------------------------------------===//
12
13#include "Protocol.h"
14#include "llvm/Support/JSON.h"
15
16//===----------------------------------------------------------------------===//
17// MLIRConvertBytecodeParams
18//===----------------------------------------------------------------------===//
19
20bool llvm::lsp::fromJSON(const llvm::json::Value &value,
22 llvm::json::Path path) {
23 llvm::json::ObjectMapper o(value, path);
24 return o && o.map("uri", result.uri);
25}
26
27//===----------------------------------------------------------------------===//
28// MLIRConvertBytecodeResult
29//===----------------------------------------------------------------------===//
30
31llvm::json::Value llvm::lsp::toJSON(const MLIRConvertBytecodeResult &value) {
32 return llvm::json::Object{{"output", value.output}};
33}
llvm::json::Value toJSON(const MLIRConvertBytecodeResult &value)
Add support for JSON serialization.
Definition Protocol.cpp:31
bool fromJSON(const llvm::json::Value &value, MLIRConvertBytecodeParams &result, llvm::json::Path path)
Add support for JSON serialization.
Definition Protocol.cpp:20
This class represents the parameters used when converting between MLIR's bytecode and textual format.
Definition Protocol.h:33
This class represents the result of converting between MLIR's bytecode and textual format.
Definition Protocol.h:48
std::string output
The resultant output of the conversion.
Definition Protocol.h:50