@@ -94,6 +94,17 @@ enum class ProtocolConformanceState {
9494 Last_State = Checking
9595};
9696
97+ // / Describes the kind of a builtin conformance.
98+ enum class BuiltinConformanceKind {
99+ // A builtin conformance that has been synthesized by the implementation.
100+ Synthesized = 0 ,
101+ // A missing conformance that we have nonetheless synthesized so that
102+ // we can diagnose it later.
103+ Missing,
104+
105+ Last_Kind = Missing
106+ };
107+
97108enum : unsigned {
98109 NumProtocolConformanceStateBits =
99110 countBitsUsed (static_cast <unsigned >(ProtocolConformanceState::Last_State))
@@ -104,6 +115,11 @@ enum : unsigned {
104115 countBitsUsed (static_cast <unsigned >(ConformanceEntryKind::Last_Kind))
105116};
106117
118+ enum : unsigned {
119+ NumBuiltinConformanceKindBits =
120+ countBitsUsed (static_cast <unsigned >(BuiltinConformanceKind::Last_Kind))
121+ };
122+
107123// / Describes how a particular type conforms to a given protocol,
108124// / providing the mapping from the protocol members to the type (or extension)
109125// / members that provide the functionality for the concrete type.
@@ -160,6 +176,12 @@ class alignas(1 << DeclAlignInBits) ProtocolConformance
160176 // / InheritedProtocolConformance.
161177 SourceKind : bitmax (NumConformanceEntryKindBits, 8 )
162178 );
179+
180+ SWIFT_INLINE_BITFIELD (BuiltinProtocolConformance, RootProtocolConformance,
181+ bitmax (NumBuiltinConformanceKindBits, 8 ),
182+ // / The kind of the builtin conformance
183+ Kind: bitmax (NumBuiltinConformanceKindBits, 8 )
184+ );
163185 } Bits;
164186 // clang-format on
165187
@@ -1093,22 +1115,12 @@ class InheritedProtocolConformance : public ProtocolConformance,
10931115 }
10941116};
10951117
1096- // / Describes the kind of a builtin conformance.
1097- enum class BuiltinConformanceKind {
1098- // A builtin conformance that has been synthesized by the implementation.
1099- Synthesized = 0 ,
1100- // A missing conformance that we have nonetheless synthesized so that
1101- // we can diagnose it later.
1102- Missing,
1103- };
1104-
11051118// / A builtin conformance appears when a non-nominal type has a
11061119// / conformance that is synthesized by the implementation.
11071120class BuiltinProtocolConformance final : public RootProtocolConformance {
11081121 friend ASTContext;
11091122
11101123 ProtocolDecl *protocol;
1111- unsigned builtinConformanceKind;
11121124
11131125 BuiltinProtocolConformance (Type conformingType, ProtocolDecl *protocol,
11141126 BuiltinConformanceKind kind);
@@ -1120,7 +1132,8 @@ class BuiltinProtocolConformance final : public RootProtocolConformance {
11201132 }
11211133
11221134 BuiltinConformanceKind getBuiltinConformanceKind () const {
1123- return static_cast <BuiltinConformanceKind>(builtinConformanceKind);
1135+ return static_cast <BuiltinConformanceKind>(
1136+ Bits.BuiltinProtocolConformance .Kind );
11241137 }
11251138
11261139 GenericSignature getGenericSignature () const {
0 commit comments