[PATCH] D48866: [clang-tidy] Add incorrect-pointer-cast checker
Gábor Horváth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 3 00:24:06 PDT 2018
hgabii created this revision.
Herald added subscribers: cfe-commits, mgorny.
This checker warns for cases when pointer is cast and the pointed to type is incompatible with allocated memory area type.
This may lead to access memory based on invalid memory layout.
Warn for cases when the pointed to type is wider than the allocated type.
For example char vs integer, long vs char etc.
Also warn for cases when the pointed to type layout is different from the allocated type layout, like different structs, integer vs float/double, different signedness.
Allows pointer casts if the pointed to struct type is "part" of the allocated type.
Which means the allocated type contains the pointed to type member by member.
rCTE Clang Tools Extra
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 13218 bytes
Desc: not available
More information about the cfe-commits