[clang] [clang-tools-extra] [clang-tidy] Handle C++ structured bindings in `performance-for-range-copy` (PR #77105)
Clement Courbet via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 8 08:29:49 PST 2024
================
@@ -234,6 +239,22 @@ void positiveOnlyAccessedFieldAsConst() {
}
}
+void positiveOnlyAccessedFieldAsConstBinding() {
+ for (auto [X, Y] : View<Iterator<Point>>()) {
+ // CHECK-MESSAGES: [[@LINE-1]]:13: warning: loop variable is copied but
+ // CHECK-FIXES: for (const auto& [X, Y] : View<Iterator<Point>>()) {
+ use(X);
+ use(Y);
+ }
+}
+
+void negativeOnlyAccessedFieldAsConstBinding() {
----------------
legrosbuffle wrote:
Done.
https://github.com/llvm/llvm-project/pull/77105
More information about the cfe-commits
mailing list