LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Namespaces | Macros | Functions
YAMLTraits.h File Reference
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/YAMLParser.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
#include "llvm/Support/type_traits.h"
Include dependency graph for YAMLTraits.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  llvm::yaml::MappingTraits< T >
 
struct  llvm::yaml::ScalarEnumerationTraits< T >
 
struct  llvm::yaml::ScalarBitSetTraits< T >
 
struct  llvm::yaml::ScalarTraits< T >
 
struct  llvm::yaml::SequenceTraits< T >
 
struct  llvm::yaml::DocumentListTraits< T >
 
struct  llvm::yaml::SameType< T, T >
 
struct  llvm::yaml::MissingTrait< T >
 
struct  llvm::yaml::has_ScalarEnumerationTraits< T >
 
struct  llvm::yaml::has_ScalarBitSetTraits< T >
 
struct  llvm::yaml::has_ScalarTraits< T >
 
struct  llvm::yaml::has_MappingTraits< T >
 
struct  llvm::yaml::has_SequenceMethodTraits< T >
 
class  llvm::yaml::has_FlowTraits< T, Enabled >
 
struct  llvm::yaml::has_FlowTraits< T, true >
 
struct  llvm::yaml::has_FlowTraits< T, true >::Fallback
 
struct  llvm::yaml::has_FlowTraits< T, true >::Derived
 
struct  llvm::yaml::has_SequenceTraits< T >
 
struct  llvm::yaml::has_DocumentListTraits< T >
 
struct  llvm::yaml::missingTraits< T >
 
class  llvm::yaml::IO
 
struct  llvm::yaml::ScalarTraits< bool >
 
struct  llvm::yaml::ScalarTraits< StringRef >
 
struct  llvm::yaml::ScalarTraits< uint8_t >
 
struct  llvm::yaml::ScalarTraits< uint16_t >
 
struct  llvm::yaml::ScalarTraits< uint32_t >
 
struct  llvm::yaml::ScalarTraits< uint64_t >
 
struct  llvm::yaml::ScalarTraits< int8_t >
 
struct  llvm::yaml::ScalarTraits< int16_t >
 
struct  llvm::yaml::ScalarTraits< int32_t >
 
struct  llvm::yaml::ScalarTraits< int64_t >
 
struct  llvm::yaml::ScalarTraits< float >
 
struct  llvm::yaml::ScalarTraits< double >
 
struct  llvm::yaml::MappingNormalization< TNorm, TFinal >
 
struct  llvm::yaml::MappingNormalizationHeap< TNorm, TFinal >
 
class  llvm::yaml::Input
 
class  llvm::yaml::Output
 
struct  llvm::yaml::ScalarTraits< Hex8 >
 
struct  llvm::yaml::ScalarTraits< Hex16 >
 
struct  llvm::yaml::ScalarTraits< Hex32 >
 
struct  llvm::yaml::ScalarTraits< Hex64 >
 

Namespaces

 llvm
 List of target independent CodeGen pass IDs.
 
 llvm::yaml
 

Macros

#define LLVM_YAML_STRONG_TYPEDEF(_base, _type)
 
#define LLVM_YAML_IS_SEQUENCE_VECTOR(_type)
 
#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(_type)
 
#define LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(_type)
 

Functions

template<typename T >
llvm::enable_if_c
< has_ScalarEnumerationTraits
< T >::value, void >::type 
llvm::yaml::yamlize (IO &io, T &Val, bool)
 
template<typename T >
llvm::enable_if_c
< has_ScalarBitSetTraits< T >
::value, void >::type 
llvm::yaml::yamlize (IO &io, T &Val, bool)
 
template<typename T >
llvm::enable_if_c
< has_ScalarTraits< T >::value,
void >::type 
llvm::yaml::yamlize (IO &io, T &Val, bool)
 
template<typename T >
llvm::enable_if_c
< has_MappingTraits< T >
::value, void >::type 
llvm::yaml::yamlize (IO &io, T &Val, bool)
 
template<typename T >
llvm::enable_if_c
< missingTraits< T >::value,
void >::type 
llvm::yaml::yamlize (IO &io, T &Val, bool)
 
template<typename T >
llvm::enable_if_c
< has_SequenceTraits< T >
::value, void >::type 
llvm::yaml::yamlize (IO &io, T &Seq, bool)
 
template<typename T >
llvm::enable_if_c
< has_DocumentListTraits< T >
::value, Input & >::type 
llvm::yaml::operator>> (Input &yin, T &docList)
 
template<typename T >
llvm::enable_if_c
< has_MappingTraits< T >
::value, Input & >::type 
llvm::yaml::operator>> (Input &yin, T &docMap)
 
template<typename T >
llvm::enable_if_c
< has_SequenceTraits< T >
::value, Input & >::type 
llvm::yaml::operator>> (Input &yin, T &docSeq)
 
template<typename T >
llvm::enable_if_c
< missingTraits< T >::value,
Input & >::type 
llvm::yaml::operator>> (Input &yin, T &docSeq)
 
template<typename T >
llvm::enable_if_c
< has_DocumentListTraits< T >
::value, Output & >::type 
llvm::yaml::operator<< (Output &yout, T &docList)
 
template<typename T >
llvm::enable_if_c
< has_MappingTraits< T >
::value, Output & >::type 
llvm::yaml::operator<< (Output &yout, T &map)
 
template<typename T >
llvm::enable_if_c
< has_SequenceTraits< T >
::value, Output & >::type 
llvm::yaml::operator<< (Output &yout, T &seq)
 
template<typename T >
llvm::enable_if_c
< missingTraits< T >::value,
Output & >::type 
llvm::yaml::operator<< (Output &yout, T &seq)
 

Macro Definition Documentation

#define LLVM_YAML_IS_DOCUMENT_LIST_VECTOR (   _type)
Value:
namespace llvm { \
namespace yaml { \
template<> \
struct DocumentListTraits< std::vector<_type> > { \
static size_t size(IO &io, std::vector<_type> &seq) { \
return seq.size(); \
} \
static _type& element(IO &io, std::vector<_type> &seq, size_t index) {\
if ( index >= seq.size() ) \
seq.resize(index+1); \
return seq[index]; \
} \
}; \
} \
}
* if(!EatIfPresent(lltok::kw_thread_local)) return false

Utility for declaring that a std::vector of a particular type should be considered a YAML document list.

Definition at line 1089 of file YAMLTraits.h.

#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR (   _type)
Value:
namespace llvm { \
namespace yaml { \
template<> \
struct SequenceTraits< std::vector<_type> > { \
static size_t size(IO &io, std::vector<_type> &seq) { \
return seq.size(); \
} \
static _type& element(IO &io, std::vector<_type> &seq, size_t index) {\
if ( index >= seq.size() ) \
seq.resize(index+1); \
return seq[index]; \
} \
static const bool flow = true; \
}; \
} \
}
* if(!EatIfPresent(lltok::kw_thread_local)) return false

Utility for declaring that a std::vector of a particular type should be considered a YAML flow sequence.

Definition at line 1069 of file YAMLTraits.h.

#define LLVM_YAML_IS_SEQUENCE_VECTOR (   _type)
Value:
namespace llvm { \
namespace yaml { \
template<> \
struct SequenceTraits< std::vector<_type> > { \
static size_t size(IO &io, std::vector<_type> &seq) { \
return seq.size(); \
} \
static _type& element(IO &io, std::vector<_type> &seq, size_t index) {\
if ( index >= seq.size() ) \
seq.resize(index+1); \
return seq[index]; \
} \
}; \
} \
}
* if(!EatIfPresent(lltok::kw_thread_local)) return false

Utility for declaring that a std::vector of a particular type should be considered a YAML sequence.

Definition at line 1050 of file YAMLTraits.h.

#define LLVM_YAML_STRONG_TYPEDEF (   _base,
  _type 
)
Value:
struct _type { \
_type() { } \
_type(const _base v) : value(v) { } \
_type(const _type &v) : value(v.value) {} \
_type &operator=(const _type &rhs) { value = rhs.value; return *this; }\
_type &operator=(const _base &rhs) { value = rhs; return *this; } \
operator const _base & () const { return value; } \
bool operator==(const _type &rhs) const { return value == rhs.value; } \
bool operator==(const _base &rhs) const { return value == rhs; } \
bool operator<(const _type &rhs) const { return value < rhs.value; } \
_base value; \
};
void operator<(const Optional< T > &X, const Optional< U > &Y)
Poison comparison between two Optional objects. Clients needs to explicitly compare the underlying va...
bool operator==(uint64_t V1, const APInt &V2)
Definition: APInt.h:1684

YAML I/O does conversion based on types. But often native data types are just a typedef of built in intergral types (e.g. int). But the C++ type matching system sees through the typedef and all the typedefed types look like a built in type. This will cause the generic YAML I/O conversion to be used. To provide better control over the YAML conversion, you can use this macro instead of typedef. It will create a class with one field and automatic conversion operators to and from the base type. Based on BOOST_STRONG_TYPEDEF

Definition at line 891 of file YAMLTraits.h.