================
@@ -0,0 +1,622 @@
+// RUN: %check_clang_tidy -check-suffix=ALL,CPP20ORLATER -std=c++20-or-later
%s modernize-use-structured-binding %t -- -- -I
%S/Inputs/use-structured-binding/
+// RUN: %check_clang_tidy -check-suffix=ALL -std=c++17 %s
modernize-use-structured-binding %t -- -- -I %S/Inputs/use-structured-binding/
+#include "fake_std_pair_tuple.h"
+
+template<typename T>
+void MarkUsed(T x);
+
+struct TestClass {
+ int a;
+ int b;
+ TestClass() : a(0), b(0) {}
+ TestClass& operator++();
+ TestClass(int x, int y) : a(x), b(y) {}
+};
+
+void DecomposeByAssignWarnCases() {
+ {
+ auto P = getPair<int, int>();
+ // CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: use a structured binding
to decompose a pair [modernize-use-structured-binding]
+ // CHECK-FIXES-ALL: auto [x, y] = getPair<int, int>();
+ int x = P.first;
+ int y = P.second; // REMOVE
----------------
flovent wrote:
Added in
[8d3054c](https://github.com/llvm/llvm-project/pull/158462/commits/8d3054c482a758adccb73487b3dd43806294b2a8)
Because of refatoring job of `matchTwoVarDecl`, right now we remove continuous
`DeclStmt`s, so i only check for `// REMOVE` in next line here.
https://github.com/llvm/llvm-project/pull/158462
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits