[Static Analyzer] New checker hook: checkInitialState

Gabor Kozar via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 29 04:55:54 PST 2015


+Jordan, Anna

---
Best regards,

Gábor 'ShdNx' Kozár http://gaborkozar.me



On Sat, Nov 28, 2015, at 22:52, Gabor Kozar via cfe-commits wrote:
> Hi,
>
> Once, long ago, I started working on this checker callback, but forgot
> about it. I have decided to finish it now. Original discussion:
> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20131216/095565.html
>
> The motivation was (pipermail doesn't seem to have my original mail,
> for some reason):
>
>> I had an issue recently with the Static Analyzer [while implementing
>> a checker] that I wouldn't be able
 to detect when a function was entered - either through a call or
 serving as the entry point of the analysis. (I ended up using
 checkPreStmt and figuring out if we've been magically transported
 inside a function body and check the program state whether the
 necessary info was already recorded by checkPreCall. Not something I'd
 call nice by any means.)
>
> The attached patch creates a new checker hook, with the signature:
>
>> ProgramStateRef checkInitialState(const EntryPointInfo& EPInfo) /*
>> non-const */;
>
> EntryPointInfo is currently a very simple class containing a Decl* of
> the declaration being used as an entry point and a ProgramStateRef of
> the initial state.
>
> Checkers implementing this hook can make changes to the program state
> by returning a new one. They are also allowed to return nullptr, in
> which case the analysis doesn't proceed further from that entry point.
>
> Please let me know what you think!
>
> ---
> Best regards,
>
> Gábor 'ShdNx' Kozár http://gaborkozar.me
>
>
> _________________________________________________
> cfe-commits mailing list cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits Email had 1
> attachment:


>  * clangsa_checkinitial.patch  11k (text/x-patch)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151129/4ef9ec91/attachment.html>


More information about the cfe-commits mailing list