File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
SwiftCompilerSources/Sources/SIL/Utilities Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -518,6 +518,32 @@ public struct AccessBaseAndScopes {
518
518
}
519
519
}
520
520
521
+ extension BeginAccessInst {
522
+ // Recognize an access scope for a unsafe addressor:
523
+ // %adr = pointer_to_address
524
+ // %md = mark_dependence %adr
525
+ // begin_access [unsafe] %md
526
+ public var unsafeAddressorSelf : Value ? {
527
+ guard self . isUnsafe else {
528
+ return nil
529
+ }
530
+ switch self . address. enclosingAccessScope {
531
+ case . access, . base:
532
+ return nil
533
+ case let . dependence( markDep) :
534
+ switch markDep. value. enclosingAccessScope {
535
+ case . access, . dependence:
536
+ return nil
537
+ case let . base( accessBase) :
538
+ guard case . pointer = accessBase else {
539
+ return nil
540
+ }
541
+ return markDep. base
542
+ }
543
+ }
544
+ }
545
+ }
546
+
521
547
private struct EnclosingAccessWalker : AddressUseDefWalker {
522
548
var enclosingScope : EnclosingAccessScope ?
523
549
You can’t perform that action at this time.
0 commit comments