| 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/ADT/Hashing.h" |
| 15 | #include "llvm/ADT/SmallString.h" |
| 16 | #include "llvm/Support/ErrorHandling.h" |
| 17 | #include "llvm/Support/Format.h" |
| 18 | #include "llvm/Support/FormatVariadic.h" |
| 19 | #include "llvm/Support/JSON.h" |
| 20 | #include "llvm/Support/Path.h" |
| 21 | #include "llvm/Support/raw_ostream.h" |
| 22 | |
| 23 | using namespace mlir; |
| 24 | using namespace mlir::lsp; |
| 25 | |
| 26 | //===----------------------------------------------------------------------===// |
| 27 | // MLIRConvertBytecodeParams |
| 28 | //===----------------------------------------------------------------------===// |
| 29 | |
| 30 | bool mlir::lsp::fromJSON(const llvm::json::Value &value, |
| 31 | MLIRConvertBytecodeParams &result, |
| 32 | llvm::json::Path path) { |
| 33 | llvm::json::ObjectMapper o(value, path); |
| 34 | return o && o.map(Prop: "uri", Out&: result.uri); |
| 35 | } |
| 36 | |
| 37 | //===----------------------------------------------------------------------===// |
| 38 | // MLIRConvertBytecodeResult |
| 39 | //===----------------------------------------------------------------------===// |
| 40 | |
| 41 | llvm::json::Value mlir::lsp::toJSON(const MLIRConvertBytecodeResult &value) { |
| 42 | return llvm::json::Object{{.K: "output", .V: value.output}}; |
| 43 | } |
| 44 |
