Files
swift-mirror/test/IRGen/objc_factory_method.sil
Roman Levenstein 8ad61d5cd6 Use function signatures for SILDeclRefs in witness_tables, vtables and witness_method instructions.
Textual SIL was sometimes ambiguous when SILDeclRefs were used, because the textual representation of SILDeclRefs was the same for functions that have the same name, but different signatures.
2017-01-27 12:16:14 -08:00

33 lines
1.4 KiB
Plaintext

// 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<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 i8*, i8** @"\01L_selector(hiveWithQueen:)"
%3 = class_method %2 : $@objc_metatype Hive.Type, #Hive.init!allocator.1.foreign : (Hive.Type) -> (ImplicitlyUnwrappedOptional<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 {{.*}} @objc_autorelease
autorelease_value %4 : $Optional<Hive>
return %4 : $Optional<Hive>
}