[PATCH] D40939: [analyzer] Avoid element regions of void type.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 7 08:15:24 PST 2017


NoQ added a comment.

I think the new behavior is correct in the sense that in our region hierarchy byte offsets (such as arithmetic on void pointers) are normally represented as `char`-type element regions. For instance, we have a similar mechanism is implemented in pointer casts case, when the byte offset of the pointer is not divisible by the casted object size: we just add a character element region to account for the remainder of the offset.

Like, it's not the situation when we couldn't figure out the type - it would have been null in that case. Here we know exactly that the type is void. And when you add N to a void pointer, it changes by N bytes, which is what we should, in my opinion, try to represent somehow. So i believe that the newly constructed `SVal`s are correctly representing their respective expressions or arithmetic results, and i'm not immediately seeing a better behavior.


Repository:
  rC Clang

https://reviews.llvm.org/D40939





More information about the cfe-commits mailing list