blob: 7f20e7d613dc3a0e0275c7790aa3d58979e52a78 [file] [log] [blame]
sil_stage raw // CHECK: sil_stage raw
import Builtin
import Swift
import Foundation
protocol SomeProtocol { }
class SomeClass : SomeProtocol { }
// CHECK-LABEL: @objc_classes : $@convention(thin) (@thick NSObject.Type) -> ()
sil [fragile] @objc_classes : $@convention(thin) (@thick NSObject.Type) -> () {
bb0(%0 : $@thick NSObject.Type):
%1 = thick_to_objc_metatype %0 : $@thick NSObject.Type to $@objc_metatype NSObject.Type
// CHECK: %2 = alloc_ref_dynamic [objc] %1 : $@objc_metatype NSObject.Type, $NSObject
%2 = alloc_ref_dynamic [objc] %1 : $@objc_metatype NSObject.Type, $NSObject
%3 = value_metatype $@thick NSObject.Type, %2 : $NSObject
dealloc_partial_ref %2 : $NSObject, %3 : $@thick NSObject.Type
%void = tuple ()
return %void : $()
} // CHECK: {{^}$}}
class Bas : NSObject {
var strRealProp : String
override init()
}
sil [fragile] @test_super_method : $@convention(method) (@guaranteed Bas) -> Bas
sil [fragile] @swift_StringToNSString : $@convention(thin) (@inout String) -> @owned NSString
sil [fragile] @_TFSSCfMSSFT_SS : $@convention(thin) (@thin String.Type) -> @owned String
protocol SomeClassProtocol : class {}
// CHECK-LABEL: sil public_external [fragile] @metatype_to_object
// CHECK: {{%.*}} = objc_metatype_to_object {{%.*}} : $@objc_metatype SomeClass.Type to $AnyObject
// CHECK: {{%.*}} = objc_existential_metatype_to_object {{%.*}} : $@objc_metatype SomeClassProtocol.Type to $AnyObject
sil [fragile] @metatype_to_object : $@convention(thin) (@objc_metatype SomeClass.Type, @objc_metatype SomeClassProtocol.Type) -> @owned (AnyObject, AnyObject) {
entry(%a : $@objc_metatype SomeClass.Type, %b : $@objc_metatype SomeClassProtocol.Type):
%x = objc_metatype_to_object %a : $@objc_metatype SomeClass.Type to $AnyObject
%y = objc_existential_metatype_to_object %b : $@objc_metatype SomeClassProtocol.Type to $AnyObject
%z = tuple (%x : $AnyObject, %y : $AnyObject)
return %z : $(AnyObject, AnyObject)
}
@objc protocol ObjCProto {}
// CHECK-LABEL: sil public_external [fragile] @protocol_conversion
sil [fragile] @protocol_conversion : $@convention(thin) () -> @owned Protocol {
entry:
// CHECK: {{%.*}} = objc_protocol #ObjCProto : $Protocol
%p = objc_protocol #ObjCProto : $Protocol
return %p : $Protocol
}
public func serialize_all() {
}
sil [fragile] [transparent] @_TF14def_basic_objc13serialize_allFT_T_ : $@convention(thin) () -> () {
bb0:
%26 = function_ref @objc_classes : $@convention(thin) (@thick NSObject.Type) -> ()
%79 = function_ref @test_super_method : $@convention(method) (@guaranteed Bas) -> Bas
%125 = function_ref @metatype_to_object : $@convention(thin) (@objc_metatype SomeClass.Type, @objc_metatype SomeClassProtocol.Type) -> @owned (AnyObject, AnyObject)
%126 = function_ref @protocol_conversion : $@convention(thin) () -> @owned Protocol
%119 = tuple ()
return %119 : $()
}