Skip to content

Commit

Permalink
SILGen: Fix ownership violation in visitUnderlyingToOpaqueExpr()
Browse files Browse the repository at this point in the history
  • Loading branch information
slavapestov committed Jul 14, 2022
1 parent 421f39a commit 78e9af7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/SILGen/SILGenExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2129,11 +2129,9 @@ RValue RValueEmitter::visitUnderlyingToOpaqueExpr(UnderlyingToOpaqueExpr *E,
if (value.getType() == opaqueTL.getLoweredType())
return RValue(SGF, E, value);

auto cast = SGF.B.createUncheckedReinterpretCast(E, value.forward(SGF),
opaqueTL.getLoweredType());
value = SGF.emitManagedRValueWithCleanup(cast);

return RValue(SGF, E, value);
auto cast = SGF.B.createUncheckedBitCast(E, value,
opaqueTL.getLoweredType());
return RValue(SGF, E, cast);
}

VarargsInfo Lowering::emitBeginVarargs(SILGenFunction &SGF, SILLocation loc,
Expand Down

0 comments on commit 78e9af7

Please sign in to comment.