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

Florin Iucha via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 19 22:33:15 PDT 2018


0x8000-0000 added a comment.

  ./tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -clang-tidy-binary ../llvm.rel/bin/clang-tidy -checks="-*,readability-magic-numbers" -j 12 -p ../llvm.rel -j 12 -quiet > /tmp/llvm.magic
  grep "warning:" /tmp/llvm.magic | cut -d: -f5 | cut -d" " -f2 | sort | uniq -c | sort -rn | head -40

With about 2000 files scanned, these are the popularity rankings:

  9559 2
  5041 4
  4359 8
  2811 3
  2555 16
  1748 32
  1213 64
  1170 10
  1155 128
   910 5
   853 6
   606 7
   537 256
   385 12
   382 15
   349 20
   322 1024
   288 255
   252 100
   238 9
   233 11
   181 40
   174 63
   170 24
   163 31
   161 512
   146 65535
   144 13
   136 14
   126 18
   120 1
   113 17
   103 1000
   100 4096
    92 60
    85 192
    84 30
    81 21
    76 25
    71 23

So it seems power of 2 are popular, as are 10, 100, 1000.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49114





More information about the cfe-commits mailing list