File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,23 @@ void DecomposeByAssignWarnCases() {
77
77
const auto & y = P.second ; // REMOVE
78
78
// CHECK-FIXES-ALL: // REMOVE
79
79
}
80
+
81
+ {
82
+ auto P = getPair<int , int >(); // match
83
+ // CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
84
+ // CHECK-FIXES-ALL: auto [x, y] = getPair<int, int>(); // match
85
+ int x = P.first ;
86
+ int y = P.second ; // REMOVE
87
+ // CHECK-FIXES-ALL: // REMOVE
88
+
89
+ // maybe match with `hasParent` but NOT with `has(declStmt())`
90
+ auto another_p = getPair<int , int >();
91
+ // CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: use a structured binding to decompose a pair [modernize-use-structured-binding]
92
+ // CHECK-FIXES-ALL: auto [another_x, another_y] = getPair<int, int>();
93
+ int another_x = another_p.first ;
94
+ int another_y = another_p.second ; // REMOVE
95
+ // CHECK-FIXES-ALL: // REMOVE
96
+ }
80
97
}
81
98
82
99
void forRangeWarnCases () {
You can’t perform that action at this time.
0 commit comments