[cfe-dev] C++ Constructors & Destructors in the AST

Chris Lattner clattner at apple.com
Sun Apr 26 12:42:46 PDT 2009


On Apr 26, 2009, at 12:37 PM, Anders Carlsson wrote:

>
> (CXXExprWithCleanup
>  (CXXTemporaryObjectExpr("temp", "T::T")
>  ("temp"))
>
> In the first design that we came up with, we would have explicit  
> CXXDestroyExprs that would be inserted after statements, but that  
> won't work with things like the for loop condition expr. I plan to  
> remove the CXXDestroyExpr node.
>
> Does this sound OK? Maybe we should rename CXXExprWithCleanup to  
> CXXExprWithTemporaries? I'll add some documentation shortly.

Hi Anders,

I thought the idea was to make CXXDestroyExpr be an expression, and  
use a comma expression (or its moral equivalent) where needed.  This  
allows temporaries to occur anywhere an expressions does (including  
the initializer for a global, etc).

-Chris



More information about the cfe-dev mailing list