1
1
// RUN: %empty-directory(%t)
2
2
// RUN: %build-irgen-test-overlays
3
3
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -disable-objc-attr-requires-foundation-module -emit-module %S/Inputs/objc_extension_base.swift -o %t
4
- // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %use_no_opaque_pointers -primary-file %s -emit-ir -g | %FileCheck %s
5
- // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir -g
4
+ // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir -g | %FileCheck %s
6
5
7
6
// REQUIRES: CPU=x86_64 || CPU=arm64
8
7
// REQUIRES: objc_interop
@@ -22,12 +21,12 @@ import objc_extension_base
22
21
// CHECK-SAME: @_PROTOCOL__TtP15objc_extensions11NewProtocol_
23
22
24
23
// CHECK-LABEL: @"_CATEGORY_Gizmo_$_objc_extensions" = internal constant
25
- // CHECK-SAME: i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[ CATEGORY_NAME]], i64 0, i64 0) ,
26
- // CHECK-SAME: %objc_class* @"OBJC_CLASS_$_Gizmo",
24
+ // CHECK-SAME: ptr [[ CATEGORY_NAME]],
25
+ // CHECK-SAME: ptr @"OBJC_CLASS_$_Gizmo",
27
26
// CHECK-SAME: @"_CATEGORY_INSTANCE_METHODS_Gizmo_$_objc_extensions",
28
27
// CHECK-SAME: @"_CATEGORY_CLASS_METHODS_Gizmo_$_objc_extensions",
29
28
// CHECK-SAME: @"_CATEGORY_PROTOCOLS_Gizmo_$_objc_extensions",
30
- // CHECK-SAME: i8* null
29
+ // CHECK-SAME: ptr null
31
30
// CHECK-SAME: }, section "__DATA, {{.*}}", align 8
32
31
33
32
@objc protocol NewProtocol {
@@ -62,12 +61,12 @@ extension Gizmo: NewProtocol {
62
61
// CHECK: [[CATEGORY_NAME_1:@.*]] = private unnamed_addr constant [17 x i8] c"objc_extensions1\00"
63
62
64
63
// CHECK: @"_CATEGORY_Gizmo_$_objc_extensions1" = internal constant
65
- // CHECK: i8* getelementptr inbounds ([17 x i8], [17 x i8]* [[ CATEGORY_NAME_1]], i64 0, i64 0) ,
66
- // CHECK: %objc_class* @"OBJC_CLASS_$_Gizmo",
64
+ // CHECK: ptr [[ CATEGORY_NAME_1]],
65
+ // CHECK: ptr @"OBJC_CLASS_$_Gizmo",
67
66
// CHECK: {{.*}} @"_CATEGORY_INSTANCE_METHODS_Gizmo_$_objc_extensions1",
68
67
// CHECK: {{.*}} @"_CATEGORY_CLASS_METHODS_Gizmo_$_objc_extensions1",
69
- // CHECK: i8* null,
70
- // CHECK: i8* null
68
+ // CHECK: ptr null,
69
+ // CHECK: ptr null
71
70
// CHECK: }, section "__DATA, {{.*}}", align 8
72
71
73
72
extension Gizmo {
@@ -88,30 +87,30 @@ class Hoozit : NSObject {
88
87
// CHECK-LABEL: @"_CATEGORY_INSTANCE_METHODS__TtC15objc_extensions6Hoozit_$_objc_extensions" = internal constant
89
88
// CHECK: i32 24,
90
89
// CHECK: i32 1,
91
- // CHECK: [1 x { i8*, i8*, i8* }] [{ i8*, i8*, i8* } {
92
- // CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* @"\01L_selector_data(blibble)", i64 0, i64 0) ,
93
- // CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[ STR:@. *]], i64 0, i64 0) ,
94
- // CHECK: i8* bitcast (void ([[OPAQUE:%.*]]*, i8*)* @"$s15objc_extensions6HoozitC7blibbleyyFTo" to i8*)
90
+ // CHECK: [1 x { ptr, ptr, ptr }] [{ ptr, ptr, ptr } {
91
+ // CHECK: ptr @"\01L_selector_data(blibble)",
92
+ // CHECK: ptr [[ STR:@[^,] *]],
93
+ // CHECK: ptr @"$s15objc_extensions6HoozitC7blibbleyyFTo"
95
94
// CHECK: }]
96
95
// CHECK: }, section "__DATA, {{.*}}", align 8
97
96
98
97
// CHECK-LABEL: @"_CATEGORY_CLASS_METHODS__TtC15objc_extensions6Hoozit_$_objc_extensions" = internal constant
99
98
// CHECK: i32 24,
100
99
// CHECK: i32 1,
101
- // CHECK: [1 x { i8*, i8*, i8* }] [{ i8*, i8*, i8* } {
102
- // CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* @"\01L_selector_data(blobble)", i64 0, i64 0) ,
103
- // CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[ STR]], i64 0, i64 0) ,
104
- // CHECK: i8* bitcast (void (i8*, i8*)* @"$s15objc_extensions6HoozitC7blobbleyyFZTo" to i8*)
100
+ // CHECK: [1 x { ptr, ptr, ptr }] [{ ptr, ptr, ptr } {
101
+ // CHECK: ptr @"\01L_selector_data(blobble)",
102
+ // CHECK: ptr [[ STR]],
103
+ // CHECK: ptr @"$s15objc_extensions6HoozitC7blobbleyyFZTo"
105
104
// CHECK: }]
106
105
// CHECK: }, section "__DATA, {{.*}}", align 8
107
106
108
107
// CHECK-LABEL: @"_CATEGORY__TtC15objc_extensions6Hoozit_$_objc_extensions" = internal constant
109
- // CHECK: i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[ CATEGORY_NAME]], i64 0, i64 0) ,
110
- // CHECK: %swift.type* {{.*}} @"$s15objc_extensions6HoozitCMf",
108
+ // CHECK: ptr [[ CATEGORY_NAME]],
109
+ // CHECK: ptr {{.*}} @"$s15objc_extensions6HoozitCMf",
111
110
// CHECK: {{.*}} @"_CATEGORY_INSTANCE_METHODS__TtC15objc_extensions6Hoozit_$_objc_extensions",
112
111
// CHECK: {{.*}} @"_CATEGORY_CLASS_METHODS__TtC15objc_extensions6Hoozit_$_objc_extensions",
113
- // CHECK: i8* null,
114
- // CHECK: i8* null
112
+ // CHECK: ptr null,
113
+ // CHECK: ptr null
115
114
// CHECK: }, section "__DATA, {{.*}}", align 8
116
115
117
116
extension Hoozit {
@@ -124,10 +123,10 @@ class SwiftOnly { }
124
123
// CHECK-LABEL: @"_CATEGORY_INSTANCE_METHODS__TtC15objc_extensions9SwiftOnly_$_objc_extensions" = internal constant
125
124
// CHECK: i32 24,
126
125
// CHECK: i32 1,
127
- // CHECK: [1 x { i8*, i8*, i8* }] [{ i8*, i8*, i8* } {
128
- // CHECK: i8* getelementptr inbounds ([7 x i8], [7 x i8]* @"\01L_selector_data(wibble)", i64 0, i64 0) ,
129
- // CHECK: i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[ STR]], i64 0, i64 0) ,
130
- // CHECK: i8* bitcast (void (i8*, i8*)* @"$s15objc_extensions9SwiftOnlyC6wibbleyyFTo" to i8*)
126
+ // CHECK: [1 x { ptr, ptr, ptr }] [{ ptr, ptr, ptr } {
127
+ // CHECK: ptr @"\01L_selector_data(wibble)",
128
+ // CHECK: ptr [[ STR]],
129
+ // CHECK: ptr @"$s15objc_extensions9SwiftOnlyC6wibbleyyFTo"
131
130
// CHECK: }] }, section "__DATA, {{.*}}", align 8
132
131
extension SwiftOnly {
133
132
@objc func wibble( ) { }
@@ -155,9 +154,9 @@ extension NSObject {
155
154
156
155
157
156
// CHECK-LABEL: @"_CATEGORY__TtCC15objc_extensions5Outer5Inner_$_objc_extensions" = internal constant
158
- // CHECK-SAME: i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[ CATEGORY_NAME]], i64 0, i64 0) ,
157
+ // CHECK-SAME: ptr [[ CATEGORY_NAME]],
159
158
// CHECK-SAME: @"_CATEGORY_INSTANCE_METHODS__TtCC15objc_extensions5Outer5Inner_$_objc_extensions",
160
- // CHECK-SAME: i8* null
159
+ // CHECK-SAME: ptr null
161
160
// CHECK-SAME: }, section "__DATA, {{.*}}", align 8
162
161
163
162
class Outer : NSObject {
@@ -176,7 +175,7 @@ class NSDogcow : NSObject {}
176
175
177
176
// CHECK: [[NAME:@.*]] = private unnamed_addr constant [5 x i8] c"woof\00"
178
177
// CHECK: [[ATTR:@.*]] = private unnamed_addr constant [7 x i8] c"Tq,N,D\00"
179
- // CHECK: @"_CATEGORY_PROPERTIES__TtC15objc_extensions8NSDogcow_$_objc_extensions" = internal constant {{.*}} [[NAME]], {{.*}} [[ATTR]], {{.*}}, section "__DATA, {{.*}}", align 8
178
+ // CHECK: @"_CATEGORY_PROPERTIES__TtC15objc_extensions8NSDogcow_$_objc_extensions" = internal constant {{.*}} [[NAME]], {{.*}} [[ATTR]] {{.*}}, section "__DATA, {{.*}}", align 8
180
179
extension NSDogcow {
181
180
@NSManaged var woof : Int
182
181
}
@@ -206,40 +205,37 @@ class SwiftSubGizmo : SwiftBaseGizmo {
206
205
*/
207
206
extension FungingArray {
208
207
// CHECK-LABEL: define {{.*}} @"$sSo12FungingArrayC15objc_extensionsEyAByxGxcfC"
209
- // CHECK-SAME: (%objc_object* %0, %swift.type* swiftself %1)
208
+ // CHECK-SAME: (ptr %0, ptr swiftself %1)
210
209
// CHECK: @__swift_instantiateConcreteTypeFromMangledName{{.*}}@"$sSo9NSFunging_pMD"{{.*}}!dbg
211
210
212
211
// CHECK-LABEL: define {{.*}} @"$sSo12FungingArrayC15objc_extensionsEyAByxGxcfc"
213
- // CHECK-SAME: (%objc_object* %0, %TSo12FungingArrayC* swiftself %1)
212
+ // CHECK-SAME: (ptr %0, ptr swiftself %1)
214
213
// CHECK: [[ALLOCA:%[^, =]+]] = alloca %Any, align 8
215
214
// CHECK: @__swift_instantiateConcreteTypeFromMangledName{{.*}}@"$sSo9NSFunging_pMD"{{.*}}!dbg
216
- // CHECK: {{%[^, =]+}} = getelementptr inbounds %Any, %Any* [[ALLOCA]], i32 0, i32 0
217
- // CHECK: [[ANYBUF:%[^, =]+]] = getelementptr inbounds %Any, %Any* [[ALLOCA]], i32 0, i32 0
215
+ // CHECK: {{%[^, =]+}} = getelementptr inbounds %Any, ptr [[ALLOCA]], i32 0, i32 0
216
+ // CHECK: [[ANYBUF:%[^, =]+]] = getelementptr inbounds %Any, ptr [[ALLOCA]], i32 0, i32 0
218
217
// CHECK: [[BUFPTR:%[^, =]+]] = {{.*}} [[ANYBUF]]
219
- // CHECK: [[BUF_0:%[^, =]+]] = {{.*}} [[BUFPTR]]
220
- // CHECK: store {{.*}} %0, {{.*}} [[BUF_0]]
221
- // CHECK: call swiftcc void @"$s15objc_extensions11opaquePrintyyypF"(%Any* {{.*}} [[ALLOCA]])
218
+ // CHECK: store {{.*}} %0, {{.*}} [[BUFPTR]]
219
+ // CHECK: call swiftcc void @"$s15objc_extensions11opaquePrintyyypF"(ptr {{.*}} [[ALLOCA]])
222
220
@objc public convenience init ( _ elem: Element ) {
223
221
opaquePrint ( elem)
224
222
self . init ( )
225
223
}
226
224
227
225
// CHECK-LABEL: define {{.*}} @"$sSo12FungingArrayC15objc_extensionsE7pinningAByxGxm_tcfC"
228
- // CHECK-SAME: (%swift.type* %0, %swift.type* swiftself %1)
226
+ // CHECK-SAME: (ptr %0, ptr swiftself %1)
229
227
// CHECK: @__swift_instantiateConcreteTypeFromMangledName{{.*}}@"$sSo9NSFunging_pMD"{{.*}}!dbg
230
228
231
229
// CHECK-LABEL: define {{.*}} @"$sSo12FungingArrayC15objc_extensionsE7pinningAByxGxm_tcfc"
232
- // CHECK-SAME: (%swift.type* %0, %TSo12FungingArrayC* swiftself %1)
230
+ // CHECK-SAME: (ptr %0, ptr swiftself %1)
233
231
// CHECK: [[ALLOCA:%[^, =]+]] = alloca %Any, align 8
234
232
// CHECK: @__swift_instantiateConcreteTypeFromMangledName{{.*}}@"$sSo9NSFunging_pMD"{{.*}}!dbg
235
- // CHECK: [[OBJC_CLASS:%[^, =]+]] = call %objc_class* @swift_getObjCClassFromMetadata(%swift.type* %0)
236
- // CHECK: [[OBJC_CLASS_OBJ:%[^, =]+]] = bitcast %objc_class* [[OBJC_CLASS]]
237
- // CHECK: {{%[^, =]+}} = getelementptr inbounds %Any, %Any* [[ALLOCA]], i32 0, i32 0
238
- // CHECK: [[ANYBUF:%[^, =]+]] = getelementptr inbounds %Any, %Any* [[ALLOCA]], i32 0, i32 0
233
+ // CHECK: [[OBJC_CLASS:%[^, =]+]] = call ptr @swift_getObjCClassFromMetadata(ptr %0)
234
+ // CHECK: {{%[^, =]+}} = getelementptr inbounds %Any, ptr [[ALLOCA]], i32 0, i32 0
235
+ // CHECK: [[ANYBUF:%[^, =]+]] = getelementptr inbounds %Any, ptr [[ALLOCA]], i32 0, i32 0
239
236
// CHECK: [[BUFPTR:%[^, =]+]] = {{.*}} [[ANYBUF]]
240
- // CHECK: [[BUF_0:%[^, =]+]] = {{.*}} [[BUFPTR]]
241
- // CHECK: store {{.*}} [[OBJC_CLASS_OBJ]], {{.*}} [[BUF_0]]
242
- // CHECK: call swiftcc void @"$s15objc_extensions11opaquePrintyyypF"(%Any* {{.*}} [[ALLOCA]])
237
+ // CHECK: store {{.*}} [[OBJC_CLASS]], {{.*}} [[BUFPTR]]
238
+ // CHECK: call swiftcc void @"$s15objc_extensions11opaquePrintyyypF"(ptr {{.*}} [[ALLOCA]])
243
239
@objc public convenience init ( pinning: Element . Type ) {
244
240
opaquePrint ( pinning as AnyObject )
245
241
self . init ( )
0 commit comments