[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 6 01:17:06 PST 2018


Szelethus added inline comments.


================
Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:20
+
+static const char LoopName[] = "forLoopName";
+static const char loopVarName[] = "loopVar";
----------------
JonasToth wrote:
> JonasToth wrote:
> > ztamas wrote:
> > > JonasToth wrote:
> > > > Please move these variable in the matcher function and make them `StringRef` instead of `const char[]`.
> > > These variables are used not only inside the matcher function but also in the check() function.
> > > 
> > I didn't see that, but they should still be `StringRef` as type.
> One more nit i forgot: these variables should be `static` for linkage and be CamelCase to match the naming conventions.
Hmmm, `StringRef` actually has a `constexpr` constructor, we could make these `constexpr` too I guess.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974





More information about the cfe-commits mailing list