[cfe-dev] Ownership of Stmts and Exprs, and destroying them

Chris Lattner clattner at apple.com
Tue Nov 25 10:47:45 PST 2008


On Nov 24, 2008, at 7:36 PM, Doug Gregor wrote:
>>> Similarly for ExprResult and
>>> friends. That way, the type system enforces our ownership model
>>> (transfer into Sema for the parameters of ActOn*, transfer out of  
>>> Sema
>>> on return), and we're safe from early exits.
>>
>> ExprResult is just a pair of success + pointer.  The actions in  
>> Sema are
>> only called in the success case.
>
> Of course. But ExprResult also (implicitly!) carries with it the
> ownership of the pointer, and that's not at all clear now.

Ok, I agree with you.  However, making the contract more clear seems  
conceptually separate from making sema or the parser not leak.  Are  
you saying that both problems could be solved in the same way?

-Chris



More information about the cfe-dev mailing list