@@ -16,23 +16,23 @@ void DecomposeByAssignWarnCases() {
16
16
{
17
17
auto P = getPair<int , int >();
18
18
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
19
- // CHECK-FIXES: {{^}} auto [x, y] = getPair<int, int>();
19
+ // CHECK-FIXES: auto [x, y] = getPair<int, int>();
20
20
int x = P.first ;
21
21
int y = P.second ;
22
22
}
23
23
24
24
{
25
25
auto P = getPair<int , int >();
26
26
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
27
- // CHECK-FIXES: {{^}} auto [x, y] = getPair<int, int>();
27
+ // CHECK-FIXES: auto [x, y] = getPair<int, int>();
28
28
int x = P.first ;
29
29
auto y = P.second ;
30
30
}
31
31
32
32
{
33
33
const auto P = getPair<int , int >();
34
34
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
35
- // CHECK-FIXES: {{^}} const auto [x, y] = getPair<int, int>();
35
+ // CHECK-FIXES: const auto [x, y] = getPair<int, int>();
36
36
const int x = P.first ;
37
37
const auto y = P.second ;
38
38
}
@@ -41,7 +41,7 @@ void DecomposeByAssignWarnCases() {
41
41
std::pair<int , int > otherP;
42
42
auto & P = otherP;
43
43
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
44
- // CHECK-FIXES: {{^}} auto& [x, y] = otherP;
44
+ // CHECK-FIXES: auto& [x, y] = otherP;
45
45
int & x = P.first ;
46
46
auto & y = P.second ;
47
47
}
@@ -50,7 +50,7 @@ void DecomposeByAssignWarnCases() {
50
50
std::pair<int , int > otherP;
51
51
const auto & P = otherP;
52
52
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
53
- // CHECK-FIXES: {{^}} const auto& [x, y] = otherP;
53
+ // CHECK-FIXES: const auto& [x, y] = otherP;
54
54
const int & x = P.first ;
55
55
const auto & y = P.second ;
56
56
}
@@ -60,43 +60,43 @@ void forRangeWarnCases() {
60
60
std::pair<int , int > Pairs[10 ];
61
61
for (auto P : Pairs) {
62
62
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
63
- // CHECK-FIXES: {{^}} for (auto [x, y] : Pairs) {
63
+ // CHECK-FIXES: for (auto [x, y] : Pairs) {
64
64
int x = P.first ;
65
65
int y = P.second ;
66
66
}
67
67
68
68
for (const auto P : Pairs) {
69
69
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
70
- // CHECK-FIXES: {{^}} for (const auto [x, y] : Pairs) {
70
+ // CHECK-FIXES: for (const auto [x, y] : Pairs) {
71
71
const int x = P.first ;
72
72
const int y = P.second ;
73
73
}
74
74
75
75
for (auto & P : Pairs) {
76
76
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
77
- // CHECK-FIXES: {{^}} for (auto& [x, y] : Pairs) {
77
+ // CHECK-FIXES: for (auto& [x, y] : Pairs) {
78
78
int & x = P.first ;
79
79
int & y = P.second ;
80
80
}
81
81
82
82
for (const auto & P : Pairs) {
83
83
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
84
- // CHECK-FIXES: {{^}} for (const auto& [x, y] : Pairs) {
84
+ // CHECK-FIXES: for (const auto& [x, y] : Pairs) {
85
85
const int & x = P.first ;
86
86
const int & y = P.second ;
87
87
}
88
88
89
89
std::pair<TestClass, TestClass> ClassPairs[10 ];
90
90
for (auto P : ClassPairs) {
91
91
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
92
- // CHECK-FIXES: {{^}} for (auto [c1, c2] : ClassPairs) {
92
+ // CHECK-FIXES: for (auto [c1, c2] : ClassPairs) {
93
93
TestClass c1 = P.first ;
94
94
TestClass c2 = P.second ;
95
95
}
96
96
97
97
for (const auto P : ClassPairs) {
98
98
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
99
- // CHECK-FIXES: {{^}} for (const auto [c1, c2] : ClassPairs) {
99
+ // CHECK-FIXES: for (const auto [c1, c2] : ClassPairs) {
100
100
const TestClass c1 = P.first ;
101
101
const TestClass c2 = P.second ;
102
102
}
@@ -136,19 +136,19 @@ void stdTieWarnCases() {
136
136
int b = 0 ;
137
137
std::tie (a, b) = getPair<int , int >();
138
138
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
139
- // CHECK-FIXES: {{^}} auto [a, b] = getPair<int, int>();
139
+ // CHECK-FIXES: auto [a, b] = getPair<int, int>();
140
140
141
141
int * pa = nullptr ;
142
142
int * pb = nullptr ;
143
143
std::tie (pa, pb) = getPair<int *, int *>();
144
144
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
145
- // CHECK-FIXES: {{^}} auto [pa, pb] = getPair<int*, int*>();
145
+ // CHECK-FIXES: auto [pa, pb] = getPair<int*, int*>();
146
146
147
147
TestClass c1 (1 , 2 );
148
148
TestClass c2 = TestClass {3 , 4 };
149
149
std::tie (c1, c2) = getPair<TestClass, TestClass>();
150
150
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
151
- // CHECK-FIXES: {{^}} auto [c1, c2] = getPair<TestClass, TestClass>();
151
+ // CHECK-FIXES: auto [c1, c2] = getPair<TestClass, TestClass>();
152
152
}
153
153
154
154
void stdTieNotWarnCases () {
0 commit comments