[cfe-commits] [PATCH] [CFG] Put implicit destructors in separate block after ReturnStmt

Ted Kremenek kremenek at apple.com
Tue Jan 31 11:20:31 PST 2012


Hi Erik,

I know that we have been discussing changing the CFG around its handling of ReturnStmts, but it isn't clear to me what this accomplishes.  We aren't looking to enforce that ReturnStmt is the last *statement* in a CFGBlock.  The ReturnStmt in a CFGBlock currently represents binding the return value, not a control-flow transfer.  If we want to model the ReturnStmt as a control-flow transfer (which is subject to debate), we should consider also making it a terminator (which is preceded by all the cleanup destructors).  I'm also not certain what you mean by "this results in blocks ending in with a terminator statement."

I don't want to put the brakes on this, but if the goal is to fix how destructors are represented in the CFG, I'd rather we *first* do the upfront infrastructure work discussed in PR 11645, and then re-evaluate, as a whole, how destructors are currently represented in the CFG.  This all feels a bit piecemeal, which would be fine if we were fixing specific issues, but the general sense I have right now is that how destructors are currently represented in the CFG is possibly very different from where we need to go once the infrastructure work in PR 11645 is done.  It's also not clear to me what invariants this patch is trying to establish or change.

Cheers,
Ted

On Jan 31, 2012, at 6:11 AM, Erik Verbruggen wrote:

> Attached is a patch which, when adding a return statement to the CFG, adds implicit destructors in a separate block after the block with the return statement. This results in blocks ending in with a terminator statement.
> 
> -- Erik.
> <0001-CFG-When-adding-a-return-statement-to-the-CFG-add-im.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list