@@ -219,20 +219,29 @@ class ManagedValue {
219
219
220
220
// / Returns true if this managed value can be consumed.
221
221
// /
222
- // / This is true if either this value has a cleanup or if it is an
223
- // / SSA value without ownership.
222
+ // / This is true if either this value has a cleanup or if it is a trivial
223
+ // / object value. For address values, this returns true only if the value has
224
+ // / a cleanup regardless of whether the type is trivial.
224
225
// /
225
- // / When an SSA value does not have ownership, it can be used by a consuming
226
- // / operation without destroying it. Consuming a value by address, however,
227
- // / deinitializes the memory regardless of whether the value has ownership.
226
+ // / When an object value is trivial, it can be passed to a consuming operation
227
+ // / without destroying it. Consuming a value by address, however, always
228
+ // / deinitializes the memory regardless of its type.
229
+ // /
230
+ // / Use this before emitting an operation that "takes" this vaule or passing
231
+ // / this value to a call that consumes the argument.
228
232
bool isPlusOne (SILGenFunction &SGF) const ;
229
233
230
234
// / Returns true if this managed value can be forwarded without necessarilly
231
235
// / destroying the original.
232
236
// /
233
- // / This is true if either isPlusOne is true or the value is trivial. A
234
- // / trivial value in memory can be forwarded as a +1 value without
235
- // / deinitializing the memory.
237
+ // / This is true if either isPlusOne is true or the value is trivial. Unlike
238
+ // / isPlusOne(), this returns true for trivial addres values. A +1 value can
239
+ // / be created from a trivial value without consuming the original.
240
+ // /
241
+ // / Use this when storing this value into a new location simply by forwarding
242
+ // / the cleanup without destroying the original value. If it's necessary to
243
+ // / "take" or otherwise immediately the original value, then use isPlusOne()
244
+ // / instead.
236
245
bool isPlusOneOrTrivial (SILGenFunction &SGF) const ;
237
246
238
247
// / Returns true if this is an ManagedValue that can be used safely as a +0
0 commit comments