Skip to content

Commit 2434891

Browse files
committed
Add Operand->isConsuming() API.
This should be used instead of isLifetimeEnding wherever the code assumes an owned value is consumed. isLifetimeEnding should only be used when the code is expected to handle both owned and guaranteed values.
1 parent ead5fa3 commit 2434891

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/swift/SIL/SILValue.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,11 @@ class OwnershipConstraint {
676676
return lifetimeConstraint;
677677
}
678678

679+
bool isConsuming() const {
680+
return ownershipKind == OwnershipKind::Owned
681+
&& lifetimeConstraint == UseLifetimeConstraint::LifetimeEnding;
682+
}
683+
679684
bool satisfiedBy(const Operand *use) const;
680685

681686
bool satisfiesConstraint(ValueOwnershipKind testKind) const {

0 commit comments

Comments
 (0)