@@ -12,6 +12,7 @@ import gizmo
12
12
13
13
@objc class ObjCClass : BaseClassForMethodFamilies {
14
14
func method(x: Int) {}
15
+ func method2(r: NSRect) {}
15
16
16
17
override func fakeInitFamily() -> ObjCClass { return self }
17
18
}
@@ -36,6 +37,11 @@ bb0(%0 : $Int, %1 : $ObjCClass):
36
37
%v = tuple()
37
38
return %v : $()
38
39
}
40
+ sil @_TToFC13partial_apply9ObjCClass7method2fT1rVSC6NSRect_T_ : $@convention(objc_method) (NSRect, ObjCClass) -> () {
41
+ bb0(%0 : $NSRect, %1 : $ObjCClass):
42
+ %v = tuple()
43
+ return %v : $()
44
+ }
39
45
40
46
sil @_TToFC13partial_apply9ObjCClass14fakeInitFamilyfT_S0_ : $@convention(objc_method) (@owned ObjCClass) -> @owned ObjCClass {
41
47
bb0(%0 : $ObjCClass):
@@ -107,6 +113,27 @@ entry(%c : $ObjCClass):
107
113
return %p : $@callee_owned Int -> ()
108
114
}
109
115
116
+ // CHECK-LABEL: define{{.*}} { i8*, %swift.refcounted* } @objc_partial_apply_indirect_sil_argument(%C13partial_apply9ObjCClass*) {{.*}}
117
+ // CHECK: [[CTX:%.*]] = call noalias %swift.refcounted* @rt_swift_allocObject
118
+ // CHECK: [[CTX_ADDR:%.*]] = bitcast %swift.refcounted* [[CTX]] to [[CTXTYPE:<{ %swift.refcounted, %C13partial_apply9ObjCClass\* }>]]*
119
+ // CHECK: [[SELF_ADDR:%.*]] = getelementptr inbounds [[CTXTYPE]], [[CTXTYPE]]* [[CTX_ADDR]], i32 0, i32 1
120
+ // CHECK: store %C13partial_apply9ObjCClass* %0, %C13partial_apply9ObjCClass** [[SELF_ADDR]]
121
+ // CHECK: [[CLOSURE:%.*]] = insertvalue { i8*, %swift.refcounted* } { i8* bitcast (void (%VSC6NSRect*, %swift.refcounted*)* [[OBJC_PARTIAL_APPLY_STUB2:@_TPA[A-Za-z0-9_.]*]] to i8*), %swift.refcounted* undef }, %swift.refcounted* [[CTX]], 1
122
+ // CHECK: ret { i8*, %swift.refcounted* } [[CLOSURE]]
123
+ // CHECK:}
124
+ // CHECK: define internal void [[OBJC_PARTIAL_APPLY_STUB2]](%VSC6NSRect* noalias nocapture dereferenceable(32), %swift.refcounted*
125
+ // CHECK: [[TMP:%.*]] = alloca %VSC6NSRect
126
+ // CHECK: [[ORIGIN:%.*]] = getelementptr inbounds %VSC6NSRect, %VSC6NSRect* %0
127
+ // CHECK: [[ORIGINX:%.*]] = getelementptr inbounds %VSC7NSPoint, %VSC7NSPoint* [[ORIGIN]]
128
+ // CHECK: [[ORIGINXVAL:%*]] = getelementptr inbounds %Sd, %Sd* [[ORIGINX]]
129
+ // CHECK: [[VAL:%.*]] = load double, double* [[ORIGINXVAL]]
130
+ sil @objc_partial_apply_indirect_sil_argument : $@convention(thin) ObjCClass -> @callee_owned NSRect -> () {
131
+ entry(%c : $ObjCClass):
132
+ %m = class_method [volatile] %c : $ObjCClass, #ObjCClass.method2!1.foreign : (ObjCClass) -> (NSRect) -> () , $@convention(objc_method) (NSRect, ObjCClass) -> ()
133
+ %p = partial_apply %m(%c) : $@convention(objc_method) (NSRect, ObjCClass) -> ()
134
+ return %p : $@callee_owned NSRect -> ()
135
+ }
136
+
110
137
// CHECK-LABEL: define{{( protected)?}} { i8*, %swift.refcounted* } @objc_partial_apply_consumes_self(%C13partial_apply9ObjCClass*) {{.*}} {
111
138
// CHECK: bitcast %swift.refcounted* {{%.*}} to [[DATA_TYPE:<{ %swift.refcounted, %C13partial_apply9ObjCClass\* }>]]*
112
139
// CHECK: insertvalue {{.*}} [[OBJC_CONSUMES_SELF_PARTIAL_APPLY_STUB:@_TPA[A-Za-z0-9_.]*]]
0 commit comments