mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
19 lines
636 B
Swift
19 lines
636 B
Swift
// Classic C assert(), plus a message.
|
|
func assert(fn : [auto_closure] () -> Bool, message : String = "") {
|
|
}
|
|
|
|
// These trap functions promise to emit the debugger trap instruction and not
|
|
// print anything; therefore these functions clobber far fewer registers and
|
|
// are more useful for debugging and automated crash reporting infrastructure.
|
|
|
|
// "Expensive" asserts that are debug only
|
|
func debugTrap(fn : [auto_closure] () -> Bool = false, message : String = "") {
|
|
}
|
|
|
|
// "Important" and/or cheap asserts that are always enabled
|
|
func alwaysTrap(cond : Bool = false, message : String = "") {
|
|
if !cond {
|
|
Builtin.int_trap()
|
|
}
|
|
}
|