[cfe-commits] Handle ExprWithCleanups when creating goto scopes

Douglas Gregor dgregor at apple.com
Wed Sep 26 21:20:59 PDT 2012


On Sep 17, 2012, at 2:03 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:

>> The problem here, which I hadn't been thinking about before, is lifetime extension for temporaries. We actually have to dig into the initializer expression to find the, even when the variable type is a reference to a scalar type.
> 
> This patch uses a visitor to find the CXXConstructExpr, but it is not
> clear to me all the cases where we have to stop the AST traverse.

If you check out CGExpr.cpp's EmitExprForReferenceBinding(), it handles all of the cases where we can end up extending the lifetime of a temporary. I suggest following that, rather than trying to halt an arbitrary RecursiveASTVisitor.

	- Doug



More information about the cfe-commits mailing list