LLVM  14.0.0git
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
llvm::msgpack::DocNode Class Reference

A node in a MsgPack Document. More...

#include "llvm/BinaryFormat/MsgPackDocument.h"

Inheritance diagram for llvm::msgpack::DocNode:
Inheritance graph
[legend]
Collaboration diagram for llvm::msgpack::DocNode:
Collaboration graph
[legend]

Public Types

typedef std::map< DocNode, DocNodeMapTy
 
typedef std::vector< DocNodeArrayTy
 

Public Member Functions

 DocNode ()
 
bool isMap () const
 
bool isArray () const
 
bool isScalar () const
 
bool isString () const
 
bool isEmpty () const
 
Type getKind () const
 
DocumentgetDocument () const
 
int64_t & getInt ()
 
uint64_tgetUInt ()
 
bool & getBool ()
 
doublegetFloat ()
 
int64_t getInt () const
 
uint64_t getUInt () const
 
bool getBool () const
 
double getFloat () const
 
StringRef getString () const
 
ArrayDocNodegetArray (bool Convert=false)
 Get an ArrayDocNode for an array node. More...
 
MapDocNodegetMap (bool Convert=false)
 Get a MapDocNode for a map node. More...
 
std::string toString () const
 Convert this node to a string, assuming it is scalar. More...
 
StringRef fromString (StringRef S, StringRef Tag="")
 Convert the StringRef and use it to set this DocNode (assuming scalar). More...
 
DocNodeoperator= (const char *Val)
 Convenience assignment operators. More...
 
DocNodeoperator= (StringRef Val)
 
DocNodeoperator= (bool Val)
 
DocNodeoperator= (int Val)
 
DocNodeoperator= (unsigned Val)
 
DocNodeoperator= (int64_t Val)
 
DocNodeoperator= (uint64_t Val)
 

Protected Attributes

union {
   int64_t   Int
 
   uint64_t   UInt
 
   bool   Bool
 
   double   Float
 
   StringRef   Raw
 
   ArrayTy *   Array
 
   MapTy *   Map
 
}; 
 

Friends

bool operator< (const DocNode &Lhs, const DocNode &Rhs)
 Comparison operator, used for map keys. More...
 
bool operator== (const DocNode &Lhs, const DocNode &Rhs)
 Equality operator. More...
 
bool operator!= (const DocNode &Lhs, const DocNode &Rhs)
 Inequality operator. More...
 

Detailed Description

A node in a MsgPack Document.

This is a simple copyable and passable-by-value type that does not own any memory.

Definition at line 38 of file MsgPackDocument.h.

Member Typedef Documentation

◆ ArrayTy

Definition at line 43 of file MsgPackDocument.h.

◆ MapTy

Definition at line 42 of file MsgPackDocument.h.

Constructor & Destructor Documentation

◆ DocNode()

llvm::msgpack::DocNode::DocNode ( )
inline

Definition at line 67 of file MsgPackDocument.h.

Member Function Documentation

◆ fromString()

StringRef DocNode::fromString ( StringRef  S,
StringRef  Tag = "" 
)

Convert the StringRef and use it to set this DocNode (assuming scalar).

If it is a string, copy the string into the Document's strings list so we do not rely on S having a lifetime beyond this call. Tag is "" or a YAML tag.

Definition at line 69 of file MsgPackDocumentYAML.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ getArray()

ArrayDocNode& llvm::msgpack::DocNode::getArray ( bool  Convert = false)
inline

Get an ArrayDocNode for an array node.

If Convert, convert the node to an array node if necessary.

Definition at line 129 of file MsgPackDocument.h.

References llvm::msgpack::Array, assert(), and getKind().

Referenced by llvm::AMDGPU::HSAMD::MetadataStreamerV3::emitKernel().

◆ getBool() [1/2]

bool& llvm::msgpack::DocNode::getBool ( )
inline

Definition at line 92 of file MsgPackDocument.h.

References assert(), Bool, llvm::msgpack::Boolean, and getKind().

◆ getBool() [2/2]

bool llvm::msgpack::DocNode::getBool ( ) const
inline

Definition at line 112 of file MsgPackDocument.h.

References assert(), Bool, llvm::msgpack::Boolean, and getKind().

◆ getDocument()

Document* llvm::msgpack::DocNode::getDocument ( ) const
inline

◆ getFloat() [1/2]

double& llvm::msgpack::DocNode::getFloat ( )
inline

Definition at line 97 of file MsgPackDocument.h.

References assert(), llvm::msgpack::Float, Float, and getKind().

◆ getFloat() [2/2]

double llvm::msgpack::DocNode::getFloat ( ) const
inline

Definition at line 117 of file MsgPackDocument.h.

References assert(), llvm::msgpack::Float, Float, and getKind().

◆ getInt() [1/2]

int64_t& llvm::msgpack::DocNode::getInt ( )
inline

Definition at line 82 of file MsgPackDocument.h.

References assert(), getKind(), llvm::msgpack::Int, and Int.

◆ getInt() [2/2]

int64_t llvm::msgpack::DocNode::getInt ( ) const
inline

Definition at line 102 of file MsgPackDocument.h.

References assert(), getKind(), llvm::msgpack::Int, and Int.

◆ getKind()

Type llvm::msgpack::DocNode::getKind ( ) const
inline

◆ getMap()

MapDocNode& llvm::msgpack::DocNode::getMap ( bool  Convert = false)
inline

Get a MapDocNode for a map node.

If Convert, convert the node to a map node if necessary.

Definition at line 140 of file MsgPackDocument.h.

References assert(), getKind(), and llvm::msgpack::Map.

Referenced by llvm::AMDGPU::HSAMD::V3::MetadataVerifier::verify().

◆ getString()

StringRef llvm::msgpack::DocNode::getString ( ) const
inline

Definition at line 122 of file MsgPackDocument.h.

References assert(), getKind(), Raw, and llvm::msgpack::String.

◆ getUInt() [1/2]

uint64_t& llvm::msgpack::DocNode::getUInt ( )
inline

Definition at line 87 of file MsgPackDocument.h.

References assert(), getKind(), llvm::msgpack::UInt, and UInt.

◆ getUInt() [2/2]

uint64_t llvm::msgpack::DocNode::getUInt ( ) const
inline

Definition at line 107 of file MsgPackDocument.h.

References assert(), getKind(), llvm::msgpack::UInt, and UInt.

◆ isArray()

bool llvm::msgpack::DocNode::isArray ( ) const
inline

Definition at line 71 of file MsgPackDocument.h.

References llvm::msgpack::Array, and getKind().

Referenced by isScalar().

◆ isEmpty()

bool llvm::msgpack::DocNode::isEmpty ( ) const
inline

Definition at line 78 of file MsgPackDocument.h.

References llvm::msgpack::Empty, and getKind().

◆ isMap()

bool llvm::msgpack::DocNode::isMap ( ) const
inline

Definition at line 70 of file MsgPackDocument.h.

References getKind(), and llvm::msgpack::Map.

Referenced by isScalar(), and llvm::AMDGPU::HSAMD::V3::MetadataVerifier::verify().

◆ isScalar()

bool llvm::msgpack::DocNode::isScalar ( ) const
inline

Definition at line 72 of file MsgPackDocument.h.

References isArray(), and isMap().

◆ isString()

bool llvm::msgpack::DocNode::isString ( ) const
inline

Definition at line 73 of file MsgPackDocument.h.

References getKind(), and llvm::msgpack::String.

◆ operator=() [1/7]

DocNode & DocNode::operator= ( bool  Val)

Definition at line 83 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [2/7]

DocNode& llvm::msgpack::DocNode::operator= ( const char *  Val)
inline

Convenience assignment operators.

This only works if the destination DocNode has an associated Document, i.e. it was not constructed using the default constructor. The string one does not copy, so the string must remain valid for the lifetime of the Document. Use fromString to avoid that restriction.

Definition at line 202 of file MsgPackDocument.h.

◆ operator=() [3/7]

DocNode & DocNode::operator= ( int  Val)

Definition at line 87 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [4/7]

DocNode & DocNode::operator= ( int64_t  Val)

Definition at line 95 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [5/7]

DocNode & DocNode::operator= ( StringRef  Val)

Definition at line 79 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [6/7]

DocNode & DocNode::operator= ( uint64_t  Val)

Definition at line 99 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [7/7]

DocNode & DocNode::operator= ( unsigned  Val)

Definition at line 91 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ toString()

std::string DocNode::toString ( ) const

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const DocNode Lhs,
const DocNode Rhs 
)
friend

Inequality operator.

Definition at line 185 of file MsgPackDocument.h.

◆ operator<

bool operator< ( const DocNode Lhs,
const DocNode Rhs 
)
friend

Comparison operator, used for map keys.

Definition at line 150 of file MsgPackDocument.h.

◆ operator==

bool operator== ( const DocNode Lhs,
const DocNode Rhs 
)
friend

Equality operator.

Definition at line 180 of file MsgPackDocument.h.

Member Data Documentation

◆ @146

union { ... }

◆ Array

ArrayTy* llvm::msgpack::DocNode::Array

◆ Bool

bool llvm::msgpack::DocNode::Bool

Definition at line 57 of file MsgPackDocument.h.

Referenced by getBool(), and toString().

◆ Float

double llvm::msgpack::DocNode::Float

Definition at line 58 of file MsgPackDocument.h.

Referenced by getFloat(), and toString().

◆ Int

int64_t llvm::msgpack::DocNode::Int

Definition at line 55 of file MsgPackDocument.h.

Referenced by getInt(), and toString().

◆ Map

MapTy* llvm::msgpack::DocNode::Map

◆ Raw

StringRef llvm::msgpack::DocNode::Raw

Definition at line 59 of file MsgPackDocument.h.

Referenced by getString(), and toString().

◆ UInt

uint64_t llvm::msgpack::DocNode::UInt

Definition at line 56 of file MsgPackDocument.h.

Referenced by getUInt(), and toString().


The documentation for this class was generated from the following files: