File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -5479,6 +5479,13 @@ ManagedValue SILGenFunction::applyBorrowMutateAccessor(
54795479 assert (rawResults.size () == 1 );
54805480 auto rawResult = rawResults[0 ];
54815481
5482+ if (fn.getFunction ()->getConventions ().hasGuaranteedResult ()) {
5483+ auto selfArg = args.back ().getValue ();
5484+ if (isa<LoadBorrowInst>(selfArg)) {
5485+ rawResult = B.createUncheckedOwnership (loc, rawResult);
5486+ }
5487+ }
5488+
54825489 if (rawResult->getType ().isMoveOnly ()) {
54835490 if (rawResult->getType ().isAddress ()) {
54845491 auto result = B.createMarkUnresolvedNonCopyableValueInst (
Original file line number Diff line number Diff line change @@ -719,7 +719,8 @@ bool SILGenFunction::emitBorrowOrMutateAccessorResult(
719719 assert (guaranteedAddress.getValue ()->getType ().isAddress ());
720720 assert (F.getConventions ().hasGuaranteedResult ());
721721 auto regularLoc = RegularLocation::getAutoGeneratedLocation ();
722- return B.createLoadBorrow (regularLoc, guaranteedAddress).getValue ();
722+ auto load = B.createLoadBorrow (regularLoc, guaranteedAddress).getValue ();
723+ return B.createUncheckedOwnership (regularLoc, load);
723724 };
724725
725726 // If the return expression is a literal, emit as a regular return
You can’t perform that action at this time.
0 commit comments