[PATCH] D90157: [analyzer] Rework SValBuilder::evalCast function into maintainable and clear way

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 27 06:15:22 PDT 2020


steakhal added a comment.

In D90157#2356170 <https://reviews.llvm.org/D90157#2356170>, @martong wrote:

>> Now I'm going to make unittests for SValBuilder::evalCast. Let me ask you to offer me some examples of casts to check. As many cases we can collect as robust the test would be. E.g.
>
> This is not going to be easy. I guess we should cover both implicit and explicit type conversions. C++ is ridiculously complex in these domains. For maximal precision I'd suggest to systematically go through the below pages and try to cover each major case:
> https://en.cppreference.com/w/cpp/language/explicit_cast
> https://en.cppreference.com/w/cpp/language/implicit_conversion

@martong  Keep in mind that we try hard not to emit casts - even if that would require. Check D85528 <https://reviews.llvm.org/D85528>, exactly touching this topic.

---

By the same token, I think you should run the test-suite using the Z3 refutation and/or Z3 constraint solver to check if this introduces any regression.
You can do that by installing Z3, adding the cmake options: `-DLLVM_ENABLE_Z3_SOLVER=ON`, `-DLLVM_Z3_INSTALL_DIR=/path/to/z3`
After this, you should be able to run the lit-test:
`./bin/llvm-lit -sv --show-unsupported --show-xfail /home/elnbbea/git/llvm-project/clang/test/Analysis --param USE_Z3_SOLVER=1`
Run it before and after your fix and you should expect no //new// failures/crashes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90157



More information about the cfe-commits mailing list