Skip to content

Commit ea0c135

Browse files
committed
[ownership] Do not insert an end_borrow when calling emitEndBorrowOperation on a value with OwnershipKind::None.
This is safe to do since our end_borrow isn't returned to our user.
1 parent 291b75f commit ea0c135

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/swift/SIL/SILBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ class SILBuilder {
782782
}
783783

784784
void emitEndBorrowOperation(SILLocation loc, SILValue v) {
785-
if (!hasOwnership())
785+
if (!hasOwnership() || v.getOwnershipKind() == OwnershipKind::None)
786786
return;
787787
createEndBorrow(loc, v);
788788
}

0 commit comments

Comments
 (0)