9 #ifndef LLVM_SUPPORT_YAMLTRAITS_H 10 #define LLVM_SUPPORT_YAMLTRAITS_H 36 #include <system_error> 37 #include <type_traits> 49 struct EmptyContext {};
62 struct MappingTraits {
84 template <
class T,
class Context>
struct MappingContextTraits {
106 template <
typename T,
typename Enable =
void>
struct ScalarEnumerationTraits {
122 template <
typename T,
typename Enable =
void>
struct ScalarBitSetTraits {
148 template <
typename T,
typename Enable =
void>
struct ScalarTraits {
178 template <
typename T>
179 struct BlockScalarTraits {
215 template <
typename T>
struct TaggedScalarTraits {
245 template<
typename T,
typename EnableIf =
void>
246 struct SequenceTraits {
258 template<
typename T,
typename EnableIf =
void>
259 struct SequenceElementTraits {
267 struct DocumentListTraits {
276 template <
typename T>
277 struct CustomMappingTraits {
299 template <
typename T>
struct PolymorphicTraits {
308 template <
typename T>
313 struct has_ScalarEnumerationTraits
315 using Signature_enumeration = void (*)(
class IO&,
T&);
317 template <
typename U>
318 static char test(SameType<Signature_enumeration, &U::enumeration>*);
320 template <
typename U>
321 static double test(...);
323 static bool const value =
324 (
sizeof(test<ScalarEnumerationTraits<T>>(
nullptr)) == 1);
329 struct has_ScalarBitSetTraits
331 using Signature_bitset = void (*)(
class IO&,
T&);
333 template <
typename U>
334 static char test(SameType<Signature_bitset, &U::bitset>*);
336 template <
typename U>
337 static double test(...);
339 static bool const value = (
sizeof(test<ScalarBitSetTraits<T>>(
nullptr)) == 1);
344 struct has_ScalarTraits
346 using Signature_input = StringRef (*)(StringRef,
void*,
T&);
347 using Signature_output = void (*)(
const T&,
void*, raw_ostream&);
348 using Signature_mustQuote = QuotingType (*)(StringRef);
350 template <
typename U>
351 static char test(SameType<Signature_input, &U::input> *,
352 SameType<Signature_output, &U::output> *,
353 SameType<Signature_mustQuote, &U::mustQuote> *);
355 template <
typename U>
356 static double test(...);
358 static bool const value =
359 (
sizeof(test<ScalarTraits<T>>(
nullptr,
nullptr,
nullptr)) == 1);
364 struct has_BlockScalarTraits
366 using Signature_input = StringRef (*)(StringRef,
void *,
T &);
367 using Signature_output = void (*)(
const T &,
void *, raw_ostream &);
369 template <
typename U>
370 static char test(SameType<Signature_input, &U::input> *,
371 SameType<Signature_output, &U::output> *);
373 template <
typename U>
374 static double test(...);
376 static bool const value =
377 (
sizeof(test<BlockScalarTraits<T>>(
nullptr,
nullptr)) == 1);
381 template <
class T>
struct has_TaggedScalarTraits {
382 using Signature_input = StringRef (*)(StringRef, StringRef,
void *,
T &);
383 using Signature_output = void (*)(
const T &,
void *, raw_ostream &,
385 using Signature_mustQuote = QuotingType (*)(
const T &, StringRef);
387 template <
typename U>
388 static char test(SameType<Signature_input, &U::input> *,
389 SameType<Signature_output, &U::output> *,
390 SameType<Signature_mustQuote, &U::mustQuote> *);
392 template <
typename U>
static double test(...);
394 static bool const value =
395 (
sizeof(test<TaggedScalarTraits<T>>(
nullptr,
nullptr,
nullptr)) == 1);
399 template <
class T,
class Context>
struct has_MappingTraits {
400 using Signature_mapping = void (*)(
class IO &,
T &,
Context &);
402 template <
typename U>
403 static char test(SameType<Signature_mapping, &U::mapping>*);
405 template <
typename U>
406 static double test(...);
408 static bool const value =
409 (
sizeof(test<MappingContextTraits<T, Context>>(
nullptr)) == 1);
413 template <
class T>
struct has_MappingTraits<
T, EmptyContext> {
414 using Signature_mapping = void (*)(
class IO &,
T &);
416 template <
typename U>
417 static char test(SameType<Signature_mapping, &U::mapping> *);
419 template <
typename U>
static double test(...);
421 static bool const value = (
sizeof(test<MappingTraits<T>>(
nullptr)) == 1);
425 template <
class T,
class Context>
struct has_MappingValidateTraits {
426 using Signature_validate = std::string (*)(
class IO &,
T &,
Context &);
428 template <
typename U>
429 static char test(SameType<Signature_validate, &U::validate>*);
431 template <
typename U>
432 static double test(...);
434 static bool const value =
435 (
sizeof(test<MappingContextTraits<T, Context>>(
nullptr)) == 1);
439 template <
class T>
struct has_MappingValidateTraits<
T, EmptyContext> {
440 using Signature_validate = std::string (*)(
class IO &,
T &);
442 template <
typename U>
443 static char test(SameType<Signature_validate, &U::validate> *);
445 template <
typename U>
static double test(...);
447 static bool const value = (
sizeof(test<MappingTraits<T>>(
nullptr)) == 1);
452 struct has_SequenceMethodTraits
454 using Signature_size =
size_t (*)(
class IO&,
T&);
456 template <
typename U>
457 static char test(SameType<Signature_size, &U::size>*);
459 template <
typename U>
460 static double test(...);
462 static bool const value = (
sizeof(test<SequenceTraits<T>>(
nullptr)) == 1);
467 struct has_CustomMappingTraits
469 using Signature_input = void (*)(IO &io, StringRef key,
T &v);
471 template <
typename U>
472 static char test(SameType<Signature_input, &U::inputOne>*);
474 template <
typename U>
475 static double test(...);
477 static bool const value =
478 (
sizeof(test<CustomMappingTraits<T>>(
nullptr)) == 1);
484 template <typename T, bool Enabled = std::is_class<T>::value>
488 static const bool value =
false;
495 struct has_FlowTraits<
T,
true>
497 struct Fallback {
bool flow; };
498 struct Derived :
T, Fallback { };
501 static char (&f(SameType<bool Fallback::*, &C::flow>*))[1];
504 static char (&f(...))[2];
506 static bool const value =
sizeof(f<Derived>(
nullptr)) == 2;
511 struct has_SequenceTraits :
public std::integral_constant<bool,
512 has_SequenceMethodTraits<T>::value > { };
516 struct has_DocumentListTraits
518 using Signature_size =
size_t (*)(
class IO &,
T &);
520 template <
typename U>
521 static char test(SameType<Signature_size, &U::size>*);
523 template <
typename U>
524 static double test(...);
526 static bool const value = (
sizeof(test<DocumentListTraits<T>>(
nullptr))==1);
529 template <
class T>
struct has_PolymorphicTraits {
530 using Signature_getKind =
NodeKind (*)(
const T &);
532 template <
typename U>
533 static char test(SameType<Signature_getKind, &U::getKind> *);
535 template <
typename U>
static double test(...);
537 static bool const value = (
sizeof(test<PolymorphicTraits<T>>(
nullptr)) == 1);
540 inline bool isNumeric(StringRef S) {
541 const static auto skipDigits = [](StringRef Input) {
542 return Input.drop_front(
543 std::min(Input.find_first_not_of(
"0123456789"), Input.size()));
548 if (S.empty() || S.equals(
"+") || S.equals(
"-"))
551 if (S.equals(
".nan") || S.equals(
".NaN") || S.equals(
".NAN"))
555 StringRef
Tail = (S.front() ==
'-' || S.front() ==
'+') ? S.drop_front() : S;
559 if (
Tail.equals(
".inf") ||
Tail.equals(
".Inf") ||
Tail.equals(
".INF"))
565 if (S.startswith(
"0o"))
566 return S.size() > 2 &&
569 if (S.startswith(
"0x"))
570 return S.size() > 2 && S.drop_front(2).find_first_not_of(
579 if (S.startswith(
".") &&
581 (S.size() > 1 && std::strchr(
"0123456789", S[1]) ==
nullptr)))
584 if (S.startswith(
"E") || S.startswith(
"e"))
600 if (S.front() ==
'.') {
603 }
else if (S.front() ==
'e' || S.front() ==
'E') {
604 State = FoundExponent;
610 if (State == FoundDot) {
615 if (S.front() ==
'e' || S.front() ==
'E') {
616 State = FoundExponent;
623 assert(State == FoundExponent &&
"Should have found exponent at this point.");
627 if (S.front() ==
'+' || S.front() ==
'-') {
633 return skipDigits(S).empty();
636 inline bool isNull(StringRef S) {
637 return S.equals(
"null") || S.equals(
"Null") || S.equals(
"NULL") ||
641 inline bool isBool(StringRef S) {
643 return S.equals(
"true") || S.equals(
"True") || S.equals(
"TRUE") ||
644 S.equals(
"false") || S.equals(
"False") || S.equals(
"FALSE");
652 inline QuotingType needsQuotes(StringRef S) {
657 if (isSpace(static_cast<unsigned char>(S.front())) ||
658 isSpace(static_cast<unsigned char>(S.back())))
670 static constexpr
char Indicators[] = R
"(-?:\,[]{}#&*!|>'"%@`)"; 671 if (S.find_first_of(Indicators) == 0)
674 for (
unsigned char C : S) {
721 return MaxQuotingNeeded;
724 template <
typename T,
typename Context>
726 :
public std::integral_constant<bool,
727 !has_ScalarEnumerationTraits<T>::value &&
728 !has_ScalarBitSetTraits<T>::value &&
729 !has_ScalarTraits<T>::value &&
730 !has_BlockScalarTraits<T>::value &&
731 !has_TaggedScalarTraits<T>::value &&
732 !has_MappingTraits<T, Context>::value &&
733 !has_SequenceTraits<T>::value &&
734 !has_CustomMappingTraits<T>::value &&
735 !has_DocumentListTraits<T>::value &&
736 !has_PolymorphicTraits<T>::value> {};
738 template <
typename T,
typename Context>
739 struct validatedMappingTraits
740 :
public std::integral_constant<
741 bool, has_MappingTraits<T, Context>::value &&
742 has_MappingValidateTraits<T, Context>::value> {};
744 template <
typename T,
typename Context>
745 struct unvalidatedMappingTraits
746 :
public std::integral_constant<
747 bool, has_MappingTraits<T, Context>::value &&
748 !has_MappingValidateTraits<T, Context>::value> {};
753 IO(
void *Ctxt =
nullptr);
756 virtual bool outputting()
const = 0;
758 virtual unsigned beginSequence() = 0;
759 virtual bool preflightElement(
unsigned,
void *&) = 0;
760 virtual void postflightElement(
void*) = 0;
761 virtual void endSequence() = 0;
762 virtual bool canElideEmptySequence() = 0;
764 virtual unsigned beginFlowSequence() = 0;
765 virtual bool preflightFlowElement(
unsigned,
void *&) = 0;
766 virtual void postflightFlowElement(
void*) = 0;
767 virtual void endFlowSequence() = 0;
769 virtual bool mapTag(StringRef Tag,
bool Default=
false) = 0;
770 virtual void beginMapping() = 0;
771 virtual void endMapping() = 0;
772 virtual bool preflightKey(
const char*,
bool,
bool,
bool &,
void *&) = 0;
773 virtual void postflightKey(
void*) = 0;
774 virtual std::vector<StringRef> keys() = 0;
776 virtual void beginFlowMapping() = 0;
777 virtual void endFlowMapping() = 0;
779 virtual void beginEnumScalar() = 0;
780 virtual bool matchEnumScalar(
const char*,
bool) = 0;
781 virtual bool matchEnumFallback() = 0;
782 virtual void endEnumScalar() = 0;
784 virtual bool beginBitSetScalar(
bool &) = 0;
785 virtual bool bitSetMatch(
const char*,
bool) = 0;
786 virtual void endBitSetScalar() = 0;
788 virtual void scalarString(StringRef &, QuotingType) = 0;
789 virtual void blockScalarString(StringRef &) = 0;
790 virtual void scalarTag(std::string &) = 0;
794 virtual void setError(
const Twine &) = 0;
795 virtual void setAllowUnknownKeys(
bool Allow);
797 template <
typename T>
798 void enumCase(
T &Val,
const char* Str,
const T ConstVal) {
799 if ( matchEnumScalar(Str, outputting() && Val == ConstVal) ) {
805 template <
typename T>
806 void enumCase(
T &Val,
const char* Str,
const uint32_t ConstVal) {
807 if ( matchEnumScalar(Str, outputting() && Val == static_cast<T>(ConstVal)) ) {
812 template <
typename FBT,
typename T>
813 void enumFallback(
T &Val) {
814 if (matchEnumFallback()) {
817 FBT Res = static_cast<typename FBT::BaseType>(Val);
818 yamlize(*
this, Res,
true,
Context);
819 Val = static_cast<T>(static_cast<typename FBT::BaseType>(Res));
823 template <
typename T>
824 void bitSetCase(
T &Val,
const char* Str,
const T ConstVal) {
825 if ( bitSetMatch(Str, outputting() && (Val & ConstVal) == ConstVal) ) {
826 Val = static_cast<T>(Val | ConstVal);
831 template <
typename T>
832 void bitSetCase(
T &Val,
const char* Str,
const uint32_t ConstVal) {
833 if ( bitSetMatch(Str, outputting() && (Val & ConstVal) == ConstVal) ) {
834 Val = static_cast<T>(Val | ConstVal);
838 template <
typename T>
839 void maskedBitSetCase(
T &Val,
const char *Str,
T ConstVal,
T Mask) {
840 if (bitSetMatch(Str, outputting() && (Val &
Mask) == ConstVal))
841 Val = Val | ConstVal;
844 template <
typename T>
845 void maskedBitSetCase(
T &Val,
const char *Str,
uint32_t ConstVal,
847 if (bitSetMatch(Str, outputting() && (Val &
Mask) == ConstVal))
848 Val = Val | ConstVal;
851 void *getContext()
const;
852 void setContext(
void *);
854 template <
typename T>
void mapRequired(
const char *
Key,
T &Val) {
856 this->processKey(
Key, Val,
true, Ctx);
859 template <
typename T,
typename Context>
860 void mapRequired(
const char *
Key,
T &Val,
Context &Ctx) {
861 this->processKey(
Key, Val,
true, Ctx);
866 mapOptionalWithContext(
Key, Val, Ctx);
869 template <
typename T,
typename DefaultT>
872 mapOptionalWithContext(
Key, Val, Default, Ctx);
875 template <
typename T,
typename Context>
876 std::enable_if_t<has_SequenceTraits<T>::value,
void>
877 mapOptionalWithContext(
const char *
Key,
T &Val,
Context &Ctx) {
879 if (this->canElideEmptySequence() && !(Val.begin() != Val.end()))
881 this->processKey(
Key, Val,
false, Ctx);
884 template <
typename T,
typename Context>
885 void mapOptionalWithContext(
const char *
Key, Optional<T> &Val,
Context &Ctx) {
886 this->processKeyWithDefault(
Key, Val, Optional<T>(),
false,
890 template <
typename T,
typename Context>
891 std::enable_if_t<!has_SequenceTraits<T>::value,
void>
892 mapOptionalWithContext(
const char *
Key,
T &Val,
Context &Ctx) {
893 this->processKey(
Key, Val,
false, Ctx);
896 template <
typename T,
typename Context,
typename DefaultT>
897 void mapOptionalWithContext(
const char *
Key,
T &Val,
const DefaultT &Default,
899 static_assert(std::is_convertible<DefaultT, T>::value,
900 "Default type must be implicitly convertible to value type!");
901 this->processKeyWithDefault(
Key, Val, static_cast<const T &>(Default),
906 template <
typename T,
typename Context>
907 void processKeyWithDefault(
const char *
Key, Optional<T> &Val,
908 const Optional<T> &DefaultValue,
bool Required,
911 template <
typename T,
typename Context>
912 void processKeyWithDefault(
const char *
Key,
T &Val,
const T &DefaultValue,
916 const bool sameAsDefault = outputting() && Val == DefaultValue;
917 if ( this->preflightKey(
Key,
Required, sameAsDefault, UseDefault,
920 this->postflightKey(SaveInfo);
928 template <
typename T,
typename Context>
932 if ( this->preflightKey(
Key,
Required,
false, UseDefault, SaveInfo) ) {
934 this->postflightKey(SaveInfo);
944 template <
typename T,
typename Context>
945 void doMapping(IO &io,
T &Val,
Context &Ctx) {
946 MappingContextTraits<T, Context>::mapping(io, Val, Ctx);
949 template <
typename T>
void doMapping(IO &io,
T &Val, EmptyContext &Ctx) {
950 MappingTraits<T>::mapping(io, Val);
955 template <
typename T>
956 std::enable_if_t<has_ScalarEnumerationTraits<T>::value,
void>
957 yamlize(IO &io,
T &Val,
bool, EmptyContext &Ctx) {
958 io.beginEnumScalar();
959 ScalarEnumerationTraits<T>::enumeration(io, Val);
963 template <
typename T>
964 std::enable_if_t<has_ScalarBitSetTraits<T>::value,
void>
965 yamlize(IO &io,
T &Val,
bool, EmptyContext &Ctx) {
967 if ( io.beginBitSetScalar(DoClear) ) {
970 ScalarBitSetTraits<T>::bitset(io, Val);
971 io.endBitSetScalar();
975 template <
typename T>
976 std::enable_if_t<has_ScalarTraits<T>::value,
void> yamlize(IO &io,
T &Val,
bool,
978 if ( io.outputting() ) {
980 raw_string_ostream Buffer(Storage);
981 ScalarTraits<T>::output(Val, io.getContext(), Buffer);
982 StringRef Str = Buffer.str();
983 io.scalarString(Str, ScalarTraits<T>::mustQuote(Str));
987 io.scalarString(Str, ScalarTraits<T>::mustQuote(Str));
988 StringRef
Result = ScalarTraits<T>::input(Str, io.getContext(), Val);
990 io.setError(Twine(Result));
995 template <
typename T>
996 std::enable_if_t<has_BlockScalarTraits<T>::value,
void>
997 yamlize(IO &
YamlIO,
T &Val,
bool, EmptyContext &Ctx) {
998 if (
YamlIO.outputting()) {
1000 raw_string_ostream Buffer(Storage);
1001 BlockScalarTraits<T>::output(Val,
YamlIO.getContext(), Buffer);
1002 StringRef Str = Buffer.str();
1003 YamlIO.blockScalarString(Str);
1006 YamlIO.blockScalarString(Str);
1008 BlockScalarTraits<T>::input(Str,
YamlIO.getContext(), Val);
1010 YamlIO.setError(Twine(Result));
1014 template <
typename T>
1015 std::enable_if_t<has_TaggedScalarTraits<T>::value,
void>
1016 yamlize(IO &io,
T &Val,
bool, EmptyContext &Ctx) {
1017 if (io.outputting()) {
1018 std::string ScalarStorage, TagStorage;
1019 raw_string_ostream ScalarBuffer(ScalarStorage), TagBuffer(TagStorage);
1020 TaggedScalarTraits<T>::output(Val, io.getContext(), ScalarBuffer,
1022 io.scalarTag(TagBuffer.str());
1023 StringRef ScalarStr = ScalarBuffer.str();
1024 io.scalarString(ScalarStr,
1025 TaggedScalarTraits<T>::mustQuote(Val, ScalarStr));
1032 TaggedScalarTraits<T>::input(Str, Tag, io.getContext(), Val);
1034 io.setError(Twine(Result));
1039 template <
typename T,
typename Context>
1040 std::enable_if_t<validatedMappingTraits<T, Context>::value,
void>
1041 yamlize(IO &io,
T &Val,
bool,
Context &Ctx) {
1042 if (has_FlowTraits<MappingTraits<T>>::value)
1043 io.beginFlowMapping();
1046 if (io.outputting()) {
1049 errs() << Err <<
"\n";
1050 assert(Err.empty() &&
"invalid struct trying to be written as yaml");
1053 detail::doMapping(io, Val, Ctx);
1054 if (!io.outputting()) {
1059 if (has_FlowTraits<MappingTraits<T>>::value)
1060 io.endFlowMapping();
1065 template <
typename T,
typename Context>
1066 std::enable_if_t<unvalidatedMappingTraits<T, Context>::value,
void>
1067 yamlize(IO &io,
T &Val,
bool,
Context &Ctx) {
1068 if (has_FlowTraits<MappingTraits<T>>::value) {
1069 io.beginFlowMapping();
1070 detail::doMapping(io, Val, Ctx);
1071 io.endFlowMapping();
1074 detail::doMapping(io, Val, Ctx);
1079 template <
typename T>
1080 std::enable_if_t<has_CustomMappingTraits<T>::value,
void>
1081 yamlize(IO &io,
T &Val,
bool, EmptyContext &Ctx) {
1082 if ( io.outputting() ) {
1084 CustomMappingTraits<T>::output(io, Val);
1088 for (StringRef key : io.keys())
1089 CustomMappingTraits<T>::inputOne(io, key, Val);
1094 template <
typename T>
1095 std::enable_if_t<has_PolymorphicTraits<T>::value,
void>
1096 yamlize(IO &io,
T &Val,
bool, EmptyContext &Ctx) {
1097 switch (io.outputting() ? PolymorphicTraits<T>::getKind(Val)
1098 : io.getNodeKind()) {
1100 return yamlize(io, PolymorphicTraits<T>::getAsScalar(Val),
true, Ctx);
1102 return yamlize(io, PolymorphicTraits<T>::getAsMap(Val),
true, Ctx);
1104 return yamlize(io, PolymorphicTraits<T>::getAsSequence(Val),
true, Ctx);
1108 template <
typename T>
1109 std::enable_if_t<missingTraits<T, EmptyContext>::value,
void>
1110 yamlize(IO &io,
T &Val,
bool, EmptyContext &Ctx) {
1111 char missing_yaml_trait_for_type[
sizeof(MissingTrait<T>)];
1114 template <
typename T,
typename Context>
1115 std::enable_if_t<has_SequenceTraits<T>::value,
void>
1116 yamlize(IO &io,
T &Seq,
bool,
Context &Ctx) {
1117 if ( has_FlowTraits< SequenceTraits<T>>::value ) {
1118 unsigned incnt = io.beginFlowSequence();
1120 for(
unsigned i=0; i <
count; ++i) {
1122 if ( io.preflightFlowElement(i, SaveInfo) ) {
1123 yamlize(io, SequenceTraits<T>::element(io, Seq, i),
true, Ctx);
1124 io.postflightFlowElement(SaveInfo);
1127 io.endFlowSequence();
1130 unsigned incnt = io.beginSequence();
1132 for(
unsigned i=0; i <
count; ++i) {
1134 if ( io.preflightElement(i, SaveInfo) ) {
1135 yamlize(io, SequenceTraits<T>::element(io, Seq, i),
true, Ctx);
1136 io.postflightElement(SaveInfo);
1144 struct ScalarTraits<
bool> {
1145 static void output(
const bool &,
void* , raw_ostream &);
1146 static StringRef input(StringRef,
void *,
bool &);
1151 struct ScalarTraits<StringRef> {
1152 static void output(
const StringRef &,
void *, raw_ostream &);
1153 static StringRef input(StringRef,
void *, StringRef &);
1154 static QuotingType mustQuote(StringRef S) {
return needsQuotes(S); }
1159 static void output(
const std::string &,
void *, raw_ostream &);
1160 static StringRef input(StringRef,
void *, std::string &);
1161 static QuotingType mustQuote(StringRef S) {
return needsQuotes(S); }
1165 struct ScalarTraits<uint8_t> {
1166 static void output(
const uint8_t &,
void *, raw_ostream &);
1167 static StringRef input(StringRef,
void *, uint8_t &);
1173 static void output(
const uint16_t &,
void *, raw_ostream &);
1174 static StringRef input(StringRef,
void *,
uint16_t &);
1180 static void output(
const uint32_t &,
void *, raw_ostream &);
1181 static StringRef input(StringRef,
void *,
uint32_t &);
1186 struct ScalarTraits<uint64_t> {
1187 static void output(
const uint64_t &,
void *, raw_ostream &);
1188 static StringRef input(StringRef,
void *, uint64_t &);
1193 struct ScalarTraits<int8_t> {
1194 static void output(
const int8_t &,
void *, raw_ostream &);
1195 static StringRef input(StringRef,
void *, int8_t &);
1200 struct ScalarTraits<int16_t> {
1201 static void output(
const int16_t &,
void *, raw_ostream &);
1202 static StringRef input(StringRef,
void *, int16_t &);
1207 struct ScalarTraits<int32_t> {
1208 static void output(
const int32_t &,
void *, raw_ostream &);
1209 static StringRef input(StringRef,
void *, int32_t &);
1214 struct ScalarTraits<int64_t> {
1215 static void output(
const int64_t &,
void *, raw_ostream &);
1216 static StringRef input(StringRef,
void *, int64_t &);
1221 struct ScalarTraits<float> {
1222 static void output(
const float &,
void *, raw_ostream &);
1223 static StringRef input(StringRef,
void *,
float &);
1228 struct ScalarTraits<double> {
1229 static void output(
const double &,
void *, raw_ostream &);
1230 static StringRef input(StringRef,
void *,
double &);
1237 template <
typename value_type, support::endianness endian,
size_t alignment>
1238 struct ScalarTraits<support::detail::packed_endian_specific_integral<
1239 value_type, endian, alignment>,
1240 std::enable_if_t<has_ScalarTraits<value_type>::value>> {
1242 support::detail::packed_endian_specific_integral<value_type,
endian,
1245 static void output(
const endian_type &
E,
void *Ctx, raw_ostream &Stream) {
1246 ScalarTraits<value_type>::output(static_cast<value_type>(
E), Ctx, Stream);
1249 static StringRef input(StringRef Str,
void *Ctx, endian_type &
E) {
1251 auto R = ScalarTraits<value_type>::input(Str, Ctx, V);
1252 E = static_cast<endian_type>(V);
1256 static QuotingType mustQuote(StringRef Str) {
1257 return ScalarTraits<value_type>::mustQuote(Str);
1261 template <
typename value_type, support::endianness endian,
size_t alignment>
1262 struct ScalarEnumerationTraits<
1263 support::detail::packed_endian_specific_integral<value_type, endian,
1265 std::enable_if_t<has_ScalarEnumerationTraits<value_type>::value>> {
1267 support::detail::packed_endian_specific_integral<value_type,
endian,
1270 static void enumeration(IO &io, endian_type &
E) {
1272 ScalarEnumerationTraits<value_type>::enumeration(io, V);
1277 template <
typename value_type, support::endianness endian,
size_t alignment>
1278 struct ScalarBitSetTraits<
1279 support::detail::packed_endian_specific_integral<value_type, endian,
1281 std::enable_if_t<has_ScalarBitSetTraits<value_type>::value>> {
1283 support::detail::packed_endian_specific_integral<value_type,
endian,
1285 static void bitset(IO &io, endian_type &
E) {
1287 ScalarBitSetTraits<value_type>::bitset(io, V);
1294 template <
typename TNorm,
typename TFinal>
1295 struct MappingNormalization {
1296 MappingNormalization(IO &i_o, TFinal &Obj)
1297 : io(i_o), BufPtr(nullptr),
Result(Obj) {
1298 if ( io.outputting() ) {
1299 BufPtr =
new (&Buffer) TNorm(io, Obj);
1302 BufPtr =
new (&Buffer) TNorm(io);
1306 ~MappingNormalization() {
1307 if ( ! io.outputting() ) {
1308 Result = BufPtr->denormalize(io);
1313 TNorm* operator->() {
return BufPtr; }
1316 using Storage = AlignedCharArrayUnion<TNorm>;
1326 template <
typename TNorm,
typename TFinal>
1327 struct MappingNormalizationHeap {
1328 MappingNormalizationHeap(IO &i_o, TFinal &Obj,
BumpPtrAllocator *allocator)
1330 if ( io.outputting() ) {
1331 BufPtr =
new (&Buffer) TNorm(io, Obj);
1333 else if (allocator) {
1335 new (BufPtr) TNorm(io);
1337 BufPtr =
new TNorm(io);
1341 ~MappingNormalizationHeap() {
1342 if ( io.outputting() ) {
1346 Result = BufPtr->denormalize(io);
1350 TNorm* operator->() {
return BufPtr; }
1353 using Storage = AlignedCharArrayUnion<TNorm>;
1357 TNorm *BufPtr =
nullptr;
1373 class Input :
public IO {
1378 Input(StringRef InputContent,
1379 void *Ctxt =
nullptr,
1381 void *DiagHandlerCtxt =
nullptr);
1382 Input(MemoryBufferRef Input,
1383 void *Ctxt =
nullptr,
1385 void *DiagHandlerCtxt =
nullptr);
1389 std::error_code
error();
1392 bool outputting()
const override;
1393 bool mapTag(StringRef,
bool)
override;
1394 void beginMapping()
override;
1395 void endMapping()
override;
1396 bool preflightKey(
const char *,
bool,
bool,
bool &,
void *&)
override;
1397 void postflightKey(
void *)
override;
1398 std::vector<StringRef> keys()
override;
1399 void beginFlowMapping()
override;
1400 void endFlowMapping()
override;
1401 unsigned beginSequence()
override;
1402 void endSequence()
override;
1403 bool preflightElement(
unsigned index,
void *&)
override;
1404 void postflightElement(
void *)
override;
1405 unsigned beginFlowSequence()
override;
1406 bool preflightFlowElement(
unsigned ,
void *&)
override;
1407 void postflightFlowElement(
void *)
override;
1408 void endFlowSequence()
override;
1409 void beginEnumScalar()
override;
1410 bool matchEnumScalar(
const char*,
bool)
override;
1411 bool matchEnumFallback()
override;
1412 void endEnumScalar()
override;
1413 bool beginBitSetScalar(
bool &)
override;
1414 bool bitSetMatch(
const char *,
bool )
override;
1415 void endBitSetScalar()
override;
1416 void scalarString(StringRef &, QuotingType)
override;
1417 void blockScalarString(StringRef &)
override;
1418 void scalarTag(std::string &)
override;
1420 void setError(
const Twine &message)
override;
1421 bool canElideEmptySequence()
override;
1424 virtual void anchor();
1427 HNode(
Node *n) : _node(n) { }
1428 virtual ~HNode() =
default;
1430 static bool classof(
const HNode *) {
return true; }
1435 class EmptyHNode :
public HNode {
1436 void anchor()
override;
1439 EmptyHNode(
Node *n) : HNode(n) { }
1443 static bool classof(
const EmptyHNode *) {
return true; }
1446 class ScalarHNode :
public HNode {
1447 void anchor()
override;
1450 ScalarHNode(
Node *n, StringRef s) : HNode(n), _value(s) { }
1452 StringRef value()
const {
return _value; }
1454 static bool classof(
const HNode *n) {
1459 static bool classof(
const ScalarHNode *) {
return true; }
1465 class MapHNode :
public HNode {
1466 void anchor()
override;
1469 MapHNode(
Node *n) : HNode(n) { }
1471 static bool classof(
const HNode *n) {
1475 static bool classof(
const MapHNode *) {
return true; }
1477 using NameToNodeAndLoc =
1478 StringMap<std::pair<std::unique_ptr<HNode>, SMRange>>;
1480 NameToNodeAndLoc Mapping;
1481 SmallVector<std::string, 6> ValidKeys;
1484 class SequenceHNode :
public HNode {
1485 void anchor()
override;
1488 SequenceHNode(
Node *n) : HNode(n) { }
1490 static bool classof(
const HNode *n) {
1494 static bool classof(
const SequenceHNode *) {
return true; }
1496 std::vector<std::unique_ptr<HNode>> Entries;
1499 std::unique_ptr<Input::HNode> createHNodes(
Node *node);
1500 void setError(HNode *hnode,
const Twine &message);
1501 void setError(
Node *node,
const Twine &message);
1502 void setError(
const SMRange &Range,
const Twine &message);
1504 void reportWarning(HNode *hnode,
const Twine &message);
1505 void reportWarning(
Node *hnode,
const Twine &message);
1506 void reportWarning(
const SMRange &Range,
const Twine &message);
1511 bool setCurrentDocument();
1512 bool nextDocument();
1515 const Node *getCurrentNode()
const;
1517 void setAllowUnknownKeys(
bool Allow)
override;
1521 std::unique_ptr<llvm::yaml::Stream> Strm;
1522 std::unique_ptr<HNode> TopNode;
1525 document_iterator DocIterator;
1526 std::vector<bool> BitValuesUsed;
1527 HNode *CurrentNode =
nullptr;
1528 bool ScalarMatchFound =
false;
1529 bool AllowUnknownKeys =
false;
1536 class Output :
public IO {
1538 Output(raw_ostream &,
void *Ctxt =
nullptr,
int WrapColumn = 70);
1546 void setWriteDefaultValues(
bool Write) { WriteDefaultValues =
Write; }
1548 bool outputting()
const override;
1549 bool mapTag(StringRef,
bool)
override;
1550 void beginMapping()
override;
1551 void endMapping()
override;
1552 bool preflightKey(
const char *key,
bool,
bool,
bool &,
void *&)
override;
1553 void postflightKey(
void *)
override;
1554 std::vector<StringRef> keys()
override;
1555 void beginFlowMapping()
override;
1556 void endFlowMapping()
override;
1557 unsigned beginSequence()
override;
1558 void endSequence()
override;
1559 bool preflightElement(
unsigned,
void *&)
override;
1560 void postflightElement(
void *)
override;
1561 unsigned beginFlowSequence()
override;
1562 bool preflightFlowElement(
unsigned,
void *&)
override;
1563 void postflightFlowElement(
void *)
override;
1564 void endFlowSequence()
override;
1565 void beginEnumScalar()
override;
1566 bool matchEnumScalar(
const char*,
bool)
override;
1567 bool matchEnumFallback()
override;
1568 void endEnumScalar()
override;
1569 bool beginBitSetScalar(
bool &)
override;
1570 bool bitSetMatch(
const char *,
bool )
override;
1571 void endBitSetScalar()
override;
1572 void scalarString(StringRef &, QuotingType)
override;
1573 void blockScalarString(StringRef &)
override;
1574 void scalarTag(std::string &)
override;
1576 void setError(
const Twine &message)
override;
1577 bool canElideEmptySequence()
override;
1581 void beginDocuments();
1582 bool preflightDocument(
unsigned);
1583 void postflightDocument();
1584 void endDocuments();
1587 void output(StringRef s);
1588 void outputUpToEndOfLine(StringRef s);
1589 void newLineCheck();
1590 void outputNewLine();
1591 void paddedKey(StringRef key);
1592 void flowKey(StringRef
Key);
1597 inFlowSeqFirstElement,
1598 inFlowSeqOtherElement,
1605 static bool inSeqAnyElement(InState State);
1606 static bool inFlowSeqAnyElement(InState State);
1607 static bool inMapAnyKey(InState State);
1608 static bool inFlowMapAnyKey(InState State);
1612 SmallVector<InState, 8> StateStack;
1614 int ColumnAtFlowStart = 0;
1615 int ColumnAtMapFlowStart = 0;
1616 bool NeedBitValueComma =
false;
1617 bool NeedFlowSequenceComma =
false;
1618 bool EnumerationMatchFound =
false;
1619 bool WriteDefaultValues =
false;
1621 StringRef PaddingBeforeContainer;
1624 template <
typename T,
typename Context>
1625 void IO::processKeyWithDefault(
const char *
Key, Optional<T> &Val,
1626 const Optional<T> &DefaultValue,
bool Required,
1628 assert(DefaultValue.hasValue() ==
false &&
1629 "Optional<T> shouldn't have a value!");
1631 bool UseDefault =
true;
1632 const bool sameAsDefault = outputting() && !Val.hasValue();
1633 if (!outputting() && !Val.hasValue())
1635 if (Val.hasValue() &&
1636 this->preflightKey(
Key,
Required, sameAsDefault, UseDefault, SaveInfo)) {
1642 bool IsNone =
false;
1644 if (
auto *
Node = dyn_cast<ScalarNode>(((Input *)
this)->getCurrentNode()))
1647 IsNone =
Node->getRawValue().rtrim(
' ') ==
"<none>";
1652 yamlize(*
this, Val.getValue(),
Required, Ctx);
1653 this->postflightKey(SaveInfo);
1668 #define LLVM_YAML_STRONG_TYPEDEF(_base, _type) \ 1670 _type() = default; \ 1671 _type(const _base v) : value(v) {} \ 1672 _type(const _type &v) = default; \ 1673 _type &operator=(const _type &rhs) = default; \ 1674 _type &operator=(const _base &rhs) { value = rhs; return *this; } \ 1675 operator const _base & () const { return value; } \ 1676 bool operator==(const _type &rhs) const { return value == rhs.value; } \ 1677 bool operator==(const _base &rhs) const { return value == rhs; } \ 1678 bool operator<(const _type &rhs) const { return value < rhs.value; } \ 1680 using BaseType = _base; \ 1687 LLVM_YAML_STRONG_TYPEDEF(uint8_t, Hex8)
1688 LLVM_YAML_STRONG_TYPEDEF(
uint16_t, Hex16)
1689 LLVM_YAML_STRONG_TYPEDEF(
uint32_t, Hex32)
1690 LLVM_YAML_STRONG_TYPEDEF(uint64_t, Hex64)
1693 struct ScalarTraits<Hex8> {
1694 static void output(
const Hex8 &,
void *, raw_ostream &);
1695 static StringRef input(StringRef,
void *, Hex8 &);
1700 struct ScalarTraits<Hex16> {
1701 static void output(
const Hex16 &,
void *, raw_ostream &);
1702 static StringRef input(StringRef,
void *, Hex16 &);
1707 struct ScalarTraits<Hex32> {
1708 static void output(
const Hex32 &,
void *, raw_ostream &);
1709 static StringRef input(StringRef,
void *, Hex32 &);
1714 struct ScalarTraits<Hex64> {
1715 static void output(
const Hex64 &,
void *, raw_ostream &);
1716 static StringRef input(StringRef,
void *, Hex64 &);
1720 template <>
struct ScalarTraits<VersionTuple> {
1722 static StringRef input(StringRef,
void *, VersionTuple &);
1727 template <
typename T>
1728 inline std::enable_if_t<has_DocumentListTraits<T>::value, Input &>
1732 while ( yin.setCurrentDocument() ) {
1733 yamlize(yin, DocumentListTraits<T>::element(yin, docList, i),
true, Ctx);
1743 template <
typename T>
1744 inline std::enable_if_t<has_MappingTraits<T, EmptyContext>::value, Input &>
1747 yin.setCurrentDocument();
1748 yamlize(yin, docMap,
true, Ctx);
1754 template <
typename T>
1755 inline std::enable_if_t<has_SequenceTraits<T>::value, Input &>
1758 if (yin.setCurrentDocument())
1759 yamlize(yin, docSeq,
true, Ctx);
1764 template <
typename T>
1765 inline std::enable_if_t<has_BlockScalarTraits<T>::value, Input &>
1768 if (
In.setCurrentDocument())
1769 yamlize(
In, Val,
true, Ctx);
1774 template <
typename T>
1775 inline std::enable_if_t<has_CustomMappingTraits<T>::value, Input &>
1778 if (
In.setCurrentDocument())
1779 yamlize(
In, Val,
true, Ctx);
1784 template <
typename T>
1785 inline std::enable_if_t<has_PolymorphicTraits<T>::value, Input &>
1788 if (
In.setCurrentDocument())
1789 yamlize(
In, Val,
true, Ctx);
1794 template <
typename T>
1795 inline std::enable_if_t<missingTraits<T, EmptyContext>::value, Input &>
1797 char missing_yaml_trait_for_type[
sizeof(MissingTrait<T>)];
1802 template <
typename T>
1803 inline std::enable_if_t<has_DocumentListTraits<T>::value, Output &>
1806 yout.beginDocuments();
1808 for(
size_t i=0; i <
count; ++i) {
1809 if ( yout.preflightDocument(i) ) {
1810 yamlize(yout, DocumentListTraits<T>::element(yout, docList, i),
true,
1812 yout.postflightDocument();
1815 yout.endDocuments();
1820 template <
typename T>
1821 inline std::enable_if_t<has_MappingTraits<T, EmptyContext>::value, Output &>
1824 yout.beginDocuments();
1825 if ( yout.preflightDocument(0) ) {
1826 yamlize(yout, map,
true, Ctx);
1827 yout.postflightDocument();
1829 yout.endDocuments();
1834 template <
typename T>
1835 inline std::enable_if_t<has_SequenceTraits<T>::value, Output &>
1838 yout.beginDocuments();
1839 if ( yout.preflightDocument(0) ) {
1840 yamlize(yout,
seq,
true, Ctx);
1841 yout.postflightDocument();
1843 yout.endDocuments();
1848 template <
typename T>
1849 inline std::enable_if_t<has_BlockScalarTraits<T>::value, Output &>
1852 Out.beginDocuments();
1853 if (Out.preflightDocument(0)) {
1854 yamlize(Out, Val,
true, Ctx);
1855 Out.postflightDocument();
1862 template <
typename T>
1863 inline std::enable_if_t<has_CustomMappingTraits<T>::value, Output &>
1866 Out.beginDocuments();
1867 if (Out.preflightDocument(0)) {
1868 yamlize(Out, Val,
true, Ctx);
1869 Out.postflightDocument();
1877 template <
typename T>
1878 inline std::enable_if_t<has_PolymorphicTraits<T>::value, Output &>
1881 Out.beginDocuments();
1882 if (Out.preflightDocument(0)) {
1885 assert(PolymorphicTraits<T>::getKind(Val) !=
NodeKind::Scalar &&
"plain scalar documents are not supported");
1886 yamlize(Out, Val,
true, Ctx);
1887 Out.postflightDocument();
1894 template <
typename T>
1895 inline std::enable_if_t<missingTraits<T, EmptyContext>::value, Output &>
1897 char missing_yaml_trait_for_type[
sizeof(MissingTrait<T>)];
1901 template <
bool B>
struct IsFlowSequenceBase {};
1902 template <>
struct IsFlowSequenceBase<
true> {
static const bool flow =
true; };
1904 template <
typename T,
bool Flow>
1905 struct SequenceTraitsImpl : IsFlowSequenceBase<Flow> {
1907 using type =
typename T::value_type;
1910 static size_t size(IO &io,
T &
seq) {
return seq.size(); }
1912 static type &element(IO &io,
T &
seq,
size_t index) {
1913 if (index >=
seq.size())
1914 seq.resize(index + 1);
1921 template <
bool>
struct CheckIsBool {
static const bool value =
true; };
1925 template <
typename T>
1926 struct SequenceTraits<
1928 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1929 : SequenceTraitsImpl<std::vector<T>, SequenceElementTraits<T>::flow> {};
1930 template <
typename T,
unsigned N>
1931 struct SequenceTraits<
1933 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1934 : SequenceTraitsImpl<SmallVector<T, N>, SequenceElementTraits<T>::flow> {};
1935 template <
typename T>
1936 struct SequenceTraits<
1938 std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
1939 : SequenceTraitsImpl<SmallVectorImpl<T>, SequenceElementTraits<T>::flow> {};
1942 template <
typename T>
1943 struct SequenceElementTraits<
T,
1944 std::enable_if_t<std::is_fundamental<T>::value>> {
1945 static const bool flow =
true;
1949 template<>
struct SequenceElementTraits<
std::
string> {
1950 static const bool flow =
false;
1952 template<>
struct SequenceElementTraits<StringRef> {
1953 static const bool flow =
false;
1955 template<>
struct SequenceElementTraits<
std::pair<std::string, std::string>> {
1956 static const bool flow =
false;
1960 template <
typename T>
struct StdMapStringCustomMappingTraitsImpl {
1961 using map_type = std::map<std::string, T>;
1963 static void inputOne(IO &io, StringRef key, map_type &v) {
1964 io.mapRequired(key.str().c_str(), v[std::string(key)]);
1967 static void output(IO &io, map_type &v) {
1969 io.mapRequired(p.first.c_str(), p.second);
1976 #define LLVM_YAML_IS_SEQUENCE_VECTOR_IMPL(TYPE, FLOW) \ 1980 !std::is_fundamental<TYPE>::value && \ 1981 !std::is_same<TYPE, std::string>::value && \ 1982 !std::is_same<TYPE, llvm::StringRef>::value, \ 1983 "only use LLVM_YAML_IS_SEQUENCE_VECTOR for types you control"); \ 1984 template <> struct SequenceElementTraits<TYPE> { \ 1985 static const bool flow = FLOW; \ 1992 #define LLVM_YAML_IS_SEQUENCE_VECTOR(type) \ 1993 LLVM_YAML_IS_SEQUENCE_VECTOR_IMPL(type, false) 1997 #define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(type) \ 1998 LLVM_YAML_IS_SEQUENCE_VECTOR_IMPL(type, true) 2000 #define LLVM_YAML_DECLARE_MAPPING_TRAITS(Type) \ 2003 template <> struct MappingTraits<Type> { \ 2004 static void mapping(IO &IO, Type &Obj); \ 2009 #define LLVM_YAML_DECLARE_ENUM_TRAITS(Type) \ 2012 template <> struct ScalarEnumerationTraits<Type> { \ 2013 static void enumeration(IO &io, Type &Value); \ 2018 #define LLVM_YAML_DECLARE_BITSET_TRAITS(Type) \ 2021 template <> struct ScalarBitSetTraits<Type> { \ 2022 static void bitset(IO &IO, Type &Options); \ 2027 #define LLVM_YAML_DECLARE_SCALAR_TRAITS(Type, MustQuote) \ 2030 template <> struct ScalarTraits<Type> { \ 2031 static void output(const Type &Value, void *ctx, raw_ostream &Out); \ 2032 static StringRef input(StringRef Scalar, void *ctxt, Type &Value); \ 2033 static QuotingType mustQuote(StringRef) { return MustQuote; } \ 2040 #define LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(_type) \ 2043 template <unsigned N> \ 2044 struct DocumentListTraits<SmallVector<_type, N>> \ 2045 : public SequenceTraitsImpl<SmallVector<_type, N>, false> {}; \ 2047 struct DocumentListTraits<std::vector<_type>> \ 2048 : public SequenceTraitsImpl<std::vector<_type>, false> {}; \ 2054 #define LLVM_YAML_IS_STRING_MAP(_type) \ 2058 struct CustomMappingTraits<std::map<std::string, _type>> \ 2059 : public StdMapStringCustomMappingTraitsImpl<_type> {}; \ 2063 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::Hex64)
2064 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::Hex32)
2065 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::Hex16)
2066 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::Hex8)
2068 #endif // LLVM_SUPPORT_YAMLTRAITS_H static bool classof(const Node *N)
This class represents lattice values for constants.
return ToRemove size() > 0
static bool classof(const Node *N)
This file defines the BumpPtrAllocator interface.
static bool classof(const Node *N)
std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
static constexpr size_t npos
static bool classof(const Node *N)
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
static void DiagHandler(const SMDiagnostic &Diag, void *Context)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Determine the kind of a node from its type.
void(*)(const SMDiagnostic &, void *Context) DiagHandlerTy
Clients that want to handle their own diagnostics in a custom way can register a function pointer+con...
Tail - This calling convention attemps to make calls as fast as possible while guaranteeing that tail...
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
iterator_range< detail::value_sequence_iterator< ValueT > > seq(ValueT Begin, ValueT End)
static bool classof(const Node *N)
Sequence
A sequence of states that a pointer may go through in which an objc_retain and objc_release are actua...
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...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Defines the llvm::VersionTuple class, which represents a version in the form major[....
This class implements an extremely fast bulk output stream that can only output to a stream.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
ScaledNumber< DigitsT > operator>>(const ScaledNumber< DigitsT > &L, int16_t Shift)
void validate(const Triple &TT, const FeatureBitset &FeatureBits)
static void mapOptional(yaml::IO &IO, const char *Key, EndianType &Val, typename EndianType::value_type Default)
Perform an optional yaml-mapping of an endian-aware type EndianType.