[clang] [analyzer] Assert isImplicitObjectMemberFunction in SValBuilder::getCXXThis (PR #220114)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 18 02:46:45 PDT 2026
https://github.com/NagyDonat commented:
I fear that this runtime assertion is too weak guarantee given that we (as far as I know) have very little test coverage for explicit object member functions (and they are also rare to nonexistent in current stable project).
If you want to really guarantee that `getCXXThis` doesn't return a nonsense `CXXThisRegion` for a method that doesn't have `this`, then I'd suggest changing the return type of this method to `std::optional<loc::MemRegionVal>` and returning `std::nullopt` when analyzing a method that has an explicit object. That way the type system would provide a static guarantee that is validated even without good test coverage.
https://github.com/llvm/llvm-project/pull/220114
More information about the cfe-commits
mailing list