1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
sil_stage raw // CHECK: sil_stage canonical
import Builtin
import Swift
import Foundation
protocol SomeProtocol { }
class SomeClass : SomeProtocol { }
// CHECK-LABEL: @objc_classes : $@convention(thin) (@thick NSObject.Type) -> ()
sil [transparent] [serialized] [ossa] @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: } // end sil function 'objc_classes'
class Bas : NSObject {
var strRealProp : String
override init()
}
sil [serialized] [ossa] @test_super_method : $@convention(method) (@guaranteed Bas) -> Bas
sil [serialized] [ossa] @swift_StringToNSString : $@convention(thin) (@inout String) -> @owned NSString
sil [serialized] [ossa] @$sSSSSycSSmcfC : $@convention(thin) (@thin String.Type) -> @owned String
protocol SomeClassProtocol : class {}
// CHECK-LABEL: sil public_external [transparent] @metatype_to_object
// CHECK: {{%.*}} = objc_metatype_to_object {{%.*}} : $@objc_metatype SomeClass.Type to $AnyObject
// CHECK: {{%.*}} = objc_existential_metatype_to_object {{%.*}} : $@objc_metatype any SomeClassProtocol.Type to $AnyObject
sil [transparent] [serialized] [ossa] @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 [transparent] @protocol_conversion
sil [transparent] [serialized] [ossa] @protocol_conversion : $@convention(thin) () -> @owned Protocol {
entry:
// CHECK: {{%.*}} = objc_protocol #ObjCProto : $Protocol
%p = objc_protocol #ObjCProto : $Protocol
%p_copy = copy_value %p : $Protocol
return %p_copy : $Protocol
}
@_transparent public func serialize_all() {
}
sil [transparent] [serialized] [ossa] @$s14def_basic_objc13serialize_allyyF : $@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 : $()
}
|