[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 16 03:53:07 PST 2023


DonatNagyE wrote:

> Hmm, it really worries me that `MallocChecker` is setting a return value outside of `evalCall()`. This can easily lead to conflicts if multiple checkers try to do this: `evalCall()` is protected from conflicts (the engine asserts that at most one checker evaluates each call) but `checkPostCall()` isn't.
> 
> To the best of my knowledge, the only legal way to use `State->BindExpr(...)` in a checker is to set the return value in `evalCall()`. Ideally we should have an assertion about this ("Environment is unchanged after checker callback invocation, unless the callback is a successful `evalCall()`").

I agree and there's already a FIXME which suggests moving this modeling step into an EvalCall callback. If you feel that this is an important improvement, I could create a separate commit that does it.

https://github.com/llvm/llvm-project/pull/72402


More information about the cfe-commits mailing list