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>,
450 static constexpr bool value =
false;
454 template <
class U>
using check =
decltype(&U::flow);
462 :
public std::bool_constant<has_SequenceMethodTraits<T>::value> {};
484 return Input.ltrim(
"0123456789");
489 if (S.
empty() || S ==
"+" || S ==
"-")
492 if (S ==
".nan" || S ==
".NaN" || S ==
".NAN")
507 return S.
size() > 2 &&
522 (S.
size() > 1 && std::strchr(
"0123456789", S[1]) ==
nullptr)))
541 if (S.
front() ==
'.') {
544 }
else if (S.
front() ==
'e' || S.
front() ==
'E') {
545 State = FoundExponent;
551 if (State == FoundDot) {
557 State = FoundExponent;
564 assert(State == FoundExponent &&
"Should have found exponent at this point.");
574 return skipDigits(S).empty();
578 return S ==
"null" || S ==
"Null" || S ==
"NULL" || S ==
"~";
583 return S ==
"true" || S ==
"True" || S ==
"TRUE" || S ==
"false" ||
584 S ==
"False" || S ==
"FALSE";
604 if (ForcePreserveAsString) {
616 if (std::strchr(R
"(-?:\,[]{}#&*!|>'"%@`)", S[0]) != nullptr)
619 for (
unsigned char C : S) {
666 return MaxQuotingNeeded;
669template <
typename T,
typename Context>
671 :
public std::bool_constant<
672 !has_ScalarEnumerationTraits<T>::value &&
673 !has_ScalarBitSetTraits<T>::value && !has_ScalarTraits<T>::value &&
674 !has_BlockScalarTraits<T>::value &&
675 !has_TaggedScalarTraits<T>::value &&
676 !has_MappingTraits<T, Context>::value &&
677 !has_SequenceTraits<T>::value && !has_CustomMappingTraits<T>::value &&
678 !has_DocumentListTraits<T>::value &&
679 !has_PolymorphicTraits<T>::value> {};
681template <
typename T,
typename Context>
683 :
public std::bool_constant<has_MappingTraits<T, Context>::value &&
684 has_MappingValidateTraits<T, Context>::value> {
687template <
typename T,
typename Context>
689 :
public std::bool_constant<has_MappingTraits<T, Context>::value &&
690 !has_MappingValidateTraits<T, Context>::value> {
696 IO(
void *Ctxt =
nullptr);
715 virtual bool preflightKey(
const char *,
bool,
bool,
bool &,
void *&) = 0;
717 virtual std::vector<StringRef>
keys() = 0;
738 virtual std::error_code
error() = 0;
741 template <
typename T>
749 template <
typename T>
760 FBT Res =
static_cast<typename FBT::BaseType
>(Val);
761 yamlize(*
this, Res,
true, Context);
762 Val =
static_cast<T>(
static_cast<typename FBT::BaseType
>(Res));
766 template <
typename T>
769 Val =
static_cast<T>(Val | ConstVal);
774 template <
typename T>
777 Val =
static_cast<T>(Val | ConstVal);
781 template <
typename T>
784 Val = Val | ConstVal;
787 template <
typename T>
791 Val = Val | ConstVal;
794 void *getContext()
const;
795 void setContext(
void *);
799 this->processKey(
Key, Val,
true, Ctx);
802 template <
typename T,
typename Context>
804 this->processKey(
Key, Val,
true, Ctx);
812 template <
typename T,
typename DefaultT>
818 template <
typename T,
typename Context>
825 this->processKey(
Key, Val,
false, Ctx);
828 template <
typename T,
typename Context>
831 this->processKeyWithDefault(
Key, Val, std::optional<T>(),
835 template <
typename T,
typename Context,
typename DefaultT>
838 static_assert(std::is_convertible<DefaultT, T>::value,
839 "Default type must be implicitly convertible to value type!");
840 this->processKeyWithDefault(
Key, Val,
static_cast<const T &
>(
Default),
845 template <
typename T,
typename Context>
846 void processKeyWithDefault(
const char *
Key, std::optional<T> &Val,
847 const std::optional<T> &DefaultValue,
850 template <
typename T,
typename Context>
851 void processKeyWithDefault(
const char *
Key,
T &Val,
const T &DefaultValue,
855 const bool sameAsDefault = outputting() && Val == DefaultValue;
856 if (this->preflightKey(
Key,
Required, sameAsDefault, UseDefault,
859 this->postflightKey(SaveInfo);
866 template <
typename T,
typename Context>
867 void processKey(
const char *Key,
T &Val,
bool Required,
Context &Ctx) {
870 if (this->preflightKey(Key, Required,
false, UseDefault, SaveInfo)) {
871 yamlize(*
this, Val, Required, Ctx);
872 this->postflightKey(SaveInfo);
882template <
typename T,
typename Context>
894std::enable_if_t<has_ScalarEnumerationTraits<T>::value,
void>
902std::enable_if_t<has_ScalarBitSetTraits<T>::value,
void>
914std::enable_if_t<has_ScalarTraits<T>::value,
void>
yamlize(
IO &io,
T &Val,
bool,
926 if (!Result.empty()) {
933std::enable_if_t<has_BlockScalarTraits<T>::value,
void>
952std::enable_if_t<has_TaggedScalarTraits<T>::value,
void>
955 std::string ScalarStorage, TagStorage;
970 if (!Result.empty()) {
978template <
typename T,
typename Context>
989template <
typename T,
typename Context>
990std::enable_if_t<validatedMappingTraits<T, Context>::value,
void>
999 errs() << Err <<
"\n";
1000 assert(Err.empty() &&
"invalid struct trying to be written as yaml");
1015template <
typename T,
typename Context>
1030template <
typename T,
typename Context>
1031std::enable_if_t<unvalidatedMappingTraits<T, Context>::value,
void>
1046template <
typename T>
1047std::enable_if_t<has_CustomMappingTraits<T>::value,
void>
1061template <
typename T>
1062std::enable_if_t<has_PolymorphicTraits<T>::value,
void>
1075template <
typename T>
1076std::enable_if_t<missingTraits<T, EmptyContext>::value,
void>
1081template <
typename T,
typename Context>
1082std::enable_if_t<has_SequenceTraits<T>::value,
void>
1087 for (
unsigned i = 0; i <
count; ++i) {
1098 for (
unsigned i = 0; i <
count; ++i) {
1190template <
typename value_type, llvm::endianness endian,
size_t alignment>
1192 value_type, endian, alignment>,
1193 std::enable_if_t<has_ScalarTraits<value_type>::value>> {
1214template <
typename value_type, llvm::endianness endian,
size_t alignment>
1216 support::detail::packed_endian_specific_integral<value_type, endian,
1218 std::enable_if_t<has_ScalarEnumerationTraits<value_type>::value>> {
1230template <
typename value_type, llvm::endianness endian,
size_t alignment>
1232 support::detail::packed_endian_specific_integral<value_type, endian,
1234 std::enable_if_t<has_ScalarBitSetTraits<value_type>::value>> {
1249 : io(i_o), BufPtr(nullptr), Result(Obj) {
1250 if (io.outputting()) {
1251 BufPtr = new (&Buffer) TNorm(io, Obj);
1253 BufPtr = new (&Buffer) TNorm(io);
1258 if (!io.outputting()) {
1259 Result = BufPtr->denormalize(io);
1279 : io(i_o), Result(Obj) {
1280 if (io.outputting()) {
1281 BufPtr = new (&Buffer) TNorm(io, Obj);
1284 new (BufPtr) TNorm(io);
1286 BufPtr =
new TNorm(io);
1291 if (io.outputting()) {
1294 Result = BufPtr->denormalize(io);
1305 TNorm *BufPtr =
nullptr;
1328 void *DiagHandlerCtxt =
nullptr);
1331 void *DiagHandlerCtxt =
nullptr);
1335 std::error_code
error()
override;
1338 bool outputting()
const override;
1340 void beginMapping()
override;
1341 void endMapping()
override;
1342 bool preflightKey(
const char *,
bool,
bool,
bool &,
void *&)
override;
1343 void postflightKey(
void *)
override;
1344 std::vector<StringRef> keys()
override;
1345 void beginFlowMapping()
override;
1346 void endFlowMapping()
override;
1347 unsigned beginSequence()
override;
1348 void endSequence()
override;
1349 bool preflightElement(
unsigned index,
void *&)
override;
1350 void postflightElement(
void *)
override;
1351 unsigned beginFlowSequence()
override;
1352 bool preflightFlowElement(
unsigned,
void *&)
override;
1353 void postflightFlowElement(
void *)
override;
1354 void endFlowSequence()
override;
1355 void beginEnumScalar()
override;
1356 bool matchEnumScalar(
const char *,
bool)
override;
1357 bool matchEnumFallback()
override;
1358 void endEnumScalar()
override;
1359 bool beginBitSetScalar(
bool &)
override;
1360 bool bitSetMatch(
const char *,
bool)
override;
1361 void endBitSetScalar()
override;
1363 void blockScalarString(
StringRef &)
override;
1364 void scalarTag(std::string &)
override;
1366 void setError(
const Twine &message)
override;
1367 bool canElideEmptySequence()
override;
1371 HNode(
Node *n) : _node(n) {}
1373 static bool classof(
const HNode *) {
return true; }
1378 class EmptyHNode :
public HNode {
1380 EmptyHNode(
Node *n) : HNode(n) {}
1382 static bool classof(
const HNode *n) {
return NullNode::classof(n->_node); }
1384 static bool classof(
const EmptyHNode *) {
return true; }
1387 class ScalarHNode :
public HNode {
1389 ScalarHNode(Node *n, StringRef s) : HNode(n), _value(s) {}
1391 StringRef value()
const {
return _value; }
1393 static bool classof(
const HNode *n) {
1394 return ScalarNode::classof(n->_node) ||
1395 BlockScalarNode::classof(n->_node);
1398 static bool classof(
const ScalarHNode *) {
return true; }
1404 class MapHNode :
public HNode {
1406 MapHNode(Node *n) : HNode(n) {}
1408 static bool classof(
const HNode *n) {
1409 return MappingNode::classof(n->_node);
1412 static bool classof(
const MapHNode *) {
return true; }
1414 using NameToNodeAndLoc = StringMap<std::pair<HNode *, SMRange>>;
1416 NameToNodeAndLoc Mapping;
1417 SmallVector<std::string, 6> ValidKeys;
1420 class SequenceHNode :
public HNode {
1422 SequenceHNode(Node *n) : HNode(n) {}
1424 static bool classof(
const HNode *n) {
1425 return SequenceNode::classof(n->_node);
1428 static bool classof(
const SequenceHNode *) {
return true; }
1430 std::vector<HNode *> Entries;
1433 Input::HNode *createHNodes(Node *node);
1434 void setError(HNode *hnode,
const Twine &message);
1435 void setError(Node *node,
const Twine &message);
1436 void setError(
const SMRange &
Range,
const Twine &message);
1438 void reportWarning(HNode *hnode,
const Twine &message);
1439 void reportWarning(Node *hnode,
const Twine &message);
1440 void reportWarning(
const SMRange &
Range,
const Twine &message);
1443 void releaseHNodeBuffers();
1448 bool setCurrentDocument();
1449 bool nextDocument();
1452 const Node *getCurrentNode()
const;
1454 void setAllowUnknownKeys(
bool Allow)
override;
1458 std::unique_ptr<llvm::yaml::Stream> Strm;
1459 HNode *TopNode =
nullptr;
1462 SpecificBumpPtrAllocator<EmptyHNode> EmptyHNodeAllocator;
1463 SpecificBumpPtrAllocator<ScalarHNode> ScalarHNodeAllocator;
1464 SpecificBumpPtrAllocator<MapHNode> MapHNodeAllocator;
1465 SpecificBumpPtrAllocator<SequenceHNode> SequenceHNodeAllocator;
1466 document_iterator DocIterator;
1467 llvm::BitVector BitValuesUsed;
1468 HNode *CurrentNode =
nullptr;
1469 bool ScalarMatchFound =
false;
1470 bool AllowUnknownKeys =
false;
1489 bool outputting()
const override;
1491 void beginMapping()
override;
1492 void endMapping()
override;
1493 bool preflightKey(
const char *key,
bool,
bool,
bool &,
void *&)
override;
1494 void postflightKey(
void *)
override;
1495 std::vector<StringRef> keys()
override;
1496 void beginFlowMapping()
override;
1497 void endFlowMapping()
override;
1498 unsigned beginSequence()
override;
1499 void endSequence()
override;
1500 bool preflightElement(
unsigned,
void *&)
override;
1501 void postflightElement(
void *)
override;
1502 unsigned beginFlowSequence()
override;
1503 bool preflightFlowElement(
unsigned,
void *&)
override;
1504 void postflightFlowElement(
void *)
override;
1505 void endFlowSequence()
override;
1506 void beginEnumScalar()
override;
1507 bool matchEnumScalar(
const char *,
bool)
override;
1508 bool matchEnumFallback()
override;
1509 void endEnumScalar()
override;
1510 bool beginBitSetScalar(
bool &)
override;
1511 bool bitSetMatch(
const char *,
bool)
override;
1512 void endBitSetScalar()
override;
1514 void blockScalarString(
StringRef &)
override;
1515 void scalarTag(std::string &)
override;
1517 void setError(
const Twine &message)
override;
1518 std::error_code
error()
override;
1519 bool canElideEmptySequence()
override;
1523 void beginDocuments();
1524 bool preflightDocument(
unsigned);
1525 void postflightDocument();
1526 void endDocuments();
1532 void newLineCheck(
bool EmptySequence =
false);
1533 void outputNewLine();
1540 inFlowSeqFirstElement,
1541 inFlowSeqOtherElement,
1548 static bool inSeqAnyElement(InState State);
1549 static bool inFlowSeqAnyElement(InState State);
1550 static bool inMapAnyKey(InState State);
1551 static bool inFlowMapAnyKey(InState State);
1557 int ColumnAtFlowStart = 0;
1558 int ColumnAtMapFlowStart = 0;
1559 bool NeedBitValueComma =
false;
1560 bool NeedFlowSequenceComma =
false;
1561 bool EnumerationMatchFound =
false;
1562 bool WriteDefaultValues =
false;
1567template <
typename T,
typename Context>
1568void IO::processKeyWithDefault(
const char *
Key, std::optional<T> &Val,
1569 const std::optional<T> &DefaultValue,
1571 assert(!DefaultValue &&
"std::optional<T> shouldn't have a value!");
1573 bool UseDefault =
true;
1574 const bool sameAsDefault =
outputting() && !Val;
1584 bool IsNone =
false;
1586 if (
const auto *
Node =
1590 IsNone =
Node->getRawValue().rtrim(
' ') ==
"<none>";
1611#define LLVM_YAML_STRONG_TYPEDEF(_base, _type) \
1613 _type() = default; \
1614 _type(const _base v) : value(v) {} \
1615 _type(const _type &v) = default; \
1616 _type &operator=(const _type &rhs) = default; \
1617 _type &operator=(const _base &rhs) { \
1621 operator const _base &() const { return value; } \
1622 bool operator==(const _type &rhs) const { return value == rhs.value; } \
1623 bool operator==(const _base &rhs) const { return value == rhs; } \
1624 bool operator<(const _type &rhs) const { return value < rhs.value; } \
1626 using BaseType = _base; \
1670template <
typename T>
1671inline std::enable_if_t<has_DocumentListTraits<T>::value,
Input &>
1686template <
typename T>
1687inline std::enable_if_t<has_MappingTraits<T, EmptyContext>::value,
Input &>
1691 yamlize(yin, docMap,
true, Ctx);
1697template <
typename T>
1698inline std::enable_if_t<has_SequenceTraits<T>::value,
Input &>
1702 yamlize(yin, docSeq,
true, Ctx);
1707template <
typename T>
1708inline std::enable_if_t<has_BlockScalarTraits<T>::value,
Input &>
1711 if (In.setCurrentDocument())
1717template <
typename T>
1718inline std::enable_if_t<has_CustomMappingTraits<T>::value,
Input &>
1721 if (In.setCurrentDocument())
1727template <
typename T>
1728inline std::enable_if_t<has_PolymorphicTraits<T>::value,
Input &>
1731 if (In.setCurrentDocument())
1737template <
typename T>
1738inline std::enable_if_t<missingTraits<T, EmptyContext>::value,
Input &>
1745template <
typename T>
1746inline std::enable_if_t<has_DocumentListTraits<T>::value, Output &>
1749 yout.beginDocuments();
1750 const size_t count = DocumentListTraits<T>::size(yout, docList);
1751 for (
size_t i = 0; i <
count; ++i) {
1752 if (yout.preflightDocument(i)) {
1753 yamlize(yout, DocumentListTraits<T>::element(yout, docList, i),
true,
1755 yout.postflightDocument();
1758 yout.endDocuments();
1763template <
typename T>
1764inline std::enable_if_t<has_MappingTraits<T, EmptyContext>::value,
Output &>
1767 yout.beginDocuments();
1768 if (yout.preflightDocument(0)) {
1769 yamlize(yout, map,
true, Ctx);
1770 yout.postflightDocument();
1772 yout.endDocuments();
1777template <
typename T>
1778inline std::enable_if_t<has_SequenceTraits<T>::value,
Output &>
1781 yout.beginDocuments();
1782 if (yout.preflightDocument(0)) {
1784 yout.postflightDocument();
1786 yout.endDocuments();
1791template <
typename T>
1792inline std::enable_if_t<has_BlockScalarTraits<T>::value,
Output &>
1795 Out.beginDocuments();
1796 if (Out.preflightDocument(0)) {
1798 Out.postflightDocument();
1805template <
typename T>
1806inline std::enable_if_t<has_CustomMappingTraits<T>::value,
Output &>
1809 Out.beginDocuments();
1810 if (Out.preflightDocument(0)) {
1812 Out.postflightDocument();
1820template <
typename T>
1821inline std::enable_if_t<has_PolymorphicTraits<T>::value,
Output &>
1824 Out.beginDocuments();
1825 if (Out.preflightDocument(0)) {
1829 "plain scalar documents are not supported");
1831 Out.postflightDocument();
1838template <
typename T>
1839inline std::enable_if_t<missingTraits<T, EmptyContext>::value,
Output &>
1850template <
typename T>
1854 using type =
typename T::value_type;
1858 if (index >=
seq.size())
1859 seq.resize(index + 1);
1861 if (index >=
seq.size()) {
1862 io.
setError(
Twine(
"value sequence extends beyond static size (") +
1871template <
typename T,
bool Flow>
1884template <
typename T>
1887 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1889template <
typename T,
size_t N>
1892 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1894template <
typename T,
unsigned N>
1897 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1899template <
typename T>
1902 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1904template <
typename T>
1907 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1911template <
typename T>
1944#define LLVM_YAML_IS_SEQUENCE_VECTOR_IMPL(TYPE, FLOW) \
1948 !std::is_fundamental_v<TYPE> && !std::is_same_v<TYPE, std::string> && \
1949 !std::is_same_v<TYPE, llvm::StringRef>, \
1950 "only use LLVM_YAML_IS_SEQUENCE_VECTOR for types you control"); \
1951 template <> struct SequenceElementTraits<TYPE> { \
1952 static const bool flow = FLOW; \
1959#define LLVM_YAML_IS_SEQUENCE_VECTOR(type) \
1960 LLVM_YAML_IS_SEQUENCE_VECTOR_IMPL(type, false)
1964#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(type) \
1965 LLVM_YAML_IS_SEQUENCE_VECTOR_IMPL(type, true)
1967#define LLVM_YAML_DECLARE_MAPPING_TRAITS(Type) \
1970 template <> struct LLVM_ABI MappingTraits<Type> { \
1971 static void mapping(IO &IO, Type &Obj); \
1976#define LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(Type) \
1979 template <> struct MappingTraits<Type> { \
1980 static void mapping(IO &IO, Type &Obj); \
1985#define LLVM_YAML_DECLARE_ENUM_TRAITS(Type) \
1988 template <> struct LLVM_ABI ScalarEnumerationTraits<Type> { \
1989 static void enumeration(IO &io, Type &Value); \
1994#define LLVM_YAML_DECLARE_BITSET_TRAITS(Type) \
1997 template <> struct LLVM_ABI ScalarBitSetTraits<Type> { \
1998 static void bitset(IO &IO, Type &Options); \
2003#define LLVM_YAML_DECLARE_SCALAR_TRAITS(Type, MustQuote) \
2006 template <> struct LLVM_ABI ScalarTraits<Type> { \
2007 static void output(const Type &Value, void *ctx, raw_ostream &Out); \
2008 static StringRef input(StringRef Scalar, void *ctxt, Type &Value); \
2009 static QuotingType mustQuote(StringRef) { return MustQuote; } \
2016#define LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(_type) \
2019 template <unsigned N> \
2020 struct DocumentListTraits<SmallVector<_type, N>> \
2021 : public SequenceTraitsImpl<SmallVector<_type, N>, false> {}; \
2023 struct DocumentListTraits<std::vector<_type>> \
2024 : public SequenceTraitsImpl<std::vector<_type>, false> {}; \
2030#define LLVM_YAML_IS_STRING_MAP(_type) \
2034 struct CustomMappingTraits<std::map<std::string, _type>> \
2035 : 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
void maskedBitSetCase(T &Val, const char *Str, T ConstVal, T Mask)
virtual void endSequence()=0
void bitSetCase(T &Val, const char *Str, const uint32_t ConstVal)
void mapOptional(const char *Key, T &Val)
virtual void endEnumScalar()=0
void bitSetCase(T &Val, const char *Str, const T ConstVal)
virtual bool outputting() const =0
virtual unsigned beginFlowSequence()=0
virtual bool mapTag(StringRef Tag, bool Default=false)=0
void mapRequired(const char *Key, T &Val, Context &Ctx)
virtual void endFlowSequence()=0
virtual void beginMapping()=0
virtual void setAllowUnknownKeys(bool Allow)
void maskedBitSetCase(T &Val, const char *Str, uint32_t ConstVal, uint32_t Mask)
virtual void endMapping()=0
virtual bool preflightElement(unsigned, void *&)=0
virtual unsigned beginSequence()=0
void mapRequired(const char *Key, T &Val)
virtual void beginEnumScalar()=0
virtual bool matchEnumScalar(const char *, bool)=0
virtual std::error_code error()=0
virtual void scalarString(StringRef &, QuotingType)=0
virtual void setError(const Twine &)=0
virtual bool bitSetMatch(const char *, bool)=0
void * getContext() const
void enumCase(T &Val, const char *Str, const uint32_t ConstVal)
void mapOptionalWithContext(const char *Key, T &Val, Context &Ctx)
virtual void postflightElement(void *)=0
virtual void postflightKey(void *)=0
virtual void endFlowMapping()=0
virtual bool preflightKey(const char *, bool, bool, bool &, void *&)=0
void enumFallback(T &Val)
virtual void beginFlowMapping()=0
virtual bool beginBitSetScalar(bool &)=0
virtual void blockScalarString(StringRef &)=0
virtual void scalarTag(std::string &)=0
virtual bool matchEnumFallback()=0
void enumCase(T &Val, const char *Str, const T ConstVal)
virtual bool preflightFlowElement(unsigned, void *&)=0
virtual void endBitSetScalar()=0
void mapOptionalWithContext(const char *Key, std::optional< T > &Val, Context &Ctx)
void mapOptional(const char *Key, T &Val, const DefaultT &Default)
virtual std::vector< StringRef > keys()=0
void mapOptionalWithContext(const char *Key, T &Val, const DefaultT &Default, Context &Ctx)
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.
static constexpr bool value
@ 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