summaryrefslogtreecommitdiff
path: root/mlir/lib/Tools/mlir-lsp-server/Protocol.h
blob: d910780e1ee9210c7759c67b302d2b99936c8033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//===--- Protocol.h - Language Server Protocol Implementation ---*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains structs for LSP commands that are specific to the MLIR
// server.
//
// Each struct has a toJSON and fromJSON function, that converts between
// the struct and a JSON representation. (See JSON.h)
//
// Some structs also have operator<< serialization. This is for debugging and
// tests, and is not generally machine-readable.
//
//===----------------------------------------------------------------------===//

#ifndef LIB_MLIR_TOOLS_MLIRLSPSERVER_PROTOCOL_H_
#define LIB_MLIR_TOOLS_MLIRLSPSERVER_PROTOCOL_H_

#include "mlir/Tools/lsp-server-support/Protocol.h"

namespace mlir {
namespace lsp {
//===----------------------------------------------------------------------===//
// MLIRConvertBytecodeParams
//===----------------------------------------------------------------------===//

/// This class represents the parameters used when converting between MLIR's
/// bytecode and textual format.
struct MLIRConvertBytecodeParams {
  /// The input file containing the bytecode or textual format.
  URIForFile uri;
};

/// Add support for JSON serialization.
bool fromJSON(const llvm::json::Value &value, MLIRConvertBytecodeParams &result,
              llvm::json::Path path);

//===----------------------------------------------------------------------===//
// MLIRConvertBytecodeResult
//===----------------------------------------------------------------------===//

/// This class represents the result of converting between MLIR's bytecode and
/// textual format.
struct MLIRConvertBytecodeResult {
  /// The resultant output of the conversion.
  std::string output;
};

/// Add support for JSON serialization.
llvm::json::Value toJSON(const MLIRConvertBytecodeResult &value);

} // namespace lsp
} // namespace mlir

#endif