[clang] [analyzer] Avoid use of `CallEvent`s with obsolete state (PR #160707)

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 8 07:58:50 PDT 2025


=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>,
=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>,
=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/160707 at github.com>


haoNoQ wrote:

Actually maybe just keep the strict bare minimum of information in the call event? Like a `SmallVector<SVal, ...>` of args, a potential return value as `Optional<SVal>`, the runtime definition that's been already computed elsewhere as a `Decl *`, and more subclass-specific stuff in the subclasses.

If you don't want the data to go out of sync, just normalize your database. Our codebase has plenty of room for magical one-of-a-kind solutions but this one is arguably mundane.

The `CallEvent` object will be a tiny bit slower to build but we also won't be cloning and rebuilding it nearly as often. It can also be made mutable, so eg. when the return value is computed we simply call a setter to put it there, no need to rebuild everything else.

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


More information about the cfe-commits mailing list