steakhal added a comment.

In D150446#4345723 <https://reviews.llvm.org/D150446#4345723>, @donat.nagy 
wrote:

> By the way, I'm fed up with the hack that ElementRegion is used for three 
> separate things ("real" array indexing, casts and pointer arithmetic). To fix 
> this I'm thinking about introducing a subclass hierarchy where a base class 
> `ElementLikeRegion` has three subclasses:
>
> - `ElementRegion` represents the smaller memory area of one element in an 
> array,
> - `CastRegion` represents the same memory area, but with a different type, and
> - `OffsetRegion` represents the same memory area, but with a different 
> starting point.
>
> Most old references to ElementRegion could be replaced by references to 
> ElementLikeRegion, but functions like `stripCasts()` would be able to 
> distinguish between the subclasses and do the intuitive thing.
>
> What do you think about this idea? Do you see any problem with it?

Ah, yes. I agree that this is a real issue. However, it's going to be 
non-trivial to lift all uses. ATM I cannot see immediate blockers.
I can only encourage you to explore this direction and report back in an RFC on 
discourse <https://discourse.llvm.org/c/clang/static-analyzer/49>.
That change should be an NFC change, and only afterward apply semantic 
improvements - that are likely uncovered by this proposal.

> (By the way I'm not satisfied with these quickly picked class names -- feel 
> free to suggest better ones!)

Yes, there are probably better alternatives. Let's push this aside for now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150446

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to