@@ -219,20 +219,30 @@ 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 whether or not it is trivial.
229
+ // /
230
+ // / Use this before emitting an operation that "takes" this value 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 address values regardless of
239
+ // / whether the value has a cleanup. A +1 value can be created from a trivial
240
+ // / value without consuming the original.
241
+ // /
242
+ // / Use this when storing this value into a new location simply by forwarding
243
+ // / the cleanup without destroying the original value. If it's necessary to
244
+ // / "take" or otherwise immediately consume the original value, then use
245
+ // / isPlusOne() instead.
236
246
bool isPlusOneOrTrivial (SILGenFunction &SGF) const ;
237
247
238
248
// / Returns true if this is an ManagedValue that can be used safely as a +0
0 commit comments