Files
swift-mirror/test/ClangImporter/objc_init_blocks.swift
John McCall 3fe70968cc Remove the substitution map from zeroInitializer builtin in SIL.
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.
2025-03-26 00:34:15 -04:00

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()
}
}