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

Chris Lattner clattner at apple.com
Sun Apr 26 18:34:17 PDT 2009


On Apr 26, 2009, at 1:30 PM, Anders Carlsson wrote:
>> 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).
>>
>
> Would a comma expression really work? Isn't the type of a comma  
> expression the type of its second argument?

We could define a new expression that evaluates the the value of its  
LHS (unlike a comma) but is defined to evaluate the LHS before the RHS  
(like a comma).

That said, if you guys are all happy with a different approach, go for  
it :).  I thought that the destroyexpr thing was a simple way to model  
this, that's all.

-Chris



More information about the cfe-dev mailing list