@@ -441,26 +441,12 @@ static llvm::Value *emitObjCMetadataRef(IRGenFunction &IGF,
441441 return emitObjCMetadataRefForMetadata (IGF, classPtr);
442442}
443443
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-
458444// Get the type that exists at runtime to represent a compile-time type.
459445CanType IRGenModule::getRuntimeReifiedType (CanType type) {
460446 // Leave type-erased ObjC generics with their generic arguments unbound, since
461447 // the arguments do not exist at runtime.
462448 return CanType (type.transform ([&](Type t) -> Type {
463- if (isTypeErasedGenericClassType ( CanType (t))) {
449+ if (CanType (t). isTypeErasedGenericClassType ( )) {
464450 return t->getAnyNominal ()->getDeclaredType ()->getCanonicalType ();
465451 }
466452 return t;
@@ -2132,7 +2118,7 @@ static llvm::Function *getAccessFunctionPrototype(IRGenModule &IGM,
21322118 ForDefinition_t forDefinition) {
21332119 assert (!type->hasArchetype ());
21342120 // Type should be bound unless it's type erased.
2135- assert (isTypeErasedGenericClassType (type )
2121+ assert (type. isTypeErasedGenericClassType ()
21362122 ? !isa<BoundGenericType>(type)
21372123 : !isa<UnboundGenericType>(type));
21382124
@@ -2220,7 +2206,7 @@ irgen::getGenericTypeMetadataAccessFunction(IRGenModule &IGM,
22202206 NominalTypeDecl *nominal,
22212207 ForDefinition_t shouldDefine) {
22222208 assert (nominal->isGenericContext ());
2223- assert (!isTypeErasedGenericClass (nominal ));
2209+ assert (!nominal-> isTypeErasedGenericClass ());
22242210
22252211 GenericArguments genericArgs;
22262212 genericArgs.collectTypes (IGM, nominal);
0 commit comments