mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This is a value operation that can work just fine on lowered types, so there's no need to carry along a formal type. Make the value/address duality clearer, and enforce it in the verifier.
19 lines
848 B
Swift
19 lines
848 B
Swift
// RUN: %target-swift-frontend -import-objc-header %S/Inputs/objc_init_blocks.h %s -emit-sil -sil-verify-all
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
// rdar://126142109: import an __unsafe_unretained block as zero-initialized.
|
|
//
|
|
// Make sure that the SIL ownership verifier passes.
|
|
// UnsafeUnretainedBlockClass.init()
|
|
// CHECK-LABEL: sil hidden @$s16objc_init_blocks26UnsafeUnretainedBlockClassCACycfc : $@convention(method) (@owned UnsafeUnretainedBlockClass) -> @owned UnsafeUnretainedBlockClass {
|
|
// CHECK: [[ZI:%.*]] = builtin "zeroInitializer"() : $objc_bool_block
|
|
// CHECK: store [[ZI]] to %{{.*}} : $*objc_bool_block
|
|
// CHECK-LABEL: } // end sil function '$s16objc_init_blocks26UnsafeUnretainedBlockClassCACycfc'
|
|
open class UnsafeUnretainedBlockClass {
|
|
public internal(set) var sc: objc_bool_block
|
|
init() {
|
|
self.sc = objc_bool_block()
|
|
}
|
|
}
|