Skip to content

Commit 5026514

Browse files
committed
[sil] Define ValueOwnershipKind::isCompatibleWith(SILValue v).
This just returns isCompatibleWith(v.getOwnershipKind()). Just makes some code easier to write.
1 parent c6ea30c commit 5026514

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

include/swift/SIL/SILValue.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class SILLocation;
4141
class DeadEndBlocks;
4242
class ValueBaseUseIterator;
4343
class ValueUseIterator;
44+
class SILValue;
4445

4546
/// An enumeration which contains values for all the concrete ValueBase
4647
/// subclasses.
@@ -188,6 +189,12 @@ struct ValueOwnershipKind {
188189
return merge(other).hasValue();
189190
}
190191

192+
/// Returns isCompatibleWith(other.getOwnershipKind()).
193+
///
194+
/// Definition is inline after SILValue is defined to work around circular
195+
/// dependencies.
196+
bool isCompatibleWith(SILValue other) const;
197+
191198
template <typename RangeTy>
192199
static Optional<ValueOwnershipKind> merge(RangeTy &&r) {
193200
auto initial = Optional<ValueOwnershipKind>(ValueOwnershipKind::None);
@@ -440,6 +447,10 @@ class SILValue {
440447
void verifyOwnership(DeadEndBlocks *DEBlocks = nullptr) const;
441448
};
442449

450+
inline bool ValueOwnershipKind::isCompatibleWith(SILValue other) const {
451+
return isCompatibleWith(other.getOwnershipKind());
452+
}
453+
443454
/// A map from a ValueOwnershipKind that an operand can accept to a
444455
/// UseLifetimeConstraint that describes the effect that the operand's use has
445456
/// on the underlying value. If a ValueOwnershipKind is not in this map then

0 commit comments

Comments
 (0)