@@ -18,6 +18,7 @@ void DecomposeByAssignWarnCases() {
18
18
auto P = getPair<int , int >();
19
19
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
20
20
// CHECK-FIXES: auto [x, y] = getPair<int, int>();
21
+ // CHECK-NEXT: // REMOVE
21
22
int x = P.first ;
22
23
int y = P.second ; // REMOVE
23
24
// CHECK-FIXES: // REMOVE
@@ -44,6 +45,7 @@ void DecomposeByAssignWarnCases() {
44
45
auto P = getPair<int , int >();
45
46
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
46
47
// CHECK-FIXES: auto [x, y] = getPair<int, int>();
48
+ // CHECK-NEXT: // REMOVE
47
49
int x = P.first ;
48
50
auto y = P.second ; // REMOVE
49
51
// CHECK-FIXES: // REMOVE
@@ -53,6 +55,7 @@ void DecomposeByAssignWarnCases() {
53
55
const auto P = getPair<int , int >();
54
56
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
55
57
// CHECK-FIXES: const auto [x, y] = getPair<int, int>();
58
+ // CHECK-NEXT: // REMOVE
56
59
const int x = P.first ;
57
60
const auto y = P.second ; // REMOVE
58
61
// CHECK-FIXES: // REMOVE
@@ -63,6 +66,7 @@ void DecomposeByAssignWarnCases() {
63
66
auto & P = otherP;
64
67
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
65
68
// CHECK-FIXES: auto& [x, y] = otherP;
69
+ // CHECK-NEXT: // REMOVE
66
70
int & x = P.first ;
67
71
auto & y = P.second ; // REMOVE
68
72
// CHECK-FIXES: // REMOVE
@@ -73,6 +77,7 @@ void DecomposeByAssignWarnCases() {
73
77
const auto & P = otherP;
74
78
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
75
79
// CHECK-FIXES: const auto& [x, y] = otherP;
80
+ // CHECK-NEXT: // REMOVE
76
81
const int & x = P.first ;
77
82
const auto & y = P.second ; // REMOVE
78
83
// CHECK-FIXES: // REMOVE
@@ -82,13 +87,15 @@ void DecomposeByAssignWarnCases() {
82
87
auto P = getPair<int , int >();
83
88
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
84
89
// CHECK-FIXES: auto [x, y] = getPair<int, int>();
90
+ // CHECK-NEXT: // REMOVE
85
91
int x = P.first ;
86
92
int y = P.second ; // REMOVE
87
93
// CHECK-FIXES: // REMOVE
88
94
89
95
auto another_p = getPair<int , int >();
90
96
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
91
97
// CHECK-FIXES: auto [another_x, another_y] = getPair<int, int>();
98
+ // CHECK-NEXT: // REMOVE
92
99
int another_x = another_p.first ;
93
100
int another_y = another_p.second ; // REMOVE
94
101
// CHECK-FIXES: // REMOVE
@@ -100,6 +107,7 @@ void forRangeWarnCases() {
100
107
for (auto P : Pairs) {
101
108
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
102
109
// CHECK-FIXES: for (auto [x, y] : Pairs) {
110
+ // CHECK-NEXT: // REMOVE
103
111
int x = P.first ;
104
112
int y = P.second ; // REMOVE
105
113
// CHECK-FIXES: // REMOVE
@@ -123,6 +131,7 @@ void forRangeWarnCases() {
123
131
for (const auto P : Pairs) {
124
132
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
125
133
// CHECK-FIXES: for (const auto [x, y] : Pairs) {
134
+ // CHECK-NEXT: // REMOVE
126
135
const int x = P.first ;
127
136
const int y = P.second ; // REMOVE
128
137
// CHECK-FIXES: // REMOVE
@@ -131,6 +140,7 @@ void forRangeWarnCases() {
131
140
for (auto & P : Pairs) {
132
141
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
133
142
// CHECK-FIXES: for (auto& [x, y] : Pairs) {
143
+ // CHECK-NEXT: // REMOVE
134
144
int & x = P.first ;
135
145
int & y = P.second ; // REMOVE
136
146
// CHECK-FIXES: // REMOVE
@@ -139,6 +149,7 @@ void forRangeWarnCases() {
139
149
for (const auto & P : Pairs) {
140
150
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
141
151
// CHECK-FIXES: for (const auto& [x, y] : Pairs) {
152
+ // CHECK-NEXT: // REMOVE
142
153
const int & x = P.first ;
143
154
const int & y = P.second ; // REMOVE
144
155
// CHECK-FIXES: // REMOVE
@@ -148,6 +159,7 @@ void forRangeWarnCases() {
148
159
for (auto P : ClassPairs) {
149
160
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
150
161
// CHECK-FIXES: for (auto [c1, c2] : ClassPairs) {
162
+ // CHECK-NEXT: // REMOVE
151
163
TestClass c1 = P.first ;
152
164
TestClass c2 = P.second ; // REMOVE
153
165
// CHECK-FIXES: // REMOVE
@@ -156,6 +168,7 @@ void forRangeWarnCases() {
156
168
for (const auto P : ClassPairs) {
157
169
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
158
170
// CHECK-FIXES: for (const auto [c1, c2] : ClassPairs) {
171
+ // CHECK-NEXT: // REMOVE
159
172
const TestClass c1 = P.first ;
160
173
const TestClass c2 = P.second ; // REMOVE
161
174
// CHECK-FIXES: // REMOVE
@@ -198,6 +211,7 @@ void forRangeNotWarnCases() {
198
211
}
199
212
200
213
void stdTieWarnCases () {
214
+ // CHECK-NEXT: // REMOVE
201
215
int a = 0 ;
202
216
int b = 0 ; // REMOVE
203
217
// CHECK-FIXES: // REMOVE
@@ -211,13 +225,15 @@ void stdTieWarnCases() {
211
225
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
212
226
// CHECK-FIXES: auto [x, y] = getPair<int, int>();
213
227
228
+ // CHECK-NEXT: // REMOVE
214
229
int * pa = nullptr ;
215
230
int * pb = nullptr ; // REMOVE
216
231
// CHECK-FIXES: // REMOVE
217
232
std::tie (pa, pb) = getPair<int *, int *>();
218
233
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
219
234
// CHECK-FIXES: auto [pa, pb] = getPair<int*, int*>();
220
235
236
+ // CHECK-NEXT: // REMOVE
221
237
TestClass c1 (1 , 2 );
222
238
TestClass c2 = TestClass {3 , 4 }; // REMOVE
223
239
// CHECK-FIXES: // REMOVE
@@ -327,6 +343,7 @@ void captureByVal() {
327
343
auto P = getPair<int , int >();
328
344
// CHECK-MESSAGES-CPP20ORLATER: :[[@LINE-1]]:3: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
329
345
// CHECK-FIXES-CPP20ORLATER: auto [x, y] = getPair<int, int>();
346
+ // CHECK-NEXT-CPP20ORLATER: // REMOVE
330
347
int x = P.first ;
331
348
int y = P.second ; // REMOVE
332
349
// CHECK-FIXES-CPP20ORLATER: // REMOVE
@@ -340,6 +357,7 @@ void captureByRef() {
340
357
auto P = getPair<int , int >();
341
358
// CHECK-MESSAGES-CPP20ORLATER: :[[@LINE-1]]:3: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
342
359
// CHECK-FIXES-CPP20ORLATER: auto [x, y] = getPair<int, int>();
360
+ // CHECK-NEXT-CPP20ORLATER: // REMOVE
343
361
int x = P.first ;
344
362
int y = P.second ; // REMOVE
345
363
// CHECK-FIXES-CPP20ORLATER: // REMOVE
@@ -353,6 +371,7 @@ void captureByAllRef() {
353
371
auto P = getPair<int , int >();
354
372
// CHECK-MESSAGES-CPP20ORLATER: :[[@LINE-1]]:3: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
355
373
// CHECK-FIXES-CPP20ORLATER: auto [x, y] = getPair<int, int>();
374
+ // CHECK-NEXT-CPP20ORLATER: // REMOVE
356
375
int x = P.first ;
357
376
int y = P.second ; // REMOVE
358
377
// CHECK-FIXES-CPP20ORLATER: // REMOVE
@@ -366,6 +385,7 @@ void deepLambda() {
366
385
auto P = getPair<int , int >();
367
386
// CHECK-MESSAGES-CPP20ORLATER: :[[@LINE-1]]:3: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
368
387
// CHECK-FIXES-CPP20ORLATER: auto [x, y] = getPair<int, int>();
388
+ // CHECK-NEXT-CPP20ORLATER: // REMOVE
369
389
int x = P.first ;
370
390
int y = P.second ; // REMOVE
371
391
// CHECK-FIXES-CPP20ORLATER: // REMOVE
@@ -382,6 +402,7 @@ void forRangeNotWarn() {
382
402
for (auto P : Pairs) {
383
403
// CHECK-MESSAGES-CPP20ORLATER: :[[@LINE-1]]:8: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
384
404
// CHECK-FIXES-CPP20ORLATER: for (auto [x, y] : Pairs) {
405
+ // CHECK-NEXT-CPP20ORLATER: // REMOVE
385
406
int x = P.first ;
386
407
int y = P.second ; // REMOVE
387
408
// CHECK-FIXES-CPP20ORLATER: // REMOVE
@@ -393,6 +414,7 @@ void forRangeNotWarn() {
393
414
}
394
415
395
416
void stdTieNotWarn () {
417
+ // CHECK-NEXT-CPP20ORLATER: // REMOVE
396
418
int x = 0 ;
397
419
int y = 0 ; // REMOVE
398
420
// CHECK-FIXES-CPP20ORLATER: // REMOVE
@@ -415,14 +437,17 @@ void OtherPairTest() {
415
437
auto P = otherPair ();
416
438
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
417
439
// CHECK-FIXES: auto [x, y] = otherPair();
440
+ // CHECK-NEXT: // REMOVE
418
441
int x = P.first ;
419
- int y = P.second ;
442
+ int y = P.second ; // REMOVE
443
+ // CHECK-FIXES: // REMOVE
420
444
}
421
445
422
446
{
423
447
const auto P = otherPair ();
424
448
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
425
449
// CHECK-FIXES: const auto [x, y] = otherPair();
450
+ // CHECK-NEXT: // REMOVE
426
451
const int x = P.first ;
427
452
const auto y = P.second ; // REMOVE
428
453
// CHECK-FIXES: // REMOVE
@@ -433,6 +458,7 @@ void OtherPairTest() {
433
458
auto & P = otherP;
434
459
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
435
460
// CHECK-FIXES: auto& [x, y] = otherP;
461
+ // CHECK-NEXT: // REMOVE
436
462
int & x = P.first ;
437
463
auto & y = P.second ; // REMOVE
438
464
// CHECK-FIXES: // REMOVE
@@ -443,6 +469,7 @@ void OtherPairTest() {
443
469
const auto & P = otherP;
444
470
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
445
471
// CHECK-FIXES: const auto& [x, y] = otherP;
472
+ // CHECK-NEXT: // REMOVE
446
473
const int & x = P.first ;
447
474
const auto & y = P.second ; // REMOVE
448
475
// CHECK-FIXES: // REMOVE
@@ -516,6 +543,7 @@ void ConstFieldPairTests() {
516
543
const ConstFieldPair P = getCertainPair<ConstFieldPair>();
517
544
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
518
545
// CHECK-FIXES: const auto [x, y] = getCertainPair<ConstFieldPair>();
546
+ // CHECK-NEXT: // REMOVE
519
547
const int x = P.first ;
520
548
const int y = P.second ; // REMOVE
521
549
// CHECK-FIXES: // REMOVE
@@ -525,6 +553,7 @@ void ConstFieldPairTests() {
525
553
const ConstFieldPair& P = getCertainPair<ConstFieldPair>();
526
554
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
527
555
// CHECK-FIXES: const auto& [x, y] = getCertainPair<ConstFieldPair>();
556
+ // CHECK-NEXT: // REMOVE
528
557
const int & x = P.first ;
529
558
const int & y = P.second ; // REMOVE
530
559
// CHECK-FIXES: // REMOVE
@@ -547,6 +576,7 @@ void PointerFieldPairTests() {
547
576
PointerFieldPair P = getCertainPair<PointerFieldPair>();
548
577
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
549
578
// CHECK-FIXES: auto [x, y] = getCertainPair<PointerFieldPair>();
579
+ // CHECK-NEXT: // REMOVE
550
580
int * x = P.first ;
551
581
int y = P.second ; // REMOVE
552
582
// CHECK-FIXES: // REMOVE
@@ -570,6 +600,7 @@ void ConstRefFieldPairTests() {
570
600
ConstRefFieldPair P = getCertainPair<ConstRefFieldPair>();
571
601
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
572
602
// CHECK-FIXES: auto [x, y] = getCertainPair<ConstRefFieldPair>();
603
+ // CHECK-NEXT: // REMOVE
573
604
const int & x = P.first ;
574
605
int y = P.second ; // REMOVE
575
606
// CHECK-FIXES: // REMOVE
0 commit comments