[PATCH] D41406: [analyzer] Add a new checker callback, check::NewAllocator.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 13:57:51 PST 2018


NoQ added a comment.

> which would re-evaluate the cast and return the casted object

Rather not. Because i'm changing my mind again about avoiding the redundant cast in `&element{T, HeapSymRegion{conj<T *>}}` - this time by not calling `evalCast` after a conservatively evaluated operator new call (this would ensure that no existing behavior breaks in the conservative case without changing how all casts everywhere work), and this wouldn't be compatible with this `CallEvent`-based approach because in the `CallEvent` we have no way of figuring out if the call was inlined or evaluated conservatively. We could still move the cast logic before the `PostCall` callback, and then retrieve the casted value from the program state (wherever it is).  But this is an example of stuff that becomes harder when we merge the callbacks together, and it took me a few hours to stumble upon that, so who knows what other problems would we encounter, so i feel that future-proof-ness is worth it.


https://reviews.llvm.org/D41406





More information about the cfe-commits mailing list