// 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, @thick Hive.Type) -> @owned Optional { bb0(%0 : $Optional, %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, @objc_metatype Hive.Type) -> @autoreleased Optional // user: %4 // CHECK: call {{.*}} @objc_msgSend %4 = apply %3(%0, %2) : $@convention(objc_method) (Optional, @objc_metatype Hive.Type) -> @autoreleased Optional // users: %5, %6 // CHECK: call {{.*}} @llvm.objc.autorelease autorelease_value %4 : $Optional return %4 : $Optional }