[Static Analyzer] New checker hook: checkInitialState

Gabor Kozar via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 28 13:52:31 PST 2015


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151128/a94c8b44/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clangsa_checkinitial.patch
Type: text/x-patch
Size: 8198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151128/a94c8b44/attachment.bin>


More information about the cfe-commits mailing list