17 #ifndef LLVM_BINARYFORMAT_MSGPACKDOCUMENT_H 18 #define LLVM_BINARYFORMAT_MSGPACKDOCUMENT_H 42 typedef std::map<DocNode, DocNode>
MapTy;
74 bool isEmpty()
const {
return !KindAndDoc; }
149 if (Lhs.KindAndDoc != Rhs.KindAndDoc) {
177 return !(Lhs < Rhs) && !(Rhs < Lhs);
192 void convertToArray();
206 MapTy::iterator
end() {
return Map->end(); }
242 std::vector<std::unique_ptr<DocNode::MapTy>> Maps;
243 std::vector<std::unique_ptr<DocNode::ArrayTy>> Arrays;
244 std::vector<std::unique_ptr<char[]>> Strings;
253 bool HexMode =
false;
259 KindAndDocs[
T] = {
this,
Type(
T)};
266 void clear() { getRoot() = getNode(); }
335 Maps.push_back(std::unique_ptr<DocNode::MapTy>(
new DocNode::MapTy));
336 N.Map = Maps.back().get();
344 N.Array = Arrays.back().get();
356 bool readFromBlob(
StringRef Blob,
bool Multi);
359 void writeToBlob(std::string &Blob);
364 Strings.push_back(std::unique_ptr<
char[]>(
new char[S.
size()]));
365 memcpy(&Strings.back()[0], S.
data(), S.
size());
385 #endif // LLVM_BINARYFORMAT_MSGPACKDOCUMENT_H Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
DocNode & getRoot()
Get ref to the document's root element.
void setHexMode(bool Val=true)
Set whether YAML output uses hex for UInt. Default off.
This class represents lattice values for constants.
The kind of a DocNode and its owning Document.
Document * getDocument() const
DocNode getNode(unsigned V)
Create a UInt node associated with this Document.
DocNode getNode(bool V)
Create a Boolean node associated with this Document.
A DocNode that is an array.
DocNode getNode(StringRef V, bool Copy=false)
Create a String node associated with this Document.
DocNode getNode(int64_t V)
Create an Int node associated with this Document.
StringRef addString(StringRef S)
Copy a string into the Document's strings list, and return the copy that is owned by the Document...
std::string toString(Error E)
Write all error messages (if any) in E to a string.
MapDocNode & getMap(bool Convert=false)
Get a MapDocNode for a map node.
DocNode getNode(const char *V, bool Copy=false)
Create a String node associated with this Document.
std::error_code fromString(std::string String, Metadata &HSAMetadata)
Converts String to HSAMetadata.
ArrayTy::iterator begin()
DocNode getNode()
Create a nil node associated with this Document.
friend bool operator==(const DocNode &Lhs, const DocNode &Rhs)
Equality operator.
StringRef getString() const
LLVM_NODISCARD size_t size() const
size - Get the string size.
ArrayDocNode getArrayNode()
Create an empty Array node associated with this Document.
void push_back(DocNode N)
MapTy::iterator find(DocNode Key)
std::vector< DocNode > ArrayTy
DocNode getNode(int V)
Create an Int node associated with this Document.
std::map< DocNode, DocNode > MapTy
ArrayDocNode & getArray(bool Convert=false)
Get an ArrayDocNode for an array node.
auto find(R &&Range, const T &Val) -> decltype(adl_begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
MapDocNode getMapNode()
Create an empty Map node associated with this Document.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is a MessagePack reader.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
friend bool operator<(const DocNode &Lhs, const DocNode &Rhs)
Comparison operator, used for map keys.
Simple in-memory representation of a document of msgpack objects with ability to find and create arra...
static void clear(coro::Shape &Shape)
DocNode getNode(uint64_t V)
Create a UInt node associated with this Document.
void clear()
Restore the Document to an empty state.
DocNode getNode(double V)
Create a Float node associated with this Document.
static bool isArray(AllocaInst *AI)
Determine whether this alloca is either a VLA or an array.
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
A node in a MsgPack Document.
bool getHexMode() const
Get Hexmode flag.