@@ -94,6 +94,17 @@ enum class ProtocolConformanceState {
94
94
Last_State = Checking
95
95
};
96
96
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
+
97
108
enum : unsigned {
98
109
NumProtocolConformanceStateBits =
99
110
countBitsUsed (static_cast <unsigned >(ProtocolConformanceState::Last_State))
@@ -104,6 +115,11 @@ enum : unsigned {
104
115
countBitsUsed (static_cast <unsigned >(ConformanceEntryKind::Last_Kind))
105
116
};
106
117
118
+ enum : unsigned {
119
+ NumBuiltinConformanceKindBits =
120
+ countBitsUsed (static_cast <unsigned >(BuiltinConformanceKind::Last_Kind))
121
+ };
122
+
107
123
// / Describes how a particular type conforms to a given protocol,
108
124
// / providing the mapping from the protocol members to the type (or extension)
109
125
// / members that provide the functionality for the concrete type.
@@ -160,6 +176,12 @@ class alignas(1 << DeclAlignInBits) ProtocolConformance
160
176
// / InheritedProtocolConformance.
161
177
SourceKind : bitmax (NumConformanceEntryKindBits, 8 )
162
178
);
179
+
180
+ SWIFT_INLINE_BITFIELD (BuiltinProtocolConformance, RootProtocolConformance,
181
+ bitmax (NumBuiltinConformanceKindBits, 8 ),
182
+ // / The kind of the builtin conformance
183
+ Kind: bitmax (NumBuiltinConformanceKindBits, 8 )
184
+ );
163
185
} Bits;
164
186
// clang-format on
165
187
@@ -1093,22 +1115,12 @@ class InheritedProtocolConformance : public ProtocolConformance,
1093
1115
}
1094
1116
};
1095
1117
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
-
1105
1118
// / A builtin conformance appears when a non-nominal type has a
1106
1119
// / conformance that is synthesized by the implementation.
1107
1120
class BuiltinProtocolConformance final : public RootProtocolConformance {
1108
1121
friend ASTContext;
1109
1122
1110
1123
ProtocolDecl *protocol;
1111
- unsigned builtinConformanceKind;
1112
1124
1113
1125
BuiltinProtocolConformance (Type conformingType, ProtocolDecl *protocol,
1114
1126
BuiltinConformanceKind kind);
@@ -1120,7 +1132,8 @@ class BuiltinProtocolConformance final : public RootProtocolConformance {
1120
1132
}
1121
1133
1122
1134
BuiltinConformanceKind getBuiltinConformanceKind () const {
1123
- return static_cast <BuiltinConformanceKind>(builtinConformanceKind);
1135
+ return static_cast <BuiltinConformanceKind>(
1136
+ Bits.BuiltinProtocolConformance .Kind );
1124
1137
}
1125
1138
1126
1139
GenericSignature getGenericSignature () const {
0 commit comments