mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Record a forwarding mark_dependence as a local access. This is necessary because we now emit a mark_dependence for @out arguments, which will be the starting point for diagnostics: %out = alloc_stack apply %f(%owned, %out) : $(Owner) -> @lifetime(borrow 0) @out View %unused = mark_dependence [unresolved] %out on %owner %dependentValue = load %out This mark_dependence has no uses. Instead, it simply records the dependency of the in-memory value on the owner. Consequently, simply walking the uses of LifetimeDependence.dependentValue does fails to diagnose any escapes. Instead, if the dependentValue is an address-type mark_dependence, treat it as a local access to the address that it forwards. Then we find any reachable uses of that local variable as a potential escape. Fixes rdar://143040479 (Borrow diagnostics not triggered for @out return values)
32 KiB
32 KiB