@@ -2013,13 +2013,10 @@ struct TargetGenericWitnessTable {
2013
2013
// / to require instantiation.
2014
2014
uint16_t WitnessTablePrivateSizeInWordsAndRequiresInstantiation;
2015
2015
2016
- // / The pattern.
2017
- RelativeDirectPointer<const TargetWitnessTable<Runtime>> Pattern;
2018
-
2019
2016
// / The instantiation function, which is called after the template is copied.
2020
2017
RelativeDirectPointer<void (TargetWitnessTable<Runtime> *instantiatedTable,
2021
2018
const TargetMetadata<Runtime> *type,
2022
- void * * const *instantiationArgs),
2019
+ const void * const *instantiationArgs),
2023
2020
/* nullable*/ true > Instantiator;
2024
2021
2025
2022
using PrivateDataType = void *[swift::NumGenericMetadataPrivateDataWords];
@@ -2036,18 +2033,6 @@ struct TargetGenericWitnessTable {
2036
2033
uint16_t requiresInstantiation () const {
2037
2034
return WitnessTablePrivateSizeInWordsAndRequiresInstantiation & 0x01 ;
2038
2035
}
2039
-
2040
- // / Retrieve the protocol conformance descriptor.
2041
- ConstTargetPointer<Runtime, TargetProtocolConformanceDescriptor<Runtime>>
2042
- getConformance () const {
2043
- return Pattern->Description ;
2044
- }
2045
-
2046
- // / Retrieve the protocol.
2047
- ConstTargetPointer<Runtime, TargetProtocolDescriptor<Runtime>>
2048
- getProtocol () const {
2049
- return Pattern->Description ->getProtocol ();
2050
- }
2051
2036
};
2052
2037
using GenericWitnessTable = TargetGenericWitnessTable<InProcess>;
2053
2038
@@ -2279,15 +2264,8 @@ struct TargetProtocolConformanceDescriptor final
2279
2264
// Some description of the type that conforms to the protocol.
2280
2265
TargetTypeReference<Runtime> TypeRef;
2281
2266
2282
- // The conformance, or a generator function for the conformance.
2283
- union {
2284
- // / A direct reference to the witness table for the conformance.
2285
- RelativeDirectPointer<const TargetWitnessTable<Runtime>> WitnessTable;
2286
-
2287
- // / A function that produces the witness table given an instance of the
2288
- // / type.
2289
- RelativeDirectPointer<WitnessTableAccessorFn> WitnessTableAccessor;
2290
- };
2267
+ // / The witness table pattern, which may also serve as the witness table.
2268
+ RelativeDirectPointer<const TargetWitnessTable<Runtime>> WitnessTablePattern;
2291
2269
2292
2270
// / Various flags, including the kind of conformance.
2293
2271
ConformanceFlags Flags;
@@ -2302,10 +2280,6 @@ struct TargetProtocolConformanceDescriptor final
2302
2280
return Flags.getTypeReferenceKind ();
2303
2281
}
2304
2282
2305
- typename ConformanceFlags::ConformanceKind getConformanceKind () const {
2306
- return Flags.getConformanceKind ();
2307
- }
2308
-
2309
2283
const char *getDirectObjCClassName () const {
2310
2284
return TypeRef.getDirectObjCClassName (getTypeKind ());
2311
2285
}
@@ -2325,6 +2299,18 @@ struct TargetProtocolConformanceDescriptor final
2325
2299
return this ->template getTrailingObjects <RelativeContextPointer<Runtime>>();
2326
2300
}
2327
2301
2302
+ // / Whether this conformance is non-unique because it has been synthesized
2303
+ // / for a foreign type.
2304
+ bool isSynthesizedNonUnique () const {
2305
+ return Flags.isSynthesizedNonUnique ();
2306
+ }
2307
+
2308
+ // / Whether this conformance has any conditional requirements that need to
2309
+ // / be evaluated.
2310
+ bool hasConditionalRequirements () const {
2311
+ return Flags.getNumConditionalRequirements () > 0 ;
2312
+ }
2313
+
2328
2314
// / Retrieve the conditional requirements that must also be
2329
2315
// / satisfied
2330
2316
llvm::ArrayRef<GenericRequirementDescriptor>
@@ -2333,31 +2319,12 @@ struct TargetProtocolConformanceDescriptor final
2333
2319
Flags.getNumConditionalRequirements ()};
2334
2320
}
2335
2321
2336
- // / Get the directly-referenced static witness table.
2337
- const swift::TargetWitnessTable<Runtime> *getStaticWitnessTable () const {
2338
- switch (getConformanceKind ()) {
2339
- case ConformanceFlags::ConformanceKind::WitnessTable:
2340
- break ;
2341
-
2342
- case ConformanceFlags::ConformanceKind::WitnessTableAccessor:
2343
- case ConformanceFlags::ConformanceKind::ConditionalWitnessTableAccessor:
2344
- assert (false && " not witness table" );
2345
- }
2346
- return WitnessTable;
2322
+ // / Get the directly-referenced witness table pattern, which may also
2323
+ // / serve as the witness table.
2324
+ const swift::TargetWitnessTable<Runtime> *getWitnessTablePattern () const {
2325
+ return WitnessTablePattern;
2347
2326
}
2348
-
2349
- WitnessTableAccessorFn *getWitnessTableAccessor () const {
2350
- switch (getConformanceKind ()) {
2351
- case ConformanceFlags::ConformanceKind::WitnessTableAccessor:
2352
- case ConformanceFlags::ConformanceKind::ConditionalWitnessTableAccessor:
2353
- break ;
2354
-
2355
- case ConformanceFlags::ConformanceKind::WitnessTable:
2356
- assert (false && " not witness table accessor" );
2357
- }
2358
- return WitnessTableAccessor;
2359
- }
2360
-
2327
+
2361
2328
// / Get the canonical metadata for the type referenced by this record, or
2362
2329
// / return null if the record references a generic or universal type.
2363
2330
const TargetMetadata<Runtime> *getCanonicalTypeMetadata () const ;
0 commit comments