[cfe-commits] r60900 - in /cfe/trunk: include/clang/Parse/Ownership.h

Sebastian Redl sebastian.redl at getdesigned.at
Sun Dec 14 02:14:57 PST 2008


steve naroff wrote:
>
> Since I haven't used auto_ptr's much, the benefits don't strike a 
> chord with me (though I value your opinion).
I think Howard's post was an excellent explanation of the benefits of 
type-encoded ownership.
>
> I'm curious...does compiler-supported ownership tracking actually fix 
> any existing clang bugs? (e.g. crashers, leaks, etc.). If not, I 
> assume this work is targeted at future-proofing the front-end as we 
> embark on more complex C++ features?
There are still 300 bytes worth of leaks in the Parser/statements.c 
testcase. I'm pretty sure they come from discarded Declarator structures.
Also, there's still a lot of places where, in the case of an error, 
existing Stmt and Expr nodes are dropped and leaked in the Sema. There 
used to be a lot such places in the Parser too, since manual deletion in 
the case of error was just too much hassle. Now, with the smart 
pointers, such places are reduced to where the nodes are hidden within 
larger structures (Declarator is the worst offender, I think). I haven't 
quantified the improvement, but it was pretty easy to prove from the 
code logic that some places simply leaked.
>
> Rather than worry too much about ownership, why don't we just use a 
> garbage collector (like GCC:-) JUST KIDDING:-)))
>
Even though it's a joke, I'd just like to point out that garbage 
collectors would have horrible problems with all the masked pointers we use.

Sebastian



More information about the cfe-commits mailing list