1*f7b8a70eSRiver Riddle //===--- Protocol.cpp - Language Server Protocol Implementation -----------===// 2*f7b8a70eSRiver Riddle // 3*f7b8a70eSRiver Riddle // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*f7b8a70eSRiver Riddle // See https://llvm.org/LICENSE.txt for license information. 5*f7b8a70eSRiver Riddle // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*f7b8a70eSRiver Riddle // 7*f7b8a70eSRiver Riddle //===----------------------------------------------------------------------===// 8*f7b8a70eSRiver Riddle // 9*f7b8a70eSRiver Riddle // This file contains the serialization code for the MLIR specific LSP structs. 10*f7b8a70eSRiver Riddle // 11*f7b8a70eSRiver Riddle //===----------------------------------------------------------------------===// 12*f7b8a70eSRiver Riddle 13*f7b8a70eSRiver Riddle #include "Protocol.h" 14*f7b8a70eSRiver Riddle #include "llvm/ADT/Hashing.h" 15*f7b8a70eSRiver Riddle #include "llvm/ADT/SmallString.h" 16*f7b8a70eSRiver Riddle #include "llvm/Support/ErrorHandling.h" 17*f7b8a70eSRiver Riddle #include "llvm/Support/Format.h" 18*f7b8a70eSRiver Riddle #include "llvm/Support/FormatVariadic.h" 19*f7b8a70eSRiver Riddle #include "llvm/Support/JSON.h" 20*f7b8a70eSRiver Riddle #include "llvm/Support/Path.h" 21*f7b8a70eSRiver Riddle #include "llvm/Support/raw_ostream.h" 22*f7b8a70eSRiver Riddle 23*f7b8a70eSRiver Riddle using namespace mlir; 24*f7b8a70eSRiver Riddle using namespace mlir::lsp; 25*f7b8a70eSRiver Riddle 26*f7b8a70eSRiver Riddle //===----------------------------------------------------------------------===// 27*f7b8a70eSRiver Riddle // MLIRConvertBytecodeParams 28*f7b8a70eSRiver Riddle //===----------------------------------------------------------------------===// 29*f7b8a70eSRiver Riddle fromJSON(const llvm::json::Value & value,MLIRConvertBytecodeParams & result,llvm::json::Path path)30*f7b8a70eSRiver Riddlebool mlir::lsp::fromJSON(const llvm::json::Value &value, 31*f7b8a70eSRiver Riddle MLIRConvertBytecodeParams &result, 32*f7b8a70eSRiver Riddle llvm::json::Path path) { 33*f7b8a70eSRiver Riddle llvm::json::ObjectMapper o(value, path); 34*f7b8a70eSRiver Riddle return o && o.map("uri", result.uri); 35*f7b8a70eSRiver Riddle } 36*f7b8a70eSRiver Riddle 37*f7b8a70eSRiver Riddle //===----------------------------------------------------------------------===// 38*f7b8a70eSRiver Riddle // MLIRConvertBytecodeResult 39*f7b8a70eSRiver Riddle //===----------------------------------------------------------------------===// 40*f7b8a70eSRiver Riddle toJSON(const MLIRConvertBytecodeResult & value)41*f7b8a70eSRiver Riddlellvm::json::Value mlir::lsp::toJSON(const MLIRConvertBytecodeResult &value) { 42*f7b8a70eSRiver Riddle return llvm::json::Object{{"output", value.output}}; 43*f7b8a70eSRiver Riddle } 44