mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
31 lines
1.3 KiB
Plaintext
31 lines
1.3 KiB
Plaintext
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -emit-ir %s | %FileCheck %s
|
|
|
|
// REQUIRES: CPU=x86_64
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
import Foundation
|
|
|
|
// top_level_code
|
|
sil private @top_level_code : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = tuple () // user: %1
|
|
return %0 : $() // id: %1
|
|
}
|
|
|
|
// CHECK-LABEL: define {{.*}} @_TFCSo4HiveCfMS_FT5queenGSQCSo3Bee__S_
|
|
sil @_TFCSo4HiveCfMS_FT5queenGSQCSo3Bee__S_ : $@convention(thin) (@owned Optional<Bee>, @thick Hive.Type) -> @owned Optional<Hive> {
|
|
bb0(%0 : $Optional<Bee>, %1 : $@thick Hive.Type):
|
|
%2 = thick_to_objc_metatype %1 : $@thick Hive.Type to $@objc_metatype Hive.Type // users: %3, %4
|
|
// CHECK: load ptr, ptr @"\01L_selector(hiveWithQueen:)"
|
|
%3 = objc_method %2 : $@objc_metatype Hive.Type, #Hive.init!allocator.foreign : (Hive.Type) -> (Bee!) -> Hive!, $@convention(objc_method) (Optional<Bee>, @objc_metatype Hive.Type) -> @autoreleased Optional<Hive> // user: %4
|
|
// CHECK: call {{.*}} @objc_msgSend
|
|
%4 = apply %3(%0, %2) : $@convention(objc_method) (Optional<Bee>, @objc_metatype Hive.Type) -> @autoreleased Optional<Hive> // users: %5, %6
|
|
// CHECK: call {{.*}} @llvm.objc.autorelease
|
|
autorelease_value %4 : $Optional<Hive>
|
|
return %4 : $Optional<Hive>
|
|
}
|
|
|