File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -2823,8 +2823,7 @@ static bool _dynamicCastClassToValueViaObjCBridgeable(
2823
2823
return _fail (src, srcType, targetType, flags);
2824
2824
}
2825
2825
2826
- // Unless we're always supposed to consume the input, retain the
2827
- // object because the witness takes it at +1.
2826
+ // TODO: Avoid the retain here in +0 mode if the input is never consumed.
2828
2827
bool alwaysConsumeSrc = (flags & DynamicCastFlags::TakeOnSuccess) &&
2829
2828
(flags & DynamicCastFlags::DestroyOnFailure);
2830
2829
if (!alwaysConsumeSrc) {
@@ -2880,15 +2879,14 @@ static bool _dynamicCastClassToValueViaObjCBridgeable(
2880
2879
(HeapObject *)srcObject, (OpaqueValue *)optDestBuffer,
2881
2880
targetType, targetType, targetBridgeWitness);
2882
2881
}
2882
+ SWIFT_CC_PLUSZERO_GUARD (swift_unknownRelease (srcObject));
2883
2883
2884
2884
// If we succeeded, take from the optional buffer into the
2885
2885
// destination buffer.
2886
2886
if (success) {
2887
2887
targetType->vw_initializeWithTake (dest, (OpaqueValue *)optDestBuffer);
2888
2888
}
2889
2889
2890
- // Unless we're always supposed to consume the input, release the
2891
- // input if we need to now.
2892
2890
if (!alwaysConsumeSrc && shouldDeallocateSource (success, flags)) {
2893
2891
swift_unknownRelease (srcObject);
2894
2892
}
You can’t perform that action at this time.
0 commit comments