[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check
Jonas Toth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 11 01:56:08 PDT 2017
JonasToth added a comment.
There is an exception to the general rule (EXP36-C-EX2), stating that the result of `malloc` and friends is allowed to be casted to stricter alignments, since the pointer is known to be of correct alignment.
Could you add a testcase for this case, i think there would currenlty be a false positive.
And is there a general way of knowing when the pointer is of correct alignment, or is it necessary to keep a list of functions like `malloc` that are just known?
If yes, i think it would be nice if this list is configurable (maybe like in cppcoreguidelines-no-malloc, where that functionality could be refactored out).
Repository:
rL LLVM
https://reviews.llvm.org/D33826
More information about the cfe-commits
mailing list