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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 6 10:07:32 PDT 2021


NoQ accepted this revision.
NoQ added a comment.

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!


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