[sil-opaque-values] Fix SILGen and ownership of open_existential_box_value.

This commit is contained in:
Andrew Trick
2017-09-02 15:42:33 -07:00
parent 8455718020
commit 18004f8729
6 changed files with 58 additions and 9 deletions

View File

@@ -905,9 +905,8 @@ SILGenFunction::emitOpenExistential(
loweredOpenedType));
} else {
assert(!silConv.useLoweredAddresses());
archetypeMV = ManagedValue::forUnmanaged(
B.createOpenExistentialBoxValue(loc, existentialValue.getValue(),
loweredOpenedType));
archetypeMV = getBuilder().createOpenExistentialBoxValue(
loc, existentialValue, loweredOpenedType);
}
// NB: Don't forward the cleanup, because consuming a boxed value won't
// consume the box reference.