[PATCH] D49114: [clang-tidy] Add a check for "magic numbers"

Florin Iucha via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 17 16:27:43 PDT 2018


0x8000-0000 marked 4 inline comments as done.
0x8000-0000 added a comment.

@Eugene.Zelenko  thank you for suggesting the alias - I didn't know it is that easy, but a grep on "alias" led me to the right place.



================
Comment at: clang-tidy/readability/MagicNumbersCheck.h:55
+  const std::vector<std::string> IngnoredValuesInput;
+  std::vector<int64_t> IngnoredValues;
+};
----------------
JonasToth wrote:
> Maybe these vectors could be `llvm::SmallVector` that has a better performance.
The IgnoredValuesInput is parsed via utils::options::parseStringList which returns a std::vector<std::string>. I am using that instance directly - copying it into a llvm::SmallVector would be more expensive.


================
Comment at: test/clang-tidy/readability-magic-numbers.cpp:124
+
+  explicit Point(T xval, T yval) noexcept : x{xval}, y{yval} {
+  }
----------------
Eugene.Zelenko wrote:
> Please run Clang-format over test case.
I do run it constantly. In this case there is no change. I am using the clang-6.0 formatter though.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49114





More information about the cfe-commits mailing list