[PATCH] D71686: Fix false positive in magic number checker

Florin Iucha via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 20 20:16:59 PST 2019


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


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-magic-numbers-todo.cpp:9
+{
+  if (((int)4) > ProcessSomething(10))
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 4 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
----------------
This test fails even with clang-tidy-9.


```
$ clang-tidy-9 --checks="-*,readability-magic-numbers" clang-tools-extra/test/clang-tidy/checkers/readability-magic-numbers-todo.cpp

/home/florin/tools/llvm-project/clang-tools-extra/test/clang-tidy/checkers/readability-magic-numbers-todo.cpp:9:35: warning: 10 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
  if (((int)4) > ProcessSomething(10))
                                  ^
```

Nothing about the "4" here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71686/new/

https://reviews.llvm.org/D71686





More information about the cfe-commits mailing list