21 for (
const auto &[CategoryName, PropSet] : PSRegistry) {
22 auto PropSetCapture = PropSet;
24 for (
const auto &[PropName, PropVal] : PropSetCapture) {
25 switch (PropVal.index()) {
27 J.
attribute(PropName, std::get<uint32_t>(PropVal));
51 if (std::optional<uint64_t> Val = PropValueVal.
getAsUINT64())
54 if (std::optional<StringRef> Val = PropValueVal.
getAsString()) {
55 std::vector<char> Decoded;
70 if (
Error E = V.takeError())
76 "error while deserializing property set registry: "
77 "expected JSON object, got {0}",
80 for (
const auto &[CategoryName,
Value] : *O) {
84 "expected JSON array, got {1}",
85 CategoryName.str(),
Value);
88 for (
const auto &[PropName, PropValueVal] : *PropSetVal) {
92 "error while deserializing property {0} in property set {1}: {2}",
93 PropName.str(), CategoryName.str(),
toString(std::move(E)));
96 PropSet.try_emplace(PropName.str(), std::move(*Prop));
97 assert(Inserted &&
"Property already exists in PropertySet");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file supports working with JSON data.
Expected< PropertyValue > readPropertyValueFromJSON(const json::Value &PropValueVal)
auto createStringErrorV(Ts &&...Args)
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
StringRef getBuffer() const
LLVM Value Representation.
json::OStream allows writing well-formed JSON without materializing all structures as json::Value ahe...
void object(Block Contents)
Emit an object whose elements are emitted in the provided Block.
void attributeObject(llvm::StringRef Key, Block Contents)
Emit an attribute whose value is an object with attributes from the Block.
void attribute(llvm::StringRef Key, const Value &Contents)
Emit an attribute whose value is self-contained (number, vector<int> etc).
An Object is a JSON object, which maps strings to heterogenous JSON values.
A Value is an JSON value of unknown type.
std::optional< uint64_t > getAsUINT64() const
std::optional< llvm::StringRef > getAsString() const
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ABI llvm::Expected< Value > parse(llvm::StringRef JSON)
Parses the provided JSON source, or returns a ParseError.
LLVM_ABI Expected< PropertySetRegistry > readPropertiesFromJSON(MemoryBufferRef Buf)
std::map< std::string, PropertySet > PropertySetRegistry
LLVM_ABI void writePropertiesToJSON(const PropertySetRegistry &P, raw_ostream &O)
SmallVector< unsigned char, 0 > ByteArray
std::variant< uint32_t, ByteArray > PropertyValue
std::map< std::string, PropertyValue > PropertySet
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
std::string encodeBase64(InputBytes const &Bytes)
LLVM_ABI llvm::Error decodeBase64(llvm::StringRef Input, std::vector< char > &Output)
std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)