[cfe-commits] [patch] Add support for weakref

Douglas Gregor dgregor at apple.com
Mon Feb 22 10:47:29 PST 2010


On Feb 20, 2010, at 9:01 PM, Rafael Espindola wrote:

>> I don't understand enough about weakref to evaluate the semantics of
>> this, but from the docs it seems to not be just equivalent to weak +
>> alias?
> 
> At the C/C++ level? It is not, they have different warnings and are
> supported in different cases. I update the patch with comments and
> tests to try to show where exactly it is supported.
> 
> At the llvm level it gets represented as "alias weak", that is why I
> implemented it with WeakAttr + AliasAttr. I can add a WeakRefAttr and
> codegen it as "weak" if you want.


I would rather have WeakRefAttr in the AST, so we model the source more closely. Codegen can just handle it the same way as "weak" or "alias weak", depending on whether the "alias" attribute is also present. 

Otherwise, this looks fine to me, but I admit that I don't have a solid understanding of weakref.

	- Doug



More information about the cfe-commits mailing list