Files
swift-mirror/test/SILGen/pound_assert.swift
Robert Widmann 426fe886dc [SR-8272] Drop the last remnants of LogicValue
Removes the _getBuiltinLogicValue intrinsic in favor of an open-coded
struct_extract in SIL.  This removes Sema's last non-literal use of builtin
integer types and unblocks a bunch of cleanup.

This patch would be NFC, but it improves line information for conditional expression codegen.
2018-12-19 23:14:59 -05:00

20 lines
996 B
Swift

// RUN: %target-swift-frontend -enable-experimental-static-assert -emit-silgen %s | %FileCheck %s
// CHECK-LABEL: sil hidden [ossa] @$s12pound_assert15noCustomMessage{{[_0-9a-zA-Z]*}}
func noCustomMessage() {
#assert(true)
// CHECK: [[LOGIC_VALUE:%.*]] = struct_extract {{.*}}
// CHECK-NEXT: [[MESSAGE:%.*]] = string_literal utf8 ""
// CHECK-NEXT: builtin "poundAssert"([[LOGIC_VALUE]] : $Builtin.Int1, [[MESSAGE]] : $Builtin.RawPointer)
}
// CHECK: } // end sil function '$s12pound_assert15noCustomMessage{{[_0-9a-zA-Z]*}}'
// CHECK-LABEL: sil hidden [ossa] @$s12pound_assert13customMessage{{[_0-9a-zA-Z]*}}
func customMessage() {
#assert(true, "custom message")
// CHECK: [[LOGIC_VALUE:%.*]] = struct_extract {{.*}}
// CHECK-NEXT: [[MESSAGE:%.*]] = string_literal utf8 "custom message"
// CHECK-NEXT: builtin "poundAssert"([[LOGIC_VALUE]] : $Builtin.Int1, [[MESSAGE]] : $Builtin.RawPointer)
}
// CHECK: } // end sil function '$s12pound_assert13customMessage{{[_0-9a-zA-Z]*}}'