[cfe-commits] r150112 - in /cfe/trunk: lib/StaticAnalyzer/Checkers/MallocChecker.cpp test/Analysis/malloc.c

Ted Kremenek kremenek at apple.com
Wed Feb 8 15:50:10 PST 2012


On Feb 8, 2012, at 3:40 PM, Ted Kremenek <kremenek at apple.com> wrote:

>> Ex: Should the checkers receive the post/pre visit callbacks on a CallExpr if it's being inlined?
> 
> Absolutely.  The pre- and post- visit checks are for checking preconditions and postconditions, which is orthogonal to how the actual function call gets evaluated.
> 
> This is probably worth some design discussion.

Put another way, what you have here is essentially a typestate checker.  Suppose we had a typestate checker for analyzing lock() is paired with unlock().  We want that checker to work irrespective of how lock() and unlock() are implemented, and how much of that implementation is exposed to the user.  If we know the user thinks in terms of lock() and unlock(), then the checker needs to operate at that level as well.  We can use the post-condition checking to validate the implementation of these functions (if it is available).

What we may wish to do is add another Checker callback, that indicates the "conservative" summary was used for a function, and allow checkers to decide what is the effects they want to apply to the ProgramState.  This could be independent of postVisit().  This would allow a clean way for checkers to drop checker state without muddling their post-condition checking.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120208/b2d2c0c3/attachment.html>


More information about the cfe-commits mailing list