Skip to content

Commit 2410406

Browse files
committed
[+0-all-arguments] Use SILGenBuilder APIs to ensure we put cleanups on the case result instead of on the cast argument.
Otherwise, we break SILGen tests when they are updated for +0. This breakage occurs since we use the original cleanup from args[0] instead of forwarding that cleanup and creating a new cleanup on the result. rdar://34222540
1 parent a24e7e8 commit 2410406

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

lib/SILGen/SILGenBuiltin.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,16 +389,8 @@ static ManagedValue emitCastFromReferenceType(SILGenFunction &SGF,
389389
SILValue result = SILUndef::get(destType, SGF.SGM.M);
390390
return ManagedValue::forUnmanaged(result);
391391
}
392-
393-
// Save the cleanup on the argument so we can forward it onto the cast
394-
// result.
395-
auto cleanup = args[0].getCleanup();
396392

397-
// Take the reference type argument and cast it.
398-
SILValue result = SGF.B.createUncheckedRefCast(loc, args[0].getValue(),
399-
destType);
400-
// Return the cast result with the original cleanup.
401-
return ManagedValue(result, cleanup);
393+
return SGF.B.createUncheckedRefCast(loc, args[0], destType);
402394
}
403395

404396
/// Specialized emitter for Builtin.castFromNativeObject.

0 commit comments

Comments
 (0)