@@ -170,20 +170,6 @@ template <> class PointerLikeTypeTraits<GeneralizedUser> {
170
170
// Utility
171
171
// ===----------------------------------------------------------------------===//
172
172
173
- static bool compatibleOwnershipKinds (ValueOwnershipKind K1,
174
- ValueOwnershipKind K2) {
175
- return K1.merge (K2).hasValue ();
176
- }
177
-
178
- // / Returns true if \p Kind is trivial or if \p Kind is compatible with \p
179
- // / ComparisonKind.
180
- static bool
181
- trivialOrCompatibleOwnershipKinds (ValueOwnershipKind Kind,
182
- ValueOwnershipKind ComparisonKind) {
183
- return compatibleOwnershipKinds (Kind, ValueOwnershipKind::Trivial) ||
184
- compatibleOwnershipKinds (Kind, ComparisonKind);
185
- }
186
-
187
173
static bool isValueAddressOrTrivial (SILValue V, SILModule &M) {
188
174
return V->getType ().isAddress () ||
189
175
V.getOwnershipKind () == ValueOwnershipKind::Trivial ||
@@ -333,7 +319,7 @@ class OwnershipCompatibilityUseChecker
333
319
SILType getType () const { return Op.get ()->getType (); }
334
320
335
321
bool compatibleWithOwnership (ValueOwnershipKind Kind) const {
336
- return compatibleOwnershipKinds ( getOwnershipKind (), Kind);
322
+ return getOwnershipKind (). isCompatibleWith ( Kind);
337
323
}
338
324
339
325
bool hasExactOwnership (ValueOwnershipKind Kind) const {
@@ -1049,8 +1035,7 @@ OwnershipUseCheckerResult OwnershipCompatibilityUseChecker::visitEnumArgument(
1049
1035
} else {
1050
1036
lifetimeConstraint = UseLifetimeConstraint::MustBeLive;
1051
1037
}
1052
- return {compatibleOwnershipKinds (ownership, RequiredKind),
1053
- lifetimeConstraint};
1038
+ return {ownership.isCompatibleWith (RequiredKind), lifetimeConstraint};
1054
1039
}
1055
1040
1056
1041
// We allow for trivial cases of enums with non-trivial cases to be passed in
@@ -1805,14 +1790,14 @@ void SILValueOwnershipChecker::gatherUsers(
1805
1790
// TODO: Add a flag that associates the terminator instruction with
1806
1791
// needing to be verified. If it isn't verified appropriately, assert
1807
1792
// when the verifier is destroyed.
1808
- if (! trivialOrCompatibleOwnershipKinds ( BBArg->getOwnershipKind (),
1809
- OwnershipKind)) {
1793
+ auto BBArgOwnershipKind = BBArg->getOwnershipKind ();
1794
+ if (!BBArgOwnershipKind. isTrivialOrCompatibleWith ( OwnershipKind)) {
1810
1795
// This is where the error would go.
1811
1796
continue ;
1812
1797
}
1813
1798
1814
1799
// If we have a trivial value, just continue.
1815
- if (BBArg-> getOwnershipKind () == ValueOwnershipKind::Trivial)
1800
+ if (BBArgOwnershipKind == ValueOwnershipKind::Trivial)
1816
1801
continue ;
1817
1802
1818
1803
// Otherwise,
0 commit comments