@@ -110,6 +110,49 @@ func getset(p p: FooProto) {
110110 p. bar = prop
111111}
112112
113+ // CHECK-LABEL: define hidden %swift.type* @_TF7objc_ir16protocolMetatypeFT1pPSo8FooProto__PMPS0__(%objc_object*) {{.*}} {
114+ func protocolMetatype( p: FooProto ) -> FooProto . Type {
115+ // CHECK: = call %swift.type* @swift_getObjectType(%objc_object* %0)
116+ // CHECK-NOT: {{retain|release}}
117+ // CHECK: [[RAW_RESULT:%.+]] = call i8* @processFooType(i8* {{%.+}})
118+ // CHECK: [[CASTED_RESULT:%.+]] = bitcast i8* [[RAW_RESULT]] to %objc_class*
119+ // CHECK: [[SWIFT_RESULT:%.+]] = call %swift.type* @swift_getObjCClassMetadata(%objc_class* [[CASTED_RESULT]])
120+ // CHECK: call void @swift_unknownRelease(%objc_object* %0)
121+ // CHECK: ret %swift.type* [[SWIFT_RESULT]]
122+ let type = processFooType ( p. dynamicType)
123+ return type
124+ } // CHECK: }
125+
126+ class Impl : FooProto , AnotherProto {
127+ @objc var bar : Int32 = 0
128+ }
129+
130+ // CHECK-LABEL: define hidden %swift.type* @_TF7objc_ir27protocolCompositionMetatypeFT1pCS_4Impl_PMPSo12AnotherProtoSo8FooProto_(%C7objc_ir4Impl*) {{.*}} {
131+ func protocolCompositionMetatype( p: Impl ) -> protocol < FooProto , AnotherProto > . Type {
132+ // CHECK: = getelementptr inbounds %C7objc_ir4Impl, %C7objc_ir4Impl* %0, i32 0, i32 0, i32 0
133+ // CHECK-NOT: {{retain|release}}
134+ // CHECK: [[RAW_RESULT:%.+]] = call i8* @processComboType(i8* {{%.+}})
135+ // CHECK: [[CASTED_RESULT:%.+]] = bitcast i8* [[RAW_RESULT]] to %objc_class*
136+ // CHECK: [[SWIFT_RESULT:%.+]] = call %swift.type* @swift_getObjCClassMetadata(%objc_class* [[CASTED_RESULT]])
137+ // CHECK: call void bitcast (void (%swift.refcounted*)* @rt_swift_release to void (%C7objc_ir4Impl*)*)(%C7objc_ir4Impl* %0)
138+ // CHECK: ret %swift.type* [[SWIFT_RESULT]]
139+ let type = processComboType ( p. dynamicType)
140+ return type
141+ } // CHECK: }
142+
143+ // CHECK-LABEL: define hidden %swift.type* @_TF7objc_ir28protocolCompositionMetatype2FT1pCS_4Impl_PMPSo12AnotherProtoSo8FooProto_(%C7objc_ir4Impl*) {{.*}} {
144+ func protocolCompositionMetatype2( p: Impl ) -> protocol < FooProto , AnotherProto > . Type {
145+ // CHECK: = getelementptr inbounds %C7objc_ir4Impl, %C7objc_ir4Impl* %0, i32 0, i32 0, i32 0
146+ // CHECK-NOT: {{retain|release}}
147+ // CHECK: [[RAW_RESULT:%.+]] = call i8* @processComboType2(i8* {{%.+}})
148+ // CHECK: [[CASTED_RESULT:%.+]] = bitcast i8* [[RAW_RESULT]] to %objc_class*
149+ // CHECK: [[SWIFT_RESULT:%.+]] = call %swift.type* @swift_getObjCClassMetadata(%objc_class* [[CASTED_RESULT]])
150+ // CHECK: call void bitcast (void (%swift.refcounted*)* @rt_swift_release to void (%C7objc_ir4Impl*)*)(%C7objc_ir4Impl* %0)
151+ // CHECK: ret %swift.type* [[SWIFT_RESULT]]
152+ let type = processComboType2 ( p. dynamicType)
153+ return type
154+ } // CHECK: }
155+
113156// CHECK-LABEL: define hidden void @_TF7objc_ir17pointerPropertiesFCSo14PointerWrapperT_(%CSo14PointerWrapper*) {{.*}} {
114157func pointerProperties( _ obj: PointerWrapper ) {
115158 // CHECK: load i8*, i8** @"\01L_selector(setVoidPtr:)"
0 commit comments