@@ -651,8 +651,10 @@ class SILExtInfoBuilder {
651651 // If bits are added or removed, then TypeBase::SILFunctionTypeBits
652652 // and NumMaskBits must be updated, and they must match.
653653
654- // |representation|pseudogeneric| noescape | concurrent | async |differentiability|
655- // | 0 .. 3 | 4 | 5 | 6 | 7 | 8 .. 10 |
654+ // |representation|pseudogeneric| noescape | concurrent | async
655+ // | 0 .. 3 | 4 | 5 | 6 | 7
656+ // |differentiability|unimplementable|
657+ // | 8 .. 10 | 11 |
656658 //
657659 enum : unsigned {
658660 RepresentationMask = 0xF << 0 ,
@@ -662,7 +664,8 @@ class SILExtInfoBuilder {
662664 AsyncMask = 1 << 7 ,
663665 DifferentiabilityMaskOffset = 8 ,
664666 DifferentiabilityMask = 0x7 << DifferentiabilityMaskOffset,
665- NumMaskBits = 11
667+ UnimplementableMask = 1 << 11 ,
668+ NumMaskBits = 12
666669 };
667670
668671 unsigned bits; // Naturally sized for speed.
@@ -677,12 +680,13 @@ class SILExtInfoBuilder {
677680
678681 static constexpr unsigned makeBits (Representation rep, bool isPseudogeneric,
679682 bool isNoEscape, bool isSendable,
680- bool isAsync,
683+ bool isAsync, bool isUnimplementable,
681684 DifferentiabilityKind diffKind) {
682685 return ((unsigned )rep) | (isPseudogeneric ? PseudogenericMask : 0 ) |
683686 (isNoEscape ? NoEscapeMask : 0 ) |
684687 (isSendable ? SendableMask : 0 ) |
685688 (isAsync ? AsyncMask : 0 ) |
689+ (isUnimplementable ? UnimplementableMask : 0 ) |
686690 (((unsigned )diffKind << DifferentiabilityMaskOffset) &
687691 DifferentiabilityMask);
688692 }
@@ -692,22 +696,23 @@ class SILExtInfoBuilder {
692696 // / non-pseudogeneric, non-differentiable.
693697 SILExtInfoBuilder ()
694698 : SILExtInfoBuilder(makeBits(SILFunctionTypeRepresentation::Thick, false ,
695- false , false , false ,
699+ false , false , false , false ,
696700 DifferentiabilityKind::NonDifferentiable),
697701 ClangTypeInfo (nullptr )) {}
698702
699703 SILExtInfoBuilder (Representation rep, bool isPseudogeneric, bool isNoEscape,
700- bool isSendable, bool isAsync,
704+ bool isSendable, bool isAsync, bool isUnimplementable,
701705 DifferentiabilityKind diffKind, const clang::Type *type)
702706 : SILExtInfoBuilder(makeBits(rep, isPseudogeneric, isNoEscape,
703- isSendable, isAsync, diffKind),
707+ isSendable, isAsync, isUnimplementable,
708+ diffKind),
704709 ClangTypeInfo(type)) {}
705710
706711 // Constructor for polymorphic type.
707712 SILExtInfoBuilder (ASTExtInfoBuilder info, bool isPseudogeneric)
708713 : SILExtInfoBuilder(makeBits(info.getSILRepresentation(), isPseudogeneric,
709714 info.isNoEscape(), info.isSendable(),
710- info.isAsync(),
715+ info.isAsync(), /* unimplementable */ false,
711716 info.getDifferentiabilityKind()),
712717 info.getClangTypeInfo()) {}
713718
@@ -746,6 +751,10 @@ class SILExtInfoBuilder {
746751 DifferentiabilityKind::NonDifferentiable;
747752 }
748753
754+ constexpr bool isUnimplementable () const {
755+ return bits & UnimplementableMask;
756+ }
757+
749758 // / Get the underlying ClangTypeInfo value.
750759 ClangTypeInfo getClangTypeInfo () const { return clangTypeInfo; }
751760
@@ -816,6 +825,12 @@ class SILExtInfoBuilder {
816825 clangTypeInfo);
817826 }
818827 [[nodiscard]]
828+ SILExtInfoBuilder withUnimplementable (bool isUnimplementable = true ) const {
829+ return SILExtInfoBuilder (isUnimplementable ? (bits | UnimplementableMask)
830+ : (bits & ~UnimplementableMask),
831+ clangTypeInfo);
832+ }
833+ [[nodiscard]]
819834 SILExtInfoBuilder
820835 withDifferentiabilityKind (DifferentiabilityKind differentiability) const {
821836 return SILExtInfoBuilder (
@@ -828,6 +843,7 @@ class SILExtInfoBuilder {
828843 return SILExtInfoBuilder (bits, ClangTypeInfo (type).getCanonical ());
829844 }
830845
846+
831847 bool isEqualTo (SILExtInfoBuilder other, bool useClangTypes) const {
832848 return bits == other.bits &&
833849 (useClangTypes ? (clangTypeInfo == other.clangTypeInfo ) : true );
@@ -873,7 +889,7 @@ class SILExtInfo {
873889 // / A default ExtInfo but with a Thin convention.
874890 static SILExtInfo getThin () {
875891 return SILExtInfoBuilder (SILExtInfoBuilder::Representation::Thin, false ,
876- false , false , false ,
892+ false , false , false , false ,
877893 DifferentiabilityKind::NonDifferentiable, nullptr )
878894 .build ();
879895 }
@@ -901,6 +917,10 @@ class SILExtInfo {
901917
902918 constexpr bool isAsync () const { return builder.isAsync (); }
903919
920+ constexpr bool isUnimplementable () const {
921+ return builder.isUnimplementable ();
922+ }
923+
904924 constexpr DifferentiabilityKind getDifferentiabilityKind () const {
905925 return builder.getDifferentiabilityKind ();
906926 }
@@ -935,6 +955,10 @@ class SILExtInfo {
935955 return builder.withAsync (isAsync).build ();
936956 }
937957
958+ SILExtInfo withUnimplementable (bool isUnimplementable = true ) const {
959+ return builder.withUnimplementable (isUnimplementable).build ();
960+ }
961+
938962 bool isEqualTo (SILExtInfo other, bool useClangTypes) const {
939963 return builder.isEqualTo (other.builder , useClangTypes);
940964 }
0 commit comments