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"
29 llvm::StringLiteral prop, T &out,
30 llvm::json::Path path) {
31 const llvm::json::Object *o = params.getAsObject();
35 auto *v = o->get(prop);
36 if (!v || v->getAsNull())
38 return fromJSON(*v, out, path.field(prop));
47 if (std::optional<StringRef> str = value.getAsString()) {
66 llvm::json::ObjectMapper o(value, path);
67 return o && o.map(
"uri", result.
uri) && o.map(
"kind", result.
kind);
75 return llvm::json::Object{{
"output", value.
output}};
static bool mapOptOrNull(const llvm::json::Value ¶ms, llvm::StringLiteral prop, T &out, llvm::json::Path path)
llvm::json::Value toJSON(const URIForFile &value)
Add support for JSON serialization.
PDLLViewOutputKind
The type of output to view from PDLL.
bool fromJSON(const llvm::json::Value &value, URIForFile &result, llvm::json::Path path)
Include the generated interface declarations.
Represents the parameters used when viewing the output of a PDLL file.
URIForFile uri
The URI of the document to view the output of.
PDLLViewOutputKind kind
The kind of output to generate.
Represents the result of viewing the output of a PDLL file.
std::string output
The string representation of the output.