NoQ added a comment.

Another thing to mention about `SVal::getType()` in its doxygen comment is that 
//most of the time you don't need it//. Similarly to how checking whether an 
`SVal` is a `Loc` or a `NonLoc` results in incorrect code 95% of the time 
(because such code is unable to discriminate between arbitrary lvalues and 
pointer rvalues which is typically crucial in order to get everything right but 
often forgotten / misunderstood), relying on the type of the `SVal` rather than 
its storage raises similar problems.

The use case in `RegionStore` that I mentioned in the beginning is the rare 
exception to this rule of thumb because there's no AST expressions to tell us 
the type of the storage and on top of that type punning makes the storage 
basically entirely untyped. There's really no other way to obtain such 
information. Bytes in memory really don't have a type; it's very much a matter 
of convenient abstraction for us to associate type with them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104550

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

Reply via email to