@@ -173,40 +173,27 @@ enum : unsigned {
173
173
174
174
// / Kinds of type metadata/protocol conformance records.
175
175
enum class TypeMetadataRecordKind : unsigned {
176
- // / The conformance is universal and might apply to any type.
177
- // / getDirectType () is nil .
178
- Universal ,
176
+ // / The conformance is for a nominal type referenced directly;
177
+ // / getNominalTypeDescriptor () points to the nominal type descriptor .
178
+ DirectNominalTypeDescriptor = 0x00 ,
179
179
180
- // / The conformance is for a nongeneric native struct or enum type.
181
- // / getDirectType () points to the canonical metadata for the type.
182
- UniqueDirectType ,
183
-
184
- // / The conformance is for a nongeneric foreign struct or enum type.
180
+ // / The conformance is for a nominal type referenced indirectly;
181
+ // / getNominalTypeDescriptor () points to the nominal type descriptor .
182
+ IndirectNominalTypeDescriptor = 0x01 ,
183
+
184
+ // / The conformance is for a foreign type described by its type metadata .
185
185
// / getDirectType() points to a nonunique metadata record for the type, which
186
186
// / needs to be uniqued by the runtime.
187
- NonuniqueDirectType,
188
-
189
- // / The conformance is for a nongeneric class type.
190
- // / getIndirectClass() points to a variable that contains the pointer to the
191
- // / class object, which may be ObjC and thus require a runtime call to get
192
- // / metadata.
193
- // /
194
- // / On platforms without ObjC interop, this indirection isn't necessary,
195
- // / and classes could be emitted as UniqueDirectType.
196
- UniqueIndirectClass,
187
+ NonuniqueDirectType = 0x02 ,
197
188
198
- // / The conformance is for a generic or resilient type.
199
- // / getNominalTypeDescriptor() points to the nominal type descriptor shared
200
- // / by all metadata instantiations of this type.
201
- UniqueNominalTypeDescriptor,
202
-
203
- // / The conformance is for a nongeneric class type.
204
- // / getDirectType() points to the unique class object.
189
+ // / The conformance is for an Objective-C class that has no nominal type
190
+ // / descriptor.
191
+ // / getIndirectObjCClass() points to a variable that contains the pointer to
192
+ // / the class object, which then requires a runtime call to get metadata.
205
193
// /
206
- // / FIXME: This shouldn't exist. On ObjC interop platforms, class references
207
- // / must be indirected (using UniqueIndirectClass). On non-ObjC interop
208
- // / platforms, the class object always is the type metadata.
209
- UniqueDirectClass = 0xF ,
194
+ // / On platforms without Objective-C interoperability, this case is
195
+ // / unused.
196
+ IndirectObjCClass = 0x03 ,
210
197
};
211
198
212
199
// / Kinds of reference to protocol conformance.
@@ -220,6 +207,8 @@ enum class ProtocolConformanceReferenceKind : unsigned {
220
207
// / table whose conformance is conditional on additional requirements that
221
208
// / must first be evaluated and then provided to the accessor function.
222
209
ConditionalWitnessTableAccessor,
210
+ // / Reserved for future use.
211
+ Reserved,
223
212
};
224
213
225
214
// Type metadata record discriminant
@@ -251,13 +240,6 @@ struct TypeMetadataRecordFlags {
251
240
252
241
// Protocol conformance discriminant
253
242
struct ProtocolConformanceFlags : public TypeMetadataRecordFlags {
254
- private:
255
- enum : int_type {
256
- ConformanceKindMask = 0x00000030U ,
257
- ConformanceKindShift = 4 ,
258
- };
259
-
260
- public:
261
243
constexpr ProtocolConformanceFlags () : TypeMetadataRecordFlags(0 ) {}
262
244
constexpr ProtocolConformanceFlags (int_type Data) : TypeMetadataRecordFlags(Data) {}
263
245
@@ -266,15 +248,6 @@ struct ProtocolConformanceFlags : public TypeMetadataRecordFlags {
266
248
return ProtocolConformanceFlags (
267
249
(Data & ~TypeKindMask) | (int_type (ptk) << TypeKindShift));
268
250
}
269
- constexpr ProtocolConformanceReferenceKind getConformanceKind () const {
270
- return ProtocolConformanceReferenceKind ((Data & ConformanceKindMask)
271
- >> ConformanceKindShift);
272
- }
273
- constexpr ProtocolConformanceFlags withConformanceKind (
274
- ProtocolConformanceReferenceKind pck) const {
275
- return ProtocolConformanceFlags (
276
- (Data & ~ConformanceKindMask) | (int_type (pck) << ConformanceKindShift));
277
- }
278
251
};
279
252
280
253
// / Flag that indicates whether an existential type is class-constrained or not.
0 commit comments