67 if (
size() <= Index) {
71 return (*
Array)[Index];
144 Stack.push_back(
StackLevel(Root, 0, (
size_t)-1));
156 if (!ReadObj.
get()) {
157 if (Multi && Stack.size() == 1) {
201 else if (Stack.back().Node.getKind() ==
Type::Array) {
203 auto &
Array = Stack.back().Node.getArray();
204 DestNode = &
Array[Stack.back().Index++];
206 auto &
Map = Stack.back().Node.getMap();
207 if (!Stack.back().MapEntry) {
209 Stack.back().MapKey =
Node;
210 Stack.back().MapEntry = &
Map[
Node];
214 DestNode = Stack.back().MapEntry;
215 Stack.back().MapEntry =
nullptr;
216 ++Stack.back().Index;
223 DocNode MapKey = !Stack.empty() && !Stack.back().MapKey.isEmpty()
224 ? Stack.back().MapKey
245 while (!Stack.empty()) {
246 if (Stack.back().MapEntry)
248 if (Stack.back().Index != Stack.back().End)
252 }
while (!Stack.empty());
275 {
Node, DocNode::MapTy::iterator(),
Node.getArray().begin(),
false});
280 {
Node,
Node.getMap().begin(), DocNode::ArrayTy::iterator(),
true});
309 while (!Stack.empty()) {
310 if (Stack.back().Node.getKind() ==
Type::Map) {
311 if (Stack.back().MapIt != Stack.back().Node.getMap().end())
314 if (Stack.back().ArrayIt != Stack.back().Node.getArray().end())
322 if (Stack.back().Node.getKind() ==
Type::Map) {
323 if (Stack.back().OnKey) {
325 Node = Stack.back().MapIt->first;
326 Stack.back().OnKey =
false;
328 Node = Stack.back().MapIt->second;
329 ++Stack.back().MapIt;
330 Stack.back().OnKey =
true;
333 Node = *Stack.back().ArrayIt;
334 ++Stack.back().ArrayIt;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static msgpack::DocNode getNode(msgpack::DocNode DN, msgpack::Type Type, MCValue Val)
This file declares a class that exposes a simple in-memory representation of a document of MsgPack ob...
This file contains a MessagePack writer.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
An efficient, type-erasing, non-owning reference to a callable.
LLVM_ABI DocNode & operator[](size_t Index)
Element access. This extends the array if necessary, with empty nodes.
A node in a MsgPack Document.
DocNode & operator=(const char *Val)
Convenience assignment operators.
Document * getDocument() const
MapDocNode getMapNode()
Create an empty Map node associated with this Document.
DocNode getEmptyNode()
Create an empty node associated with this Document.
DocNode & getRoot()
Get ref to the document's root element.
DocNode getNode()
Create a nil node associated with this Document.
ArrayDocNode getArrayNode()
Create an empty Array node associated with this Document.
LLVM_ABI void writeToBlob(std::string &Blob)
Write a MsgPack document to a binary MsgPack blob.
LLVM_ABI bool readFromBlob(StringRef Blob, bool Multi, function_ref< int(DocNode *DestNode, DocNode SrcNode, DocNode MapKey)> Merger=[](DocNode *DestNode, DocNode SrcNode, DocNode MapKey) { return -1;})
Read a document from a binary msgpack blob, merging into anything already in the Document.
MapTy::iterator find(DocNode Key)
LLVM_ABI DocNode & operator[](StringRef S)
Member access.
Reads MessagePack objects from memory, one at a time.
LLVM_ABI Expected< bool > read(Object &Obj)
Read one object from the input buffer, advancing past it.
Writes MessagePack objects to an output stream, one at a time.
LLVM_ABI void writeNil()
Write a Nil to the output stream.
LLVM_ABI void writeMapSize(uint32_t Size)
Write the header for a Map of the given size.
LLVM_ABI void writeArraySize(uint32_t Size)
Write the header for an Array of the given size.
LLVM_ABI void write(bool b)
Write a Boolean to the output stream.
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
void consumeError(Error Err)
Consume a Error without doing anything.
StackLevel(DocNode Node, size_t StartIndex, size_t Length, DocNode *MapEntry=nullptr)
DocNode::MapTy::iterator MapIt
DocNode::ArrayTy::iterator ArrayIt
MessagePack object, represented as a tagged union of C++ types.
int64_t Int
Value for Type::Int.
double Float
Value for Type::Float.
StringRef Raw
Value for Type::String and Type::Binary.
uint64_t UInt
Value for Type::Uint.
bool Bool
Value for Type::Boolean.
size_t Length
Value for Type::Array and Type::Map.