[cfe-dev] Adding a CFG node for the allocation call in a new-expression

Anna Zaks ganna at apple.com
Thu Apr 5 11:28:26 PDT 2012

On Apr 4, 2012, at 10:06 AM, Jordan Rose wrote:

> Hi, Ted (and list). After the negative feedback on representing new-expression allocations using CXXOperatorCallExpr, I went back to the original idea of adding a CFG node. Without properly modelling constructors this doesn't gain us very much right now, but it does set the stage for eventually being able to get all of the behavior of a new-expression into the analyzer.
> Missing pieces:
> - What does it mean to be PreStmt<CXXNewExpr> if the allocation and the initializer have already happened? (Note that right neither PreStmt nor PostStmt checks are done on CXXNewExpr, but that's easily fixed.)

What are the issues with calling PreStmt<CXXNewExpr> before evaluation of any statements related to new (except that it's more difficult to implement)? That's what checker writers would expect from the callback.

> - How can we represent "calls" that don't have associated expressions? I'm starting to think CallOrObjCMessage needs to turn into a real "abstract call" model which may or may not have expressions for the arguments and can handle regular calls, messages, constructors, destructors, allocations, and deletions.  New checks: preCall and postCall. But that's a bit outside the scope of this patch.

Is this needed to allow callbacks on the allocation? Do we have to generalize here or could we just provide a separate callback for it (if someone needs it)?

> Anyway, how does this part look?
> Jordy
> <CFGAllocation.patch>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list