Skip to content

Commit e77b5ba

Browse files
committed
Add BeginAccess.AccessKind.isCompatible(with:ArgumentConvention)
General utility to determine whether an argument already has an access scope that is compatibly with this BeginAccess.
1 parent e1e23e2 commit e77b5ba

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

SwiftCompilerSources/Sources/SIL/Argument.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,19 @@ public enum ArgumentConvention : CustomStringConvertible {
591591
}
592592
}
593593

594+
extension BeginAccessInst.AccessKind {
595+
public func isCompatible(with convention: ArgumentConvention) -> Bool {
596+
switch self {
597+
case .`init`, .deinit:
598+
return false
599+
case .read:
600+
return convention.isIndirectIn
601+
case .modify:
602+
return convention.isInout
603+
}
604+
}
605+
}
606+
594607
// Bridging utilities
595608

596609
extension BridgedArgument {

0 commit comments

Comments
 (0)