Created new module bugprone and placed the check in that.
Finds memset() calls with potential mistakes in their arguments.
Replaces and extends the existing google-runtime-memset-zero-length check. Cases covered:
- Fill value is a character '0'. Integer 0 might have been intended.
- Fill value is out of char range and gets truncated.
- Byte count is zero. Potentially swapped with the fill value argument.
Hits on LLVM codebase:
I think this might not be the best approach.
For example, if the constructor is compiler generated, but there is a member of the class with non-trivial constructor, we still want to warn.
E.g.:
Maybe we should check instead whether the class is a POD? Other alternative might be something like
CXXRecordDecl::hasNonTrivialDefaultConstructor.