[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 17 10:19:00 PDT 2018
Eugene.Zelenko added a comment.
Adding C++ Core Guidelines alias is definitely low-hanging fruit which could be implemented within this patch.
================
Comment at: clang-tidy/readability/MagicNumbersCheck.cpp:14
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+#include <algorithm>
----------------
Please remove empty line.
================
Comment at: clang-tidy/readability/MagicNumbersCheck.cpp:30
+ IngnoredValues.reserve(IngnoredValuesInput.size());
+ for (const std::string &IgnoredValue : IngnoredValuesInput) {
+ IngnoredValues.push_back(std::stoll(IgnoredValue));
----------------
auto could be used here because it's range loop over container.
================
Comment at: clang-tidy/readability/MagicNumbersCheck.h:14
+#include "../ClangTidy.h"
+
+#include <unordered_set>
----------------
Please remove empty line and also include <vector>.
================
Comment at: test/clang-tidy/readability-magic-numbers.cpp:124
+
+ explicit Point(T xval, T yval) noexcept : x{xval}, y{yval} {
+ }
----------------
Please run Clang-format over test case.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D49114
More information about the cfe-commits
mailing list