[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

Julia Hansbrough via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 29 23:16:21 PDT 2025


================
@@ -167,6 +167,12 @@ New checks
   Detects default initialization (to 0) of variables with ``enum`` type where
   the enum has no enumerator with value of 0.
 
+- New :doc:`bugprone-loop-variable-copied-then-modified
+  <clang-tidy/checks/bugprone/loop-variable-copied-then-modified>` check.
+
+  Detects when a loop variable is copied and then subsequently (possibly) modified
+  and suggests replacing with a reference or an explicit copy.
+
 - New :doc:`bugprone-derived-method-shadowing-base-method
----------------
flowerhack wrote:

alphabetized the checks~

https://github.com/llvm/llvm-project/pull/157213


More information about the cfe-commits mailing list