LLVM 22.0.0git
|
Classes | |
class | Array |
An Array is a JSON array, which contains heterogeneous JSON values. More... | |
class | Object |
An Object is a JSON object, which maps strings to heterogenous JSON values. More... | |
class | ObjectKey |
ObjectKey is a used to capture keys in Object. More... | |
class | ObjectMapper |
Helper for mapping JSON objects onto protocol structs. More... | |
class | OStream |
json::OStream allows writing well-formed JSON without materializing all structures as json::Value ahead of time. More... | |
class | ParseError |
class | Path |
A "cursor" marking a position within a Value. More... | |
class | Value |
A Value is an JSON value of unknown type. More... |
Variables | |
template<typename T> | |
constexpr bool | is_uint_64_bit_v |
Definition at line 252 of file JSON.cpp.
References llvm::json::Value::Array, fixUTF8(), llvm::json::Value::Object, llvm::json::OStream::rawValue(), llvm::StringRef::size(), llvm::json::Value::String, llvm::StringRef::take_front(), and llvm::json::OStream::value().
Referenced by abbreviateChildren(), and llvm::json::Path::Root::printErrorContext().
Definition at line 278 of file JSON.cpp.
References abbreviate(), llvm::json::Value::Array, llvm::json::OStream::array(), llvm::json::OStream::attributeBegin(), llvm::json::OStream::attributeEnd(), I, llvm::json::Value::Object, llvm::json::OStream::object(), sortedElements(), and llvm::json::OStream::value().
Referenced by llvm::json::Path::Root::printErrorContext().
|
static |
Definition at line 573 of file JSON.cpp.
References llvm_unreachable.
std::string llvm::json::fixUTF8 | ( | llvm::StringRef | S | ) |
Replaces invalid UTF-8 sequences in S
with the replacement character (U+FFFD).
The returned string is valid UTF-8. This is much slower than isUTF8, so test that first.
Definition at line 700 of file JSON.cpp.
References llvm::ConvertUTF32toUTF8(), llvm::ConvertUTF8toUTF32(), llvm::StringRef::data(), llvm::lenientConversion, llvm::StringRef::size(), and llvm::strictConversion.
Referenced by abbreviate(), llvm::json::OStream::attributeBegin(), llvm::json::ObjectKey::ObjectKey(), llvm::json::ObjectKey::ObjectKey(), llvm::json::Value::Value(), and llvm::json::Value::Value().
|
inline |
Definition at line 73 of file IR2Vec.cpp.
References fromJSON(), and P.
bool llvm::json::fromJSON | ( | const Value & | E, |
std::map< std::string, T > & | Out, | ||
Path | P ) |
Definition at line 832 of file JSON.h.
References E(), fromJSON(), and P.
Definition at line 742 of file JSON.h.
Referenced by fromJSON(), fromJSON(), fromJSON(), fromJSON(), llvm::json::ObjectMapper::map(), llvm::json::ObjectMapper::map(), llvm::json::ObjectMapper::mapOptional(), and parse().
bool llvm::json::isUTF8 | ( | llvm::StringRef | S, |
size_t * | ErrOffset = nullptr ) |
Returns true if S
is valid UTF-8, which is required for use as JSON.
If it returns false, Offset
is set to a byte offset near the first error.
Definition at line 686 of file JSON.cpp.
References llvm::Data, llvm::StringRef::data(), llvm::isASCII(), llvm::isLegalUTF8String(), LLVM_LIKELY, and llvm::StringRef::size().
Referenced by llvm::json::OStream::attributeBegin(), llvm::json::ObjectKey::ObjectKey(), llvm::json::ObjectKey::ObjectKey(), llvm::json::Value::Value(), and llvm::json::Value::Value().
|
inline |
Serializes this Value to JSON, writing it to the provided stream.
The formatting is compact (no extra whitespace) and deterministic. For pretty-printing, use the formatv() format_provider below.
Definition at line 1108 of file JSON.h.
References llvm::json::OStream::value().
Expected< Value > llvm::json::parse | ( | llvm::StringRef | JSON | ) |
Parses the provided JSON source, or returns a ParseError.
The returned Value is self-contained and owns its strings (they do not refer to the original source).
Definition at line 675 of file JSON.cpp.
Referenced by llvm::MachO::getInterfaceFileFromJSON(), parse(), llvm::offloading::readPropertiesFromJSON(), and llvm::lsp::JSONTransport::run().
|
static |
Definition at line 717 of file JSON.cpp.
References llvm::CallingConv::C, llvm::Lower, and llvm::write_hex().
Referenced by llvm::json::OStream::attributeBegin(), and llvm::json::OStream::value().
std::vector< const Object::value_type * > llvm::json::sortedElements | ( | const Object & | O | ) |
Definition at line 238 of file JSON.cpp.
References E(), and llvm::sort().
Referenced by abbreviateChildren(), llvm::json::Path::Root::printErrorContext(), and llvm::json::OStream::value().
Definition at line 846 of file JSON.h.
References llvm::Value.