mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SIL SideEffects: handle program termination point functions
We can ignore any memory writes in a program termination point, because it's not relevant for the caller. But we need to consider memory reads, otherwise preceeding memory writes would be eliminated by dead-store-elimination in the caller. E.g. String initialization for error strings which are printed by the program termination point. Regarding ownership: a program termination point must not touch any reference counted objects.
This commit is contained in:
@@ -121,6 +121,10 @@ final public class Function : CustomStringConvertible, HasShortDescription, Hash
|
||||
}
|
||||
}
|
||||
|
||||
/// True if the callee function is annotated with @_semantics("programtermination_point").
|
||||
/// This means that the function terminates the program.
|
||||
public var isProgramTerminationPoint: Bool { hasSemanticsAttribute("programtermination_point") }
|
||||
|
||||
/// Kinds of effect attributes which can be defined for a Swift function.
|
||||
public enum EffectAttribute {
|
||||
/// No effect attribute is specified.
|
||||
|
||||
Reference in New Issue
Block a user