[clang] [analyzer] Implement binary operations on LazyCompoundVals (PR #106982)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 4 05:09:27 PDT 2024
https://github.com/NagyDonat requested changes to this pull request.
Unfortunately I found several fundamental issues within the implementation of `extractActualValueFrom()` -- see inline comments for details.
Moreover I'm not convinced that this "replace `LazyCompoundVal`s with actual values" logic is the right approach for your goals.
When we discussed this yesterday, you told me that this logic was intended to handle the situations where a `LazyCompoundVal` represents a non-aggregate type (like an integer) -- but I think that we should catch that kind of non-canonical representation at an earlier point (e.g. within some `getSVal` method). Hiding an integer behind this kind of lazy wrapper is a serious defect of our store model which inhibits many operations -- not just `evalBinOp`.
On the other hand, this "replace `LazyCompoundVal`s with a better representation" approach could be a good idea in the cases when the `LazyCompoundVal` represents an aggregate. However in this case I don't think that you can get a non-lazy representation by simply selecting the right binding (either via `iterBinding`s or via a direct `getBinding` call) -- you will need to find or write an explicit "convert this `LazyCompoundVal` into a non-lazy `CompoundVal`" function.
https://github.com/llvm/llvm-project/pull/106982
More information about the cfe-commits
mailing list