File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,43 @@ void unsafe_array_func_ptr_call(void (*fn_ptr)(int *param)) {
6
6
int p[32 ];
7
7
// CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:12}:"std::array<int, 32> p"
8
8
9
- int tmp = p[5 ];
9
+ p[5 ] = 10 ;
10
10
fn_ptr (p);
11
11
// CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:11}:".data()"
12
12
}
13
+
14
+ void unsafe_ptr_func_ptr_call (void (*fn_ptr)(int *param)) {
15
+ int *p;
16
+ // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:9}:"std::span<int> p"
17
+
18
+ p[5 ] = 10 ;
19
+ fn_ptr (p);
20
+ // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:11}:".data()"
21
+ }
22
+
23
+ void addr_of_unsafe_ptr_func_ptr_call (void (*fn_ptr)(int *param)) {
24
+ int *p;
25
+ // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:9}:"std::span<int> p"
26
+
27
+ p[5 ] = 10 ;
28
+ fn_ptr (&p[0 ]);
29
+ // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:15}:"p.data()"
30
+ }
31
+
32
+ void addr_of_unsafe_ptr_w_offset_func_ptr_call (void (*fn_ptr)(int *param)) {
33
+ int *p;
34
+ // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:9}:"std::span<int> p"
35
+
36
+ p[5 ] = 10 ;
37
+ fn_ptr (&p[3 ]);
38
+ // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:15}:"&p.data()[3]"
39
+ }
40
+
41
+ void preincrement_unsafe_ptr_func_ptr_call (void (*fn_ptr)(int *param)) {
42
+ int *p;
43
+ // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:9}:"std::span<int> p"
44
+
45
+ p[5 ] = 10 ;
46
+ fn_ptr (++p);
47
+ // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:13}:"(p = p.subspan(1)).data()"
48
+ }
You can’t perform that action at this time.
0 commit comments