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 {
2615
2615
== ResultConvention::Autoreleased)) {
2616
2616
if (IGF.IGM .Context .LangOpts .EnableObjCInterop ) {
2617
2617
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) {
2620
2623
Explosion e (result);
2621
- classTypeInfo-> strongCustomRetain (IGF, e, true );
2624
+ refTypeInfo-> as <ClassTypeInfo>(). strongCustomRetain (IGF, e, true );
2622
2625
} else {
2623
2626
result = emitObjCRetainAutoreleasedReturnValue (IGF, result);
2624
2627
}
You can’t perform that action at this time.
0 commit comments