Skip to content

Commit 0685106

Browse files
committed
[Casting] NFC: add some more tests for functions with parameter flags
1 parent e80455e commit 0685106

File tree

2 files changed

+52
-9
lines changed

2 files changed

+52
-9
lines changed

test/IRGen/dynamic_cast_functions.swift

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,46 @@ print((j_any as? (Int) -> Void) != nil ? "fail" : "ok")
7474
print((j_any as? (inout Int) -> Void) != nil ? "fail" : "ok")
7575
// CHECK: ok
7676
print((j_any as? (__shared Int) -> Void) != nil ? "ok" : "fail")
77+
78+
// CHECK: ok
79+
print((k_any as? (Int, Int) -> Void) != nil ? "fail" : "ok")
80+
// CHECK: ok
81+
print((k_any as? (Int, inout Int) -> Void) != nil ? "ok" : "fail")
82+
// CHECK: ok
83+
print((k_any as? (inout Int, Int) -> Void) != nil ? "fail" : "ok")
84+
// CHECK: ok
85+
print((k_any as? (inout Int, __shared Int) -> Void) != nil ? "fail" : "ok")
86+
87+
// CHECK: ok
88+
print((l_any as? (Int, Float, String) -> Void) != nil ? "fail" : "ok")
89+
// CHECK: ok
90+
print((l_any as? (Int, Float, inout String) -> Void) != nil ? "fail" : "ok")
91+
// CHECK: ok
92+
print((l_any as? (Int, inout Float, String) -> Void) != nil ? "fail" : "ok")
93+
// CHECK: ok
94+
print((l_any as? (inout Int, Float, String) -> Void) != nil ? "fail" : "ok")
95+
// CHECK: ok
96+
print((l_any as? (inout Int, inout Float, String) -> Void) != nil ? "fail" : "ok")
97+
// CHECK: ok
98+
print((l_any as? (inout Int, Float, __shared String) -> Void) != nil ? "fail" : "ok")
99+
// CHECK: ok
100+
print((l_any as? (inout Int, Float, inout String) -> Void) != nil ? "ok" : "fail")
101+
102+
// CHECK: ok
103+
print((m_any as? (Int, String, Float, Double) -> Void) != nil ? "fail" : "ok")
104+
// CHECK: ok
105+
print((m_any as? (Int, String, Float, inout Double) -> Void) != nil ? "fail" : "ok")
106+
// CHECK: ok
107+
print((m_any as? (Int, String, Float, __shared Double) -> Void) != nil ? "fail" : "ok")
108+
// CHECK: ok
109+
print((m_any as? (Int, String, inout Float, Double) -> Void) != nil ? "fail" : "ok")
110+
// CHECK: ok
111+
print((m_any as? (Int, __shared String, Float, Double) -> Void) != nil ? "fail" : "ok")
112+
// CHECK: ok
113+
print((m_any as? (inout Int, String, __shared Float, Double) -> Void) != nil ? "fail" : "ok")
114+
// CHECK: ok
115+
print((m_any as? (__shared Int, String, Float, inout Double) -> Void) != nil ? "fail" : "ok")
116+
// CHECK: ok
117+
print((m_any as? (Int, __shared String, inout Float, Double) -> Void) != nil ? "fail" : "ok")
118+
// CHECK: ok
119+
print((m_any as? (__shared Int, String, inout Float, Double) -> Void) != nil ? "ok" : "fail")

test/IRGen/function_metadata.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ func test_arch() {
3131
// CHECK: call %swift.type* @swift_getFunctionTypeMetadata3([[WORD]] 3, %swift.type* @_T0SfN, %swift.type* @_T0SfN, %swift.type* @_T0SiN, %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* @_T0ytN, i32 0, i32 1))
3232
arch({(a: Float, b: Float, c: Int) -> () in })
3333

34-
// CHECK: [[T0:%.*]] = getelementptr inbounds [4 x %swift.type*], [4 x %swift.type*]* %function-parameters, i32 0, i32 0
35-
// CHECK: store %swift.type* @_T0SiN, %swift.type** [[T0:%.*]], align 8
36-
// CHECK: [[T0:%.*]] = getelementptr inbounds [4 x %swift.type*], [4 x %swift.type*]* %function-parameters, i32 0, i32 1
37-
// CHECK: store %swift.type* @_T0SdN, %swift.type** [[T0:%.*]], align 8
38-
// CHECK: [[T0:%.*]] = getelementptr inbounds [4 x %swift.type*], [4 x %swift.type*]* %function-parameters, i32 0, i32 2
39-
// CHECK: store %swift.type* @_T0SSN, %swift.type** [[T0:%.*]], align 8
40-
// CHECK: [[T0:%.*]] = getelementptr inbounds [4 x %swift.type*], [4 x %swift.type*]* %function-parameters, i32 0, i32 3
41-
// CHECK: store %swift.type* @_T0s4Int8VN, %swift.type** [[T0:%.*]], align 8
42-
// CHECK: [[T0:%.*]] = getelementptr inbounds [4 x %swift.type*], [4 x %swift.type*]* %function-parameters, i32 0, i32 0
34+
// CHECK: getelementptr inbounds [4 x %swift.type*], [4 x %swift.type*]* %function-parameters, i32 0, i32 0
35+
// CHECK: store %swift.type* @_T0SiN, %swift.type** [[T:%.*]], align [[ALIGN:(4|8)]]
36+
// CHECK: getelementptr inbounds [4 x %swift.type*], [4 x %swift.type*]* %function-parameters, i32 0, i32 1
37+
// CHECK: store %swift.type* @_T0SdN, %swift.type** [[T:%.*]], align [[ALIGN:(4|8)]]
38+
// CHECK: getelementptr inbounds [4 x %swift.type*], [4 x %swift.type*]* %function-parameters, i32 0, i32 2
39+
// CHECK: store %swift.type* @_T0SSN, %swift.type** [[T:%.*]], align [[ALIGN:(4|8)]]
40+
// CHECK: getelementptr inbounds [4 x %swift.type*], [4 x %swift.type*]* %function-parameters, i32 0, i32 3
41+
// CHECK: store %swift.type* @_T0s4Int8VN, %swift.type** [[T:%.*]], align [[ALIGN:(4|8)]]
42+
// CHECK: [[T:%.*]] = getelementptr inbounds [4 x %swift.type*], [4 x %swift.type*]* %function-parameters, i32 0, i32 0
4343
// CHECK: call %swift.type* @swift_getFunctionTypeMetadata([[WORD]] 16777220, %swift.type** %7, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @parameter-flags, i32 0, i32 0), %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* @_T0ytN, i32 0, i32 1))
4444
arch({(x: inout Int, y: Double, z: String, w: Int8) -> () in })
4545
}

0 commit comments

Comments
 (0)