mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
72 lines
3.0 KiB
Plaintext
72 lines
3.0 KiB
Plaintext
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 : $()
|
|
}
|