[PATCH] D49114: [clang-tidy] Add a check for "magic numbers"
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 10 14:06:38 PDT 2018
Eugene.Zelenko added a comment.
It's highly likely that this part of coding guidelines.
================
Comment at: clang-tidy/readability/MagicNumbersCheck.cpp:42
+
+ const auto &Parents = Result.Context->getParents(*MatchedDecl);
+ for (const auto &Parent : Parents) {
----------------
Please don't use auto where type is not easily deducible. Same in other places.
================
Comment at: docs/ReleaseNotes.rst:60
+- New `readability-magic-numbers
+ <http://clang.llvm.org/extra/clang-tidy/checks/readability-magic-numbers.html>`_ check
----------------
Please move into new checks list in alphabetical order.
================
Comment at: docs/ReleaseNotes.rst:63
+
+ Detect usage of magic numbers, numbers that are used as literals instead of
+ introduced via constants or symbols.
----------------
Please use //Detects//.
================
Comment at: docs/clang-tidy/checks/readability-magic-numbers.rst:11
+
+ double circleArea = 3.1415926535 * radius * radius;
+
----------------
JonasToth wrote:
> This example is good, but right now the code only checks for integer literals. Maybe an integer example would be better?
Please use .. code-block:: c++. Same for good example.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D49114
More information about the cfe-commits
mailing list