mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add mark_dependence [nonescaping] flag.
The dependent 'value' may be marked 'nonescaping', which guarantees that the lifetime dependence is statically enforceable. In this case, the compiler must be able to follow all values forwarded from the dependent 'value', and recognize all final (non-forwarded, non-escaping) use points. This implies that `findPointerEscape` is false. A diagnostic pass checks that the incoming SIL to verify that these use points are all initially within the 'base' lifetime. Regular 'mark_dependence' semantics ensure that optimizations cannot violate the lifetime dependence after diagnostics.
This commit is contained in:
@@ -375,4 +375,9 @@ public struct Builder {
|
||||
let endMutation = bridged.createEndCOWMutation(instance.bridged, keepUnique)
|
||||
return notifyNew(endMutation.getAs(EndCOWMutationInst.self))
|
||||
}
|
||||
|
||||
public func createMarkDependence(value: Value, base: Value, isNonEscaping: Bool) -> MarkDependenceInst {
|
||||
let markDependence = bridged.createMarkDependence(value.bridged, base.bridged, isNonEscaping)
|
||||
return notifyNew(markDependence.getAs(MarkDependenceInst.self))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user