File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2615,10 +2615,13 @@ class SyncCallEmission final : public CallEmission {
26152615 == ResultConvention::Autoreleased)) {
26162616 if (IGF.IGM .Context .LangOpts .EnableObjCInterop ) {
26172617 auto ty = fnConv.getSILResultType (IGF.IGM .getMaximalTypeExpansionContext ());
2618- auto *classTypeInfo = dyn_cast<ClassTypeInfo>(&IGF.IGM .getTypeInfo (ty));
2619- if (classTypeInfo && classTypeInfo->getReferenceCounting () == ReferenceCounting::Custom) {
2618+ // NOTE: We cannot dyn_cast directly to ClassTypeInfo since it does not
2619+ // implement 'classof', so will succeed for any ReferenceTypeInfo.
2620+ auto *refTypeInfo = dyn_cast<ReferenceTypeInfo>(&IGF.IGM .getTypeInfo (ty));
2621+ if (refTypeInfo &&
2622+ refTypeInfo->getReferenceCountingType () == ReferenceCounting::Custom) {
26202623 Explosion e (result);
2621- classTypeInfo-> strongCustomRetain (IGF, e, true );
2624+ refTypeInfo-> as <ClassTypeInfo>(). strongCustomRetain (IGF, e, true );
26222625 } else {
26232626 result = emitObjCRetainAutoreleasedReturnValue (IGF, result);
26242627 }
You can’t perform that action at this time.
0 commit comments