15 #include "llvm/Support/ErrorHandling.h"
16 #include "llvm/Support/JSON.h"
24 llvm::StringLiteral prop, T &out,
25 llvm::json::Path path) {
26 const llvm::json::Object *o = params.getAsObject();
30 auto *v = o->get(prop);
31 if (!v || v->getAsNull())
33 return fromJSON(*v, out, path.field(prop));
42 if (std::optional<StringRef> str = value.getAsString()) {
61 llvm::json::ObjectMapper o(value, path);
62 return o && o.map(
"uri", result.
uri) && o.map(
"kind", result.
kind);
70 return llvm::json::Object{{
"output", value.
output}};
static bool mapOptOrNull(const llvm::json::Value ¶ms, llvm::StringLiteral prop, T &out, llvm::json::Path path)
bool fromJSON(const llvm::json::Value &value, PDLLViewOutputKind &result, llvm::json::Path path)
Add support for JSON serialization.
PDLLViewOutputKind
The type of output to view from PDLL.
llvm::json::Value toJSON(const PDLLViewOutputResult &value)
Add support for JSON serialization.
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.