[PATCH] [clang-tidy] Add a checker for zero-length memset.
Alexander Kornienko
alexfh at google.com
Wed Jul 16 06:44:50 PDT 2014
Other standard functions may suffer from the same problem, e.g. memchr. I think, it makes sense to handle all of them in the same check.
================
Comment at: clang-tidy/google/MemsetZeroLengthCheck.cpp:28
@@ +27,3 @@
+ // Look for memset(x, y, 0) as those is most likely an argument swap. Ignore
+ // literals in the middle argument.
+ Finder->addMatcher(callExpr(callee(functionDecl(hasName("::memset"))),
----------------
> Ignore literals in the middle argument.
Why?
http://reviews.llvm.org/D4535
More information about the cfe-commits
mailing list