[cfe-commits] [Review] Partial fix for PR 11645: put destructor calls before a return statement.

Ted Kremenek kremenek at apple.com
Mon Jan 16 21:29:37 PST 2012


Hi Erik,

Thanks for working on this.  I've commented in the PR.

My concern is that I am having second thoughts about whether or not this is the right direction.  If there are temporaries in the return expression, should those destructors appear before the 'return' statement (but after the subexpression of 'return' gets evaluated)?  I can see it both ways.

For example:

  return A();

where 'A' converts to whatever the return value type should be, and ~A() is non-trivial.  Technically, ~A() evaluates after the enclosing statement.  We're giving 'return' special treatment in your patch.

One clean representation of this is to put all the destructors after the 'return' in the CFGBlock.  The other way is to have the destructors appear after the subexpression of 'return', but before the 'return' itself.  The former requires clients of the CFG to rethink where they expect 'return' to be in a CFGBlock.

What do you think?

Ted 


On Thursday, January 12, 2012 at 6:30 AM, Erik Verbruggen wrote:

> Hello,
> 
> Attached is a patch for one of the things mentioned in PR 11645, which 
> is that in the CFG the destructor calls end up after the return statement.
> 
> -- Erik. 
> 
> 
> Attachments: 
> - 0001-CFG-Partial-fix-for-PR-11645-put-destructor-calls-be.patch
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120116/618b0353/attachment.html>


More information about the cfe-commits mailing list