[clang-tidy] Add a checker for zero-length memset.
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 16 Jul 2014 14:30:19 +0000 (14:30 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 16 Jul 2014 14:30:19 +0000 (14:30 +0000)
commitebab1500e0a0bb6df3510e6d9e3d45f7295704ab
tree1846c4efc83f58ae8aca0d194f781cc2cc780b60
parent2252cbf4e89d76b1c39da89b01d67b3e2b73154b
[clang-tidy] Add a checker for zero-length memset.

If there's memset(x, y, 0) in the code it's most likely a mistake. The
checker suggests a fix-it to swap 'y' and '0'.

I think this has the potential to be promoted into a general clang warning
after some testing in clang-tidy.

Differential Revision: http://reviews.llvm.org/D4535

llvm-svn: 213155
clang-tools-extra/clang-tidy/google/CMakeLists.txt
clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
clang-tools-extra/clang-tidy/google/MemsetZeroLengthCheck.cpp [new file with mode: 0644]
clang-tools-extra/clang-tidy/google/MemsetZeroLengthCheck.h [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/google-memset-zero-length.cpp [new file with mode: 0644]