@@ -441,26 +441,12 @@ static llvm::Value *emitObjCMetadataRef(IRGenFunction &IGF,
441
441
return emitObjCMetadataRefForMetadata (IGF, classPtr);
442
442
}
443
443
444
- static bool isTypeErasedGenericClass (NominalTypeDecl *ntd) {
445
- // ObjC classes are type erased.
446
- // TODO: Unless they have magic methods...
447
- if (auto clas = dyn_cast<ClassDecl>(ntd))
448
- return clas->hasClangNode () && clas->isGenericContext ();
449
- return false ;
450
- }
451
-
452
- static bool isTypeErasedGenericClassType (CanType type) {
453
- if (auto nom = type->getAnyNominal ())
454
- return isTypeErasedGenericClass (nom);
455
- return false ;
456
- }
457
-
458
444
// Get the type that exists at runtime to represent a compile-time type.
459
445
CanType IRGenModule::getRuntimeReifiedType (CanType type) {
460
446
// Leave type-erased ObjC generics with their generic arguments unbound, since
461
447
// the arguments do not exist at runtime.
462
448
return CanType (type.transform ([&](Type t) -> Type {
463
- if (isTypeErasedGenericClassType ( CanType (t))) {
449
+ if (CanType (t). isTypeErasedGenericClassType ( )) {
464
450
return t->getAnyNominal ()->getDeclaredType ()->getCanonicalType ();
465
451
}
466
452
return t;
@@ -2126,7 +2112,7 @@ static llvm::Function *getAccessFunctionPrototype(IRGenModule &IGM,
2126
2112
ForDefinition_t forDefinition) {
2127
2113
assert (!type->hasArchetype ());
2128
2114
// Type should be bound unless it's type erased.
2129
- assert (isTypeErasedGenericClassType (type )
2115
+ assert (type. isTypeErasedGenericClassType ()
2130
2116
? !isa<BoundGenericType>(type)
2131
2117
: !isa<UnboundGenericType>(type));
2132
2118
@@ -2214,7 +2200,7 @@ irgen::getGenericTypeMetadataAccessFunction(IRGenModule &IGM,
2214
2200
NominalTypeDecl *nominal,
2215
2201
ForDefinition_t shouldDefine) {
2216
2202
assert (nominal->isGenericContext ());
2217
- assert (!isTypeErasedGenericClass (nominal ));
2203
+ assert (!nominal-> isTypeErasedGenericClass ());
2218
2204
2219
2205
GenericArguments genericArgs;
2220
2206
genericArgs.collectTypes (IGM, nominal);
0 commit comments