9#ifndef LLVM_SUPPORT_YAMLTRAITS_H
10#define LLVM_SUPPORT_YAMLTRAITS_H
34#include <system_error>
334 using check = std::tuple<SameType<SignatureInput, &U::input>,
347 using check = std::tuple<SameType<SignatureInput, &U::input>,
361 using check = std::tuple<SameType<SignatureInput, &U::input>,
447 template <
class U>
using check =
decltype(&U::flow);
455 :
public std::bool_constant<has_SequenceMethodTraits<T>::value> {};
477 return Input.ltrim(
"0123456789");
482 if (S.
empty() || S ==
"+" || S ==
"-")
485 if (S ==
".nan" || S ==
".NaN" || S ==
".NAN")
500 return S.
size() > 2 &&
515 (S.
size() > 1 && std::strchr(
"0123456789", S[1]) ==
nullptr)))
534 if (S.
front() ==
'.') {
537 }
else if (S.
front() ==
'e' || S.
front() ==
'E') {
538 State = FoundExponent;
544 if (State == FoundDot) {
550 State = FoundExponent;
557 assert(State == FoundExponent &&
"Should have found exponent at this point.");
567 return skipDigits(S).empty();
571 return S ==
"null" || S ==
"Null" || S ==
"NULL" || S ==
"~";
576 return S ==
"true" || S ==
"True" || S ==
"TRUE" || S ==
"false" ||
577 S ==
"False" || S ==
"FALSE";
597 if (ForcePreserveAsString) {
609 if (std::strchr(R
"(-?:\,[]{}#&*!|>'"%@`)", S[0]) != nullptr)
612 for (
unsigned char C : S) {
659 return MaxQuotingNeeded;
662template <
typename T,
typename Context>
664 :
public std::bool_constant<
665 !has_ScalarEnumerationTraits<T>::value &&
666 !has_ScalarBitSetTraits<T>::value && !has_ScalarTraits<T>::value &&
667 !has_BlockScalarTraits<T>::value &&
668 !has_TaggedScalarTraits<T>::value &&
669 !has_MappingTraits<T, Context>::value &&
670 !has_SequenceTraits<T>::value && !has_CustomMappingTraits<T>::value &&
671 !has_DocumentListTraits<T>::value &&
672 !has_PolymorphicTraits<T>::value> {};
674template <
typename T,
typename Context>
676 :
public std::bool_constant<has_MappingTraits<T, Context>::value &&
677 has_MappingValidateTraits<T, Context>::value> {
680template <
typename T,
typename Context>
682 :
public std::bool_constant<has_MappingTraits<T, Context>::value &&
683 !has_MappingValidateTraits<T, Context>::value> {
689 IO(
void *Ctxt =
nullptr);
710 virtual std::vector<StringRef>
keys() = 0;
731 virtual std::error_code
error() = 0;
741 template <
typename T>
752 FBT Res =
static_cast<typename FBT::BaseType
>(Val);
753 yamlize(*
this, Res,
true, Context);
754 Val =
static_cast<T>(
static_cast<typename FBT::BaseType
>(Res));
758 template <
typename T>
761 Val =
static_cast<T>(Val | ConstVal);
766 template <
typename T>
769 Val =
static_cast<T>(Val | ConstVal);
773 template <
typename T>
776 Val = Val | ConstVal;
779 template <
typename T>
783 Val = Val | ConstVal;
786 void *getContext()
const;
787 void setContext(
void *);
791 this->processKey(
Key, Val,
true, Ctx);
794 template <
typename T,
typename Context>
796 this->processKey(
Key, Val,
true, Ctx);
804 template <
typename T,
typename DefaultT>
810 template <
typename T,
typename Context>
817 this->processKey(
Key, Val,
false, Ctx);
820 template <
typename T,
typename Context>
823 this->processKeyWithDefault(
Key, Val, std::optional<T>(),
827 template <
typename T,
typename Context,
typename DefaultT>
830 static_assert(std::is_convertible<DefaultT, T>::value,
831 "Default type must be implicitly convertible to value type!");
832 this->processKeyWithDefault(
Key, Val,
static_cast<const T &
>(
Default),
837 template <
typename T,
typename Context>
838 void processKeyWithDefault(
StringRef Key, std::optional<T> &Val,
839 const std::optional<T> &DefaultValue,
842 template <
typename T,
typename Context>
843 void processKeyWithDefault(
StringRef Key,
T &Val,
const T &DefaultValue,
847 const bool sameAsDefault = outputting() && Val == DefaultValue;
848 if (this->preflightKey(
Key,
Required, sameAsDefault, UseDefault,
851 this->postflightKey(SaveInfo);
858 template <
typename T,
typename Context>
859 void processKey(StringRef Key,
T &Val,
bool Required,
Context &Ctx) {
862 if (this->preflightKey(Key, Required,
false, UseDefault, SaveInfo)) {
863 yamlize(*
this, Val, Required, Ctx);
864 this->postflightKey(SaveInfo);
874template <
typename T,
typename Context>
886std::enable_if_t<has_ScalarEnumerationTraits<T>::value,
void>
894std::enable_if_t<has_ScalarBitSetTraits<T>::value,
void>
906std::enable_if_t<has_ScalarTraits<T>::value,
void>
yamlize(
IO &io,
T &Val,
bool,
918 if (!Result.empty()) {
925std::enable_if_t<has_BlockScalarTraits<T>::value,
void>
944std::enable_if_t<has_TaggedScalarTraits<T>::value,
void>
947 std::string ScalarStorage, TagStorage;
962 if (!Result.empty()) {
970template <
typename T,
typename Context>
981template <
typename T,
typename Context>
982std::enable_if_t<validatedMappingTraits<T, Context>::value,
void>
991 errs() << Err <<
"\n";
992 assert(Err.empty() &&
"invalid struct trying to be written as yaml");
1007template <
typename T,
typename Context>
1022template <
typename T,
typename Context>
1023std::enable_if_t<unvalidatedMappingTraits<T, Context>::value,
void>
1038template <
typename T>
1039std::enable_if_t<has_CustomMappingTraits<T>::value,
void>
1053template <
typename T>
1054std::enable_if_t<has_PolymorphicTraits<T>::value,
void>
1067template <
typename T>
1068std::enable_if_t<missingTraits<T, EmptyContext>::value,
void>
1073template <
typename T,
typename Context>
1074std::enable_if_t<has_SequenceTraits<T>::value,
void>
1079 for (
unsigned i = 0; i <
count; ++i) {
1090 for (
unsigned i = 0; i <
count; ++i) {
1182template <
typename value_type, llvm::endianness endian,
size_t alignment>
1184 value_type, endian, alignment>,
1185 std::enable_if_t<has_ScalarTraits<value_type>::value>> {
1206template <
typename value_type, llvm::endianness endian,
size_t alignment>
1208 support::detail::packed_endian_specific_integral<value_type, endian,
1210 std::enable_if_t<has_ScalarEnumerationTraits<value_type>::value>> {
1222template <
typename value_type, llvm::endianness endian,
size_t alignment>
1224 support::detail::packed_endian_specific_integral<value_type, endian,
1226 std::enable_if_t<has_ScalarBitSetTraits<value_type>::value>> {
1241 : io(i_o), BufPtr(nullptr), Result(Obj) {
1242 if (io.outputting()) {
1243 BufPtr = new (&Buffer) TNorm(io, Obj);
1245 BufPtr = new (&Buffer) TNorm(io);
1250 if (!io.outputting()) {
1251 Result = BufPtr->denormalize(io);
1271 : io(i_o), Result(Obj) {
1272 if (io.outputting()) {
1273 BufPtr = new (&Buffer) TNorm(io, Obj);
1276 new (BufPtr) TNorm(io);
1278 BufPtr =
new TNorm(io);
1283 if (io.outputting()) {
1286 Result = BufPtr->denormalize(io);
1297 TNorm *BufPtr =
nullptr;
1320 void *DiagHandlerCtxt =
nullptr);
1323 void *DiagHandlerCtxt =
nullptr);
1327 std::error_code
error()
override;
1330 bool outputting()
const override;
1332 void beginMapping()
override;
1333 void endMapping()
override;
1334 bool preflightKey(
StringRef Key,
bool,
bool,
bool &,
void *&)
override;
1335 void postflightKey(
void *)
override;
1336 std::vector<StringRef> keys()
override;
1337 void beginFlowMapping()
override;
1338 void endFlowMapping()
override;
1339 unsigned beginSequence()
override;
1340 void endSequence()
override;
1341 bool preflightElement(
unsigned index,
void *&)
override;
1342 void postflightElement(
void *)
override;
1343 unsigned beginFlowSequence()
override;
1344 bool preflightFlowElement(
unsigned,
void *&)
override;
1345 void postflightFlowElement(
void *)
override;
1346 void endFlowSequence()
override;
1347 void beginEnumScalar()
override;
1348 bool matchEnumScalar(
StringRef,
bool)
override;
1349 bool matchEnumFallback()
override;
1350 void endEnumScalar()
override;
1351 bool beginBitSetScalar(
bool &)
override;
1352 bool bitSetMatch(
StringRef,
bool)
override;
1353 void endBitSetScalar()
override;
1355 void blockScalarString(
StringRef &)
override;
1356 void scalarTag(std::string &)
override;
1358 void setError(
const Twine &message)
override;
1359 bool canElideEmptySequence()
override;
1363 HNode(
Node *n) : _node(n) {}
1365 static bool classof(
const HNode *) {
return true; }
1370 class EmptyHNode :
public HNode {
1372 EmptyHNode(
Node *n) : HNode(n) {}
1374 static bool classof(
const HNode *n) {
return NullNode::classof(n->_node); }
1376 static bool classof(
const EmptyHNode *) {
return true; }
1379 class ScalarHNode :
public HNode {
1381 ScalarHNode(Node *n, StringRef s) : HNode(n), _value(s) {}
1383 StringRef value()
const {
return _value; }
1385 static bool classof(
const HNode *n) {
1386 return ScalarNode::classof(n->_node) ||
1387 BlockScalarNode::classof(n->_node);
1390 static bool classof(
const ScalarHNode *) {
return true; }
1396 class MapHNode :
public HNode {
1398 MapHNode(Node *n) : HNode(n) {}
1400 static bool classof(
const HNode *n) {
1401 return MappingNode::classof(n->_node);
1404 static bool classof(
const MapHNode *) {
return true; }
1406 using NameToNodeAndLoc = StringMap<std::pair<HNode *, SMRange>>;
1408 NameToNodeAndLoc Mapping;
1409 SmallVector<std::string, 6> ValidKeys;
1412 class SequenceHNode :
public HNode {
1414 SequenceHNode(Node *n) : HNode(n) {}
1416 static bool classof(
const HNode *n) {
1417 return SequenceNode::classof(n->_node);
1420 static bool classof(
const SequenceHNode *) {
return true; }
1422 std::vector<HNode *> Entries;
1425 Input::HNode *createHNodes(Node *node);
1426 void setError(HNode *hnode,
const Twine &message);
1427 void setError(Node *node,
const Twine &message);
1428 void setError(
const SMRange &
Range,
const Twine &message);
1430 void reportWarning(HNode *hnode,
const Twine &message);
1431 void reportWarning(Node *hnode,
const Twine &message);
1432 void reportWarning(
const SMRange &
Range,
const Twine &message);
1435 void releaseHNodeBuffers();
1440 bool setCurrentDocument();
1441 bool nextDocument();
1444 const Node *getCurrentNode()
const;
1446 void setAllowUnknownKeys(
bool Allow)
override;
1450 std::unique_ptr<llvm::yaml::Stream> Strm;
1451 HNode *TopNode =
nullptr;
1454 SpecificBumpPtrAllocator<EmptyHNode> EmptyHNodeAllocator;
1455 SpecificBumpPtrAllocator<ScalarHNode> ScalarHNodeAllocator;
1456 SpecificBumpPtrAllocator<MapHNode> MapHNodeAllocator;
1457 SpecificBumpPtrAllocator<SequenceHNode> SequenceHNodeAllocator;
1458 document_iterator DocIterator;
1459 llvm::BitVector BitValuesUsed;
1460 HNode *CurrentNode =
nullptr;
1461 bool ScalarMatchFound =
false;
1462 bool AllowUnknownKeys =
false;
1481 bool outputting()
const override;
1483 void beginMapping()
override;
1484 void endMapping()
override;
1485 bool preflightKey(
StringRef Key,
bool,
bool,
bool &,
void *&)
override;
1486 void postflightKey(
void *)
override;
1487 std::vector<StringRef> keys()
override;
1488 void beginFlowMapping()
override;
1489 void endFlowMapping()
override;
1490 unsigned beginSequence()
override;
1491 void endSequence()
override;
1492 bool preflightElement(
unsigned,
void *&)
override;
1493 void postflightElement(
void *)
override;
1494 unsigned beginFlowSequence()
override;
1495 bool preflightFlowElement(
unsigned,
void *&)
override;
1496 void postflightFlowElement(
void *)
override;
1497 void endFlowSequence()
override;
1498 void beginEnumScalar()
override;
1499 bool matchEnumScalar(
StringRef,
bool)
override;
1500 bool matchEnumFallback()
override;
1501 void endEnumScalar()
override;
1502 bool beginBitSetScalar(
bool &)
override;
1503 bool bitSetMatch(
StringRef,
bool)
override;
1504 void endBitSetScalar()
override;
1506 void blockScalarString(
StringRef &)
override;
1507 void scalarTag(std::string &)
override;
1509 void setError(
const Twine &message)
override;
1510 std::error_code
error()
override;
1511 bool canElideEmptySequence()
override;
1515 void beginDocuments();
1516 bool preflightDocument(
unsigned);
1517 void postflightDocument();
1518 void endDocuments();
1524 void newLineCheck(
bool EmptySequence =
false);
1525 void outputNewLine();
1532 inFlowSeqFirstElement,
1533 inFlowSeqOtherElement,
1540 static bool inSeqAnyElement(InState State);
1541 static bool inFlowSeqAnyElement(InState State);
1542 static bool inMapAnyKey(InState State);
1543 static bool inFlowMapAnyKey(InState State);
1549 int ColumnAtFlowStart = 0;
1550 int ColumnAtMapFlowStart = 0;
1551 bool NeedBitValueComma =
false;
1552 bool NeedFlowSequenceComma =
false;
1553 bool EnumerationMatchFound =
false;
1554 bool WriteDefaultValues =
false;
1559template <
typename T,
typename Context>
1560void IO::processKeyWithDefault(StringRef
Key, std::optional<T> &Val,
1561 const std::optional<T> &DefaultValue,
1563 assert(!DefaultValue &&
"std::optional<T> shouldn't have a value!");
1565 bool UseDefault =
true;
1566 const bool sameAsDefault =
outputting() && !Val;
1576 bool IsNone =
false;
1578 if (
const auto *
Node =
1582 IsNone =
Node->getRawValue().rtrim(
' ') ==
"<none>";
1603#define LLVM_YAML_STRONG_TYPEDEF(_base, _type) \
1605 _type() = default; \
1606 _type(const _base v) : value(v) {} \
1607 _type(const _type &v) = default; \
1608 _type &operator=(const _type &rhs) = default; \
1609 _type &operator=(const _base &rhs) { \
1613 operator const _base &() const { return value; } \
1614 bool operator==(const _type &rhs) const { return value == rhs.value; } \
1615 bool operator==(const _base &rhs) const { return value == rhs; } \
1616 bool operator<(const _type &rhs) const { return value < rhs.value; } \
1618 using BaseType = _base; \
1662template <
typename T>
1663inline std::enable_if_t<has_DocumentListTraits<T>::value,
Input &>
1678template <
typename T>
1679inline std::enable_if_t<has_MappingTraits<T, EmptyContext>::value,
Input &>
1683 yamlize(yin, docMap,
true, Ctx);
1689template <
typename T>
1690inline std::enable_if_t<has_SequenceTraits<T>::value,
Input &>
1694 yamlize(yin, docSeq,
true, Ctx);
1699template <
typename T>
1700inline std::enable_if_t<has_BlockScalarTraits<T>::value,
Input &>
1703 if (In.setCurrentDocument())
1709template <
typename T>
1710inline std::enable_if_t<has_CustomMappingTraits<T>::value,
Input &>
1713 if (In.setCurrentDocument())
1719template <
typename T>
1720inline std::enable_if_t<has_PolymorphicTraits<T>::value,
Input &>
1723 if (In.setCurrentDocument())
1729template <
typename T>
1730inline std::enable_if_t<missingTraits<T, EmptyContext>::value,
Input &>
1737template <
typename T>
1738inline std::enable_if_t<has_DocumentListTraits<T>::value, Output &>
1741 yout.beginDocuments();
1742 const size_t count = DocumentListTraits<T>::size(yout, docList);
1743 for (
size_t i = 0; i <
count; ++i) {
1744 if (yout.preflightDocument(i)) {
1745 yamlize(yout, DocumentListTraits<T>::element(yout, docList, i),
true,
1747 yout.postflightDocument();
1750 yout.endDocuments();
1755template <
typename T>
1756inline std::enable_if_t<has_MappingTraits<T, EmptyContext>::value,
Output &>
1759 yout.beginDocuments();
1760 if (yout.preflightDocument(0)) {
1761 yamlize(yout, map,
true, Ctx);
1762 yout.postflightDocument();
1764 yout.endDocuments();
1769template <
typename T>
1770inline std::enable_if_t<has_SequenceTraits<T>::value,
Output &>
1773 yout.beginDocuments();
1774 if (yout.preflightDocument(0)) {
1776 yout.postflightDocument();
1778 yout.endDocuments();
1783template <
typename T>
1784inline std::enable_if_t<has_BlockScalarTraits<T>::value,
Output &>
1787 Out.beginDocuments();
1788 if (Out.preflightDocument(0)) {
1790 Out.postflightDocument();
1797template <
typename T>
1798inline std::enable_if_t<has_CustomMappingTraits<T>::value,
Output &>
1801 Out.beginDocuments();
1802 if (Out.preflightDocument(0)) {
1804 Out.postflightDocument();
1812template <
typename T>
1813inline std::enable_if_t<has_PolymorphicTraits<T>::value,
Output &>
1816 Out.beginDocuments();
1817 if (Out.preflightDocument(0)) {
1821 "plain scalar documents are not supported");
1823 Out.postflightDocument();
1830template <
typename T>
1831inline std::enable_if_t<missingTraits<T, EmptyContext>::value,
Output &>
1842template <
typename T>
1846 using type =
typename T::value_type;
1850 if (index >=
seq.size())
1851 seq.resize(index + 1);
1853 if (index >=
seq.size()) {
1854 io.
setError(
Twine(
"value sequence extends beyond static size (") +
1863template <
typename T,
bool Flow>
1876template <
typename T>
1879 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1881template <
typename T,
size_t N>
1884 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1886template <
typename T,
unsigned N>
1889 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1891template <
typename T>
1894 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1896template <
typename T>
1899 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1903template <
typename T>
1936#define LLVM_YAML_IS_SEQUENCE_VECTOR_IMPL(TYPE, FLOW) \
1940 !std::is_fundamental_v<TYPE> && !std::is_same_v<TYPE, std::string> && \
1941 !std::is_same_v<TYPE, llvm::StringRef>, \
1942 "only use LLVM_YAML_IS_SEQUENCE_VECTOR for types you control"); \
1943 template <> struct SequenceElementTraits<TYPE> { \
1944 static const bool flow = FLOW; \
1951#define LLVM_YAML_IS_SEQUENCE_VECTOR(type) \
1952 LLVM_YAML_IS_SEQUENCE_VECTOR_IMPL(type, false)
1956#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(type) \
1957 LLVM_YAML_IS_SEQUENCE_VECTOR_IMPL(type, true)
1959#define LLVM_YAML_DECLARE_MAPPING_TRAITS(Type) \
1962 template <> struct LLVM_ABI MappingTraits<Type> { \
1963 static void mapping(IO &IO, Type &Obj); \
1968#define LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(Type) \
1971 template <> struct MappingTraits<Type> { \
1972 static void mapping(IO &IO, Type &Obj); \
1977#define LLVM_YAML_DECLARE_ENUM_TRAITS(Type) \
1980 template <> struct LLVM_ABI ScalarEnumerationTraits<Type> { \
1981 static void enumeration(IO &io, Type &Value); \
1986#define LLVM_YAML_DECLARE_BITSET_TRAITS(Type) \
1989 template <> struct LLVM_ABI ScalarBitSetTraits<Type> { \
1990 static void bitset(IO &IO, Type &Options); \
1995#define LLVM_YAML_DECLARE_SCALAR_TRAITS(Type, MustQuote) \
1998 template <> struct LLVM_ABI ScalarTraits<Type> { \
1999 static void output(const Type &Value, void *ctx, raw_ostream &Out); \
2000 static StringRef input(StringRef Scalar, void *ctxt, Type &Value); \
2001 static QuotingType mustQuote(StringRef) { return MustQuote; } \
2008#define LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(_type) \
2011 template <unsigned N> \
2012 struct DocumentListTraits<SmallVector<_type, N>> \
2013 : public SequenceTraitsImpl<SmallVector<_type, N>, false> {}; \
2015 struct DocumentListTraits<std::vector<_type>> \
2016 : public SequenceTraitsImpl<std::vector<_type>, false> {}; \
2022#define LLVM_YAML_IS_STRING_MAP(_type) \
2026 struct CustomMappingTraits<std::map<std::string, _type>> \
2027 : public StdMapStringCustomMappingTraitsImpl<_type> {}; \
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
This file defines the BumpPtrAllocator interface.
This file implements the BitVector class.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
This file defines the SmallVector class.
static void DiagHandler(const SMDiagnostic &Diag, void *Context)
#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(type)
Utility for declaring that a std::vector of a particular type should be considered a YAML flow sequen...
#define LLVM_YAML_STRONG_TYPEDEF(_base, _type)
YAML I/O does conversion based on types. But often native data types are just a typedef of built in i...
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
void(*)(const SMDiagnostic &, void *Context) DiagHandlerTy
Clients that want to handle their own diagnostics in a custom way can register a function pointer+con...
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
constexpr bool empty() const
empty - Check if the string is empty.
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
char back() const
back - Get the last character in the string.
constexpr size_t size() const
size - Get the string size.
char front() const
front - Get the first character in the string.
static constexpr size_t npos
LLVM_ABI size_t find_first_not_of(char C, size_t From=0) const
Find the first character in the string that is not C or npos if not found.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
Represents a version number in the form major[.minor[.subminor[.build]]].
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
A raw_ostream that writes to an SmallVector or SmallString.
StringRef str() const
Return a StringRef for the vector contents.
virtual bool canElideEmptySequence()=0
virtual void postflightFlowElement(void *)=0
virtual NodeKind getNodeKind()=0
virtual void endSequence()=0
void bitSetCase(T &Val, StringRef Str, const T ConstVal)
virtual bool matchEnumScalar(StringRef, bool)=0
virtual void endEnumScalar()=0
void bitSetCase(T &Val, StringRef Str, const uint32_t ConstVal)
virtual bool outputting() const =0
virtual unsigned beginFlowSequence()=0
virtual bool mapTag(StringRef Tag, bool Default=false)=0
void mapOptionalWithContext(StringRef Key, T &Val, const DefaultT &Default, Context &Ctx)
virtual void endFlowSequence()=0
virtual void beginMapping()=0
virtual void setAllowUnknownKeys(bool Allow)
void mapOptionalWithContext(StringRef Key, std::optional< T > &Val, Context &Ctx)
void enumCase(T &Val, StringRef Str, const T ConstVal)
virtual void endMapping()=0
void mapOptionalWithContext(StringRef Key, T &Val, Context &Ctx)
virtual bool preflightElement(unsigned, void *&)=0
virtual unsigned beginSequence()=0
virtual void beginEnumScalar()=0
void maskedBitSetCase(T &Val, StringRef Str, uint32_t ConstVal, uint32_t Mask)
virtual std::error_code error()=0
virtual void scalarString(StringRef &, QuotingType)=0
virtual bool bitSetMatch(StringRef, bool)=0
void mapOptional(StringRef Key, T &Val)
virtual void setError(const Twine &)=0
void * getContext() const
virtual void postflightElement(void *)=0
virtual void postflightKey(void *)=0
void enumCase(T &Val, StringRef Str, const uint32_t ConstVal)
virtual void endFlowMapping()=0
void mapRequired(StringRef Key, T &Val, Context &Ctx)
void enumFallback(T &Val)
virtual void beginFlowMapping()=0
virtual bool preflightKey(StringRef, bool, bool, bool &, void *&)=0
void mapOptional(StringRef Key, T &Val, const DefaultT &Default)
void mapRequired(StringRef Key, T &Val)
virtual bool beginBitSetScalar(bool &)=0
virtual void blockScalarString(StringRef &)=0
virtual void scalarTag(std::string &)=0
virtual bool matchEnumFallback()=0
virtual bool preflightFlowElement(unsigned, void *&)=0
virtual void endBitSetScalar()=0
virtual std::vector< StringRef > keys()=0
void maskedBitSetCase(T &Val, StringRef Str, T ConstVal, T Mask)
Abstract base class for all Nodes.
The Output class is used to generate a yaml document from in-memory structs and vectors.
Output(raw_ostream &, void *Ctxt=nullptr, int WrapColumn=70)
void setWriteDefaultValues(bool Write)
Set whether or not to output optional values which are equal to the default value....
This class represents a YAML stream potentially containing multiple documents.
@ Tail
Attemps to make calls as fast as possible while guaranteeing that tail call optimization can always b...
@ C
The default llvm calling convention, compatible with C.
NodeAddr< NodeBase * > Node
void doMapping(IO &io, T &Val, Context &Ctx)
std::string doValidate(IO &io, T &Val, Context &Ctx)
QuotingType
Describe which type of quotes should be used when quoting is necessary.
std::enable_if_t< has_ScalarEnumerationTraits< T >::value, void > yamlize(IO &io, T &Val, bool, EmptyContext &Ctx)
decltype(std::declval< T >().resize(0)) check_resize_t
bool isNumeric(StringRef S)
std::enable_if_t< has_DocumentListTraits< T >::value, Input & > operator>>(Input &yin, T &docList)
QuotingType needsQuotes(StringRef S, bool ForcePreserveAsString=true)
bool yamlizeMappingEnumInput(IO &io, T &Val)
std::enable_if_t< has_DocumentListTraits< T >::value, Output & > operator<<(Output &yout, T &docList)
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool isAlnum(char C)
Checks whether character C is either a decimal digit or an uppercase or lowercase letter as classifie...
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
typename detail::detector< void, Op, Args... >::value_t is_detected
Detects if a given trait holds for some set of arguments 'Args'.
bool isSpace(char C)
Checks whether character C is whitespace in the "C" locale.
auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
@ Default
The result values are uniform if and only if all operands are uniform.
Implement std::hash so that hash_code can be used in STL containers.
A suitably aligned and sized character array member which can hold elements of any type.
This class should be specialized by type that requires custom conversion to/from a YAML literal block...
This class should be specialized by any type that needs to be converted to/from a YAML mapping in the...
This class should be specialized by any type that needs to be converted to/from a list of YAML docume...
typename T::value_type type
static type & element(IO &io, T &seq, size_t index)
This class is similar to MappingTraits<T> but allows you to pass in additional context for each map o...
~MappingNormalizationHeap()
MappingNormalizationHeap(IO &i_o, TFinal &Obj, BumpPtrAllocator *allocator)
MappingNormalization(IO &i_o, TFinal &Obj)
This class should be specialized by any type that needs to be converted to/from a YAML mapping.
This class should be specialized by any type that can be represented as a scalar, map,...
support::detail::packed_endian_specific_integral< value_type, endian, alignment > endian_type
static void bitset(IO &io, endian_type &E)
This class should be specialized by any integer type that is a union of bit values and the YAML repre...
support::detail::packed_endian_specific_integral< value_type, endian, alignment > endian_type
static void enumeration(IO &io, endian_type &E)
This class should be specialized by any integral type that converts to/from a YAML scalar where there...
static QuotingType mustQuote(StringRef)
static LLVM_ABI void output(const Hex16 &, void *, raw_ostream &)
static LLVM_ABI StringRef input(StringRef, void *, Hex16 &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI void output(const Hex32 &, void *, raw_ostream &)
static LLVM_ABI StringRef input(StringRef, void *, Hex32 &)
static LLVM_ABI StringRef input(StringRef, void *, Hex64 &)
static LLVM_ABI void output(const Hex64 &, void *, raw_ostream &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI StringRef input(StringRef, void *, Hex8 &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI void output(const Hex8 &, void *, raw_ostream &)
static LLVM_ABI StringRef input(StringRef, void *, StringRef &)
static LLVM_ABI void output(const StringRef &, void *, raw_ostream &)
static QuotingType mustQuote(StringRef S)
static LLVM_ABI void output(const VersionTuple &Value, void *, llvm::raw_ostream &Out)
static QuotingType mustQuote(StringRef)
static LLVM_ABI StringRef input(StringRef, void *, VersionTuple &)
static LLVM_ABI void output(const bool &, void *, raw_ostream &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI StringRef input(StringRef, void *, bool &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI StringRef input(StringRef, void *, double &)
static LLVM_ABI void output(const double &, void *, raw_ostream &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI StringRef input(StringRef, void *, float &)
static LLVM_ABI void output(const float &, void *, raw_ostream &)
static LLVM_ABI void output(const int16_t &, void *, raw_ostream &)
static LLVM_ABI StringRef input(StringRef, void *, int16_t &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI void output(const int32_t &, void *, raw_ostream &)
static LLVM_ABI StringRef input(StringRef, void *, int32_t &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI StringRef input(StringRef, void *, int64_t &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI void output(const int64_t &, void *, raw_ostream &)
static LLVM_ABI void output(const int8_t &, void *, raw_ostream &)
static LLVM_ABI StringRef input(StringRef, void *, int8_t &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI void output(const std::string &, void *, raw_ostream &)
static QuotingType mustQuote(StringRef S)
static LLVM_ABI StringRef input(StringRef, void *, std::string &)
support::detail::packed_endian_specific_integral< value_type, endian, alignment > endian_type
static StringRef input(StringRef Str, void *Ctx, endian_type &E)
static void output(const endian_type &E, void *Ctx, raw_ostream &Stream)
static QuotingType mustQuote(StringRef Str)
static LLVM_ABI void output(const uint16_t &, void *, raw_ostream &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI StringRef input(StringRef, void *, uint16_t &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI StringRef input(StringRef, void *, uint32_t &)
static LLVM_ABI void output(const uint32_t &, void *, raw_ostream &)
static LLVM_ABI void output(const uint64_t &, void *, raw_ostream &)
static LLVM_ABI StringRef input(StringRef, void *, uint64_t &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI void output(const uint8_t &, void *, raw_ostream &)
static QuotingType mustQuote(StringRef)
static LLVM_ABI StringRef input(StringRef, void *, uint8_t &)
This class should be specialized by type that requires custom conversion to/from a yaml scalar.
This class should be specialized by any type for which vectors of that type need to be converted to/f...
static size_t size(IO &io, T &seq)
This class should be specialized by any type that needs to be converted to/from a YAML sequence.
Implementation of CustomMappingTraits for std::map<std::string, T>.
static void inputOne(IO &io, StringRef key, map_type &v)
std::map< std::string, T > map_type
static void output(IO &io, map_type &v)
This class should be specialized by type that requires custom conversion to/from a YAML scalar with o...
StringRef(*)(StringRef, void *, T &) SignatureInput
static constexpr bool value
void(*)(const T &, void *, raw_ostream &) SignatureOutput
std::tuple< SameType< SignatureInput, &U::input >, SameType< SignatureOutput, &U::output > > check
SameType< SignatureInput, &U::inputOne > check
static constexpr bool value
void(*)(IO &io, StringRef key, T &v) SignatureInput
static constexpr bool value
size_t(*)(class IO &, T &) SignatureSize
SameType< SignatureSize, &U::size > check
static constexpr bool value
static constexpr bool value
SameType< SignatureEnumInput, &U::enumInput > check
void(*)(class IO &, T &) SignatureEnumInput
SameType< SignatureMapping, &U::mapping > check
void(*)(class IO &, T &) SignatureMapping
static constexpr bool value
void(*)(class IO &, T &, Context &) SignatureMapping
SameType< SignatureMapping, &U::mapping > check
static constexpr bool value
SameType< SignatureValidate, &U::validate > check
static constexpr bool value
std::string(*)(class IO &, T &) SignatureValidate
std::string(*)(class IO &, T &, Context &) SignatureValidate
static constexpr bool value
SameType< SignatureValidate, &U::validate > check
NodeKind(*)(const T &) SignatureGetKind
static constexpr bool value
SameType< SignatureGetKind, &U::getKind > check
void(*)(class IO &, T &) SignatureBitset
static constexpr bool value
SameType< SignatureBitset, &ScalarBitSetTraits< U >::bitset > check
void(*)(class IO &, T &) SignatureEnumeration
SameType< SignatureEnumeration, &ScalarEnumerationTraits< U >::enumeration > check
static constexpr bool value
void(*)(const T &, void *, raw_ostream &) SignatureOutput
QuotingType(*)(StringRef) SignatureMustQuote
std::tuple< SameType< SignatureInput, &U::input >, SameType< SignatureOutput, &U::output >, SameType< SignatureMustQuote, &U::mustQuote > > check
StringRef(*)(StringRef, void *, T &) SignatureInput
static constexpr bool value
static constexpr bool value
size_t(*)(class IO &, T &) SignatureSize
SameType< SignatureSize, &U::size > check
StringRef(*)(StringRef, StringRef, void *, T &) SignatureInput
QuotingType(*)(const T &, StringRef) SignatureMustQuote
std::tuple< SameType< SignatureInput, &U::input >, SameType< SignatureOutput, &U::output >, SameType< SignatureMustQuote, &U::mustQuote > > check
void(*)(const T &, void *, raw_ostream &, raw_ostream &) SignatureOutput
static constexpr bool value