4
4
typedef int * Int_ptr_t;
5
5
typedef int Int_t;
6
6
7
- void local_array (unsigned idx) {
7
+ void simple (unsigned idx) {
8
8
int buffer[10 ];
9
9
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:17}:"std::array<int, 10> buffer"
10
10
buffer[idx] = 0 ;
@@ -22,15 +22,19 @@ void comments_in_declaration(unsigned idx) {
22
22
buffer_w[idx] = 0 ;
23
23
}
24
24
25
- void unsupported_multi_decl1 (unsigned idx) {
25
+ void multi_decl1 (unsigned idx) {
26
26
int a, buffer[10 ];
27
- // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]
27
+ // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]
28
+ // FIXME: implement support
29
+
28
30
buffer[idx] = 0 ;
29
31
}
30
32
31
- void unsupported_multi_decl2 (unsigned idx) {
33
+ void multi_decl2 (unsigned idx) {
32
34
int buffer[10 ], b;
33
35
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]
36
+ // FIXME: implement support
37
+
34
38
buffer[idx] = 0 ;
35
39
}
36
40
@@ -42,40 +46,44 @@ void local_array_ptr_to_const(unsigned idx, const int*& a) {
42
46
43
47
void local_array_const_ptr (unsigned idx, int *& a) {
44
48
int * const buffer[10 ] = {a};
45
- // FIXME: implement support
46
49
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:.*-[[@LINE-1]]:.*}
50
+ // FIXME: implement support
51
+
47
52
a = buffer[idx];
48
53
49
54
}
50
55
51
56
void local_array_const_ptr_to_const (unsigned idx, const int *& a) {
52
57
const int * const buffer[10 ] = {a};
53
- // FIXME: implement support
54
58
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:.*-[[@LINE-1]]:.*}
59
+ // FIXME: implement support
60
+
55
61
a = buffer[idx];
56
62
57
63
}
58
64
59
65
template <typename T>
60
- void local_array_in_template (unsigned idx) {
66
+ void unsupported_local_array_in_template (unsigned idx) {
61
67
T buffer[10 ];
62
68
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:.*-[[@LINE-1]]:.*}
63
69
buffer[idx] = 0 ;
64
70
}
65
71
// Instantiate the template function to force its analysis.
66
- template void local_array_in_template <int >(unsigned ); // FIXME: expected note {{in instantiation of}}
72
+ template void unsupported_local_array_in_template <int >(unsigned );
67
73
68
- typedef unsigned int uint ;
74
+ typedef unsigned int my_uint ;
69
75
void typedef_as_elem_type (unsigned idx) {
70
- uint buffer[10 ];
71
- // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:18 }:"std::array<uint , 10> buffer"
76
+ my_uint buffer[10 ];
77
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:21 }:"std::array<my_uint , 10> buffer"
72
78
buffer[idx] = 0 ;
73
79
}
74
80
75
81
void macro_as_elem_type (unsigned idx) {
76
82
#define MY_INT int
77
83
MY_INT buffer[10 ];
84
+ // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:.*-[[@LINE-1]]:.*}
78
85
// FIXME: implement support
86
+
79
87
buffer[idx] = 0 ;
80
88
#undef MY_INT
81
89
}
@@ -119,6 +127,6 @@ void subscript_signed(int signed_idx) {
119
127
120
128
// For constant-size arrays any negative index will lead to buffer underflow.
121
129
// std::array::operator[] has unsigned parameter so the value will be casted to unsigned.
122
- // This will very likely be buffer overflow but hardened std::array catch these at runtime.
130
+ // This will very likely be buffer overflow but hardened std::array catches these at runtime.
123
131
buffer[signed_idx] = 0 ;
124
132
}
0 commit comments