[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 7 04:06:14 PDT 2021


steakhal abandoned this revision.
steakhal added a comment.

In D99658#2671747 <https://reviews.llvm.org/D99658#2671747>, @NoQ wrote:

> I mean, the extent of an `ElementRegion` //is// the size of a single element. The reason why our intrinsic isn't doing what you expect is because we represent the pointer with offset as `ElementRegion` regardless of whether operator `[]` was used. On the other hand, an `SVal` doesn't ever represent a region at all, it only points to its first byte, regardless of the structure of `MemRegion` inside it; for that reason `clang_analyzer_getExtent()` is impossible to implement correctly in our current model.
>
> So i think both behaviors are incorrect but if you think it makes it easier to write tests then absolutely go for it!

Oh, I got it. Hm, yes, both are wrong xD

TBH since the new dumpExtent debug functions 89d210fe1a7a1c6cbf926df0595b6f107bc491d5 <https://reviews.llvm.org/rG89d210fe1a7a1c6cbf926df0595b6f107bc491d5> landed, I no longer need this, thus I'm abandoning this change.
Thank you all for the review though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99658/new/

https://reviews.llvm.org/D99658



More information about the cfe-commits mailing list