[PATCH] [clang-tidy] Add a checker for zero-length memset.

Benjamin Kramer benny.kra at gmail.com
Wed Jul 16 06:29:47 PDT 2014


Hi alexfh, djasper,

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.

http://reviews.llvm.org/D4535

Files:
  clang-tidy/google/CMakeLists.txt
  clang-tidy/google/GoogleTidyModule.cpp
  clang-tidy/google/MemsetZeroLengthCheck.cpp
  clang-tidy/google/MemsetZeroLengthCheck.h
  test/clang-tidy/google-memset-zero-length.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4535.11502.patch
Type: text/x-patch
Size: 7649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140716/55f3fb5a/attachment.bin>


More information about the cfe-commits mailing list