[PATCH] D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check

Fabian Thurnheer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 29 06:57:05 PDT 2021


DNS320 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/DeclareLoopVariableInTheInitializerCheck.cpp:28
+
+  diag(MatchedForStmt->getBeginLoc(),
+       "Prefer to declare a loop variable in the initializer part of a "
----------------
Eugene.Zelenko wrote:
> It'll be reasonable to add add note with actual variable declaration.
The hole check was refactored. A diagnostic hint points now to the statement which modifies the variable.



================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/DeclareLoopVariableInTheInitializerCheck.h:1
+//===--- DeclareLoopVariableInTheInitializerCheck.h - clang-tidy *- C++ -*-===//
+//
----------------
Eugene.Zelenko wrote:
> I may be mistaken, but proper code is `-*- C++ -*-`. Please remove  dash at left side.
Thanks. I checked other header files with long names. I correct it this way, to match the other ones:
```
//===--- DeclareLoopVariableInTheInitializerCheck.h - clang-tidy-*- C++ -*-===//
//===--- ProBoundsArrayToPointerDecayCheck.h - clang-tidy--------*- C++ -*-===//
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100092/new/

https://reviews.llvm.org/D100092



More information about the cfe-commits mailing list