MLIR  16.0.0git
Protocol.h
Go to the documentation of this file.
1 //===--- Protocol.h - Language Server Protocol Implementation ---*- C++ -*-===//
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 structs for LSP commands that are specific to the PDLL
10 // server.
11 //
12 // Each struct has a toJSON and fromJSON function, that converts between
13 // the struct and a JSON representation. (See JSON.h)
14 //
15 // Some structs also have operator<< serialization. This is for debugging and
16 // tests, and is not generally machine-readable.
17 //
18 //===----------------------------------------------------------------------===//
19 
20 #ifndef LIB_MLIR_TOOLS_MLIRPDLLLSPSERVER_PROTOCOL_H_
21 #define LIB_MLIR_TOOLS_MLIRPDLLLSPSERVER_PROTOCOL_H_
22 
23 #include "../lsp-server-support/Protocol.h"
24 
25 namespace mlir {
26 namespace lsp {
27 //===----------------------------------------------------------------------===//
28 // PDLLViewOutputParams
29 //===----------------------------------------------------------------------===//
30 
31 /// The type of output to view from PDLL.
32 enum class PDLLViewOutputKind {
33  AST,
34  MLIR,
35  CPP,
36 };
37 
38 /// Represents the parameters used when viewing the output of a PDLL file.
40  /// The URI of the document to view the output of.
42 
43  /// The kind of output to generate.
45 };
46 
47 /// Add support for JSON serialization.
48 bool fromJSON(const llvm::json::Value &value, PDLLViewOutputKind &result,
49  llvm::json::Path path);
50 bool fromJSON(const llvm::json::Value &value, PDLLViewOutputParams &result,
51  llvm::json::Path path);
52 
53 //===----------------------------------------------------------------------===//
54 // PDLLViewOutputResult
55 //===----------------------------------------------------------------------===//
56 
57 /// Represents the result of viewing the output of a PDLL file.
59  /// The string representation of the output.
60  std::string output;
61 };
62 
63 /// Add support for JSON serialization.
64 llvm::json::Value toJSON(const PDLLViewOutputResult &value);
65 
66 } // namespace lsp
67 } // namespace mlir
68 
69 #endif
static constexpr const bool value
URI in "file" scheme for a file.
Definition: Protocol.h:100
llvm::json::Value toJSON(const URIForFile &value)
Add support for JSON serialization.
Definition: Protocol.cpp:262
PDLLViewOutputKind
The type of output to view from PDLL.
Definition: Protocol.h:32
bool fromJSON(const llvm::json::Value &value, URIForFile &result, llvm::json::Path path)
Definition: Protocol.cpp:247
Include the generated interface declarations.
Represents the parameters used when viewing the output of a PDLL file.
Definition: Protocol.h:39
URIForFile uri
The URI of the document to view the output of.
Definition: Protocol.h:41
PDLLViewOutputKind kind
The kind of output to generate.
Definition: Protocol.h:44
Represents the result of viewing the output of a PDLL file.
Definition: Protocol.h:58
std::string output
The string representation of the output.
Definition: Protocol.h:60