[cfe-dev] Reference counting

Jochen Wilhelmy j.wilhelmy at arcor.de
Fri Jan 22 07:08:39 PST 2010


> The major reason we don't use reference counting in clang the clang 
> AST (or llvm IR) is that it is a) expensive, and b) we have (or aim to 
> have) very simple ownership policies that make it unnecessary.  For 
> other heavier objects (e.g. ASTContext itself), it might make sense 
> though.
Yes, I also think it the reference counting should be used only for 
heavier objects, e.g. Module, Preprocessor,
Linker etc., of which you only have one or just a few.
If you use clang/llvm only as a blackbox library without looking into 
the internals (like AST)  then
refcounted objects would be cool.

-Jochen




More information about the cfe-dev mailing list