// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | %FileCheck %s // REQUIRES: CPU=x86_64 // REQUIRES: objc_interop // CHECK: [[SWIFT_TYPE:%swift.type]] = type { i64 } 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 i8*, i8** @"\01L_selector(hiveWithQueen:)" %3 = class_method %2 : $@objc_metatype Hive.Type, #Hive.init!allocator.1.foreign : (Hive.Type) -> (ImplicitlyUnwrappedOptional) -> 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 {{.*}} @objc_autorelease autorelease_value %4 : $Optional return %4 : $Optional }