@@ -69,16 +69,9 @@ void TupleInitialization::copyOrInitValueInto(SILGenFunction &SGF,
69
69
// In the address case, we forward the underlying value and store it
70
70
// into memory and then create a +1 cleanup. since we assume here
71
71
// that we have a +1 value since we are forwarding into memory.
72
- //
73
- // In order to ensure that we properly clean up along any failure paths, we
74
- // need to mark value as being persistently active. We then unforward it once
75
- // we are done.
76
72
assert (value.isPlusOne (SGF) && " Can not store a +0 value into memory?!" );
77
- CleanupStateRestorationScope valueScope (SGF.Cleanups );
78
- if (value.hasCleanup ())
79
- valueScope.pushCleanupState (value.getCleanup (),
80
- CleanupState::PersistentlyActive);
81
- copyOrInitValueIntoHelper (
73
+ value = ManagedValue::forUnmanaged (value.forward (SGF));
74
+ return copyOrInitValueIntoHelper (
82
75
SGF, loc, value, isInit, SubInitializations,
83
76
[&](ManagedValue aggregate, unsigned i,
84
77
SILType fieldType) -> ManagedValue {
@@ -90,8 +83,6 @@ void TupleInitialization::copyOrInitValueInto(SILGenFunction &SGF,
90
83
91
84
return SGF.emitManagedRValueWithCleanup (elt.getValue ());
92
85
});
93
- std::move (valueScope).pop ();
94
- value.forward (SGF);
95
86
}
96
87
97
88
void TupleInitialization::finishUninitialized (SILGenFunction &SGF) {
0 commit comments