[PATCH] D52892: [Clang-tidy] readability check to convert numerical constants to std::numeric_limits

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 4 10:29:08 PDT 2018


Eugene.Zelenko added a comment.

I think modernize is better module for this check.



================
Comment at: clang-tidy/readability/NumericalCostantsToMaxIntCheck.cpp:58
+    bool &IL, SourceLocation *IS)
+    : IL(&IL), AtLeastOneInclude(false), IS(IS){};
+
----------------
Semicolon at end is not necessary. Please also run Clang-format.


================
Comment at: clang-tidy/readability/NumericalCostantsToMaxIntCheck.cpp:87
+    const MatchFinder::MatchResult &Result) {
+
+  const auto *Decl = Result.Nodes.getNodeAs<VarDecl>("VarDecl");
----------------
Unnecessary empty line.


================
Comment at: docs/ReleaseNotes.rst:60
 
+- New :doc:`readability-numerical-costants-to-max-int
+  <clang-tidy/checks/readability-numerical-costants-to-max-int>` check.
----------------
Please use alphabetical order for new checks.


================
Comment at: docs/ReleaseNotes.rst:63
+
+  Checks for numerical unsigned constants that are equal to -1 or ~0
+  and substitutes them with std::numeric_limits<type>::max().
----------------
Please enclose -1 and ~0 in `.


================
Comment at: docs/ReleaseNotes.rst:64
+  Checks for numerical unsigned constants that are equal to -1 or ~0
+  and substitutes them with std::numeric_limits<type>::max().
+
----------------
Please enclose std::numeric_limits<type>::max() in ``.


================
Comment at: docs/clang-tidy/checks/readability-numerical-costants-to-max-int.rst:7
+
+This check looks for numerical unsigned constants that are equal to -1 or ~0
+and substitutes them with std::numeric_limits<type>::max().
----------------
Please synchronize with Release Notes.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52892





More information about the cfe-commits mailing list