LLVM API Documentation
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/Optional.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/Compiler.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/YAMLParser.h"
#include "llvm/Support/raw_ostream.h"
#include <system_error>
Go to the source code of this file.
#define LLVM_YAML_IS_DOCUMENT_LIST_VECTOR | ( | _type | ) |
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]; \ } \ }; \ } \ }
Utility for declaring that a std::vector of a particular type should be considered a YAML document list.
Definition at line 1277 of file YAMLTraits.h.
#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR | ( | _type | ) |
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) {\ (void)flow; /* Remove this workaround after PR17897 is fixed */ \ if ( index >= seq.size() ) \ seq.resize(index+1); \ return seq[index]; \ } \ static const bool flow = true; \ }; \ } \ }
Utility for declaring that a std::vector of a particular type should be considered a YAML flow sequence.
Definition at line 1256 of file YAMLTraits.h.
#define LLVM_YAML_IS_SEQUENCE_VECTOR | ( | _type | ) |
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]; \ } \ }; \ } \ }
Utility for declaring that a std::vector of a particular type should be considered a YAML sequence.
Definition at line 1237 of file YAMLTraits.h.
#define LLVM_YAML_STRONG_TYPEDEF | ( | _base, | |
_type | |||
) |
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; \ };
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 1074 of file YAMLTraits.h.