| 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 | |
| 20 | bool llvm::lsp::fromJSON(const llvm::json::Value &value, |
| 21 | MLIRConvertBytecodeParams &result, |
| 22 | llvm::json::Path path) { |
| 23 | llvm::json::ObjectMapper o(value, path); |
| 24 | return o && o.map(Prop: "uri" , Out&: result.uri); |
| 25 | } |
| 26 | |
| 27 | //===----------------------------------------------------------------------===// |
| 28 | // MLIRConvertBytecodeResult |
| 29 | //===----------------------------------------------------------------------===// |
| 30 | |
| 31 | llvm::json::Value llvm::lsp::toJSON(const MLIRConvertBytecodeResult &value) { |
| 32 | return llvm::json::Object{{.K: "output" , .V: value.output}}; |
| 33 | } |
| 34 | |