From bfbe71252acbc4ba2e7db62948fa42bf8f4273fb Mon Sep 17 00:00:00 2001 From: John Stiles Date: Thu, 30 Jul 2020 20:25:09 -0400 Subject: [PATCH] Enable ClangTidy check performance-for-range-copy. This will prevent us from writing range-based for loops that copy the loop variable when a const& would suffice. https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html ----- Finds C++11 for ranges where the loop variable is copied in each iteration but it would suffice to obtain it by const reference. The check is only applied to loop variables of types that are expensive to copy which means they are not trivially copyable or have a non-trivial copy constructor or destructor. Change-Id: Ic26bff7e9c48b4d1a9ad9c0606199920ea7a0af8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306945 Commit-Queue: John Stiles Reviewed-by: Mike Klein --- .clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index 7dd05d357e..9e1e026363 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1 +1 @@ -Checks: '-*,bugprone-use-after-move,bugprone-unused-raii,bugprone-undelegated-constructor,bugprone-argument-comment,google-build-namespaces' +Checks: '-*,bugprone-use-after-move,bugprone-unused-raii,bugprone-undelegated-constructor,bugprone-argument-comment,performance-for-range-copy,google-build-namespaces'