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

Douglas Gregor dgregor at apple.com
Mon May 18 10:45:49 PDT 2009


On May 16, 2009, at 12:47 PM, Anders Carlsson wrote:

>
> On May 3, 2009, at 10:07 AM, Sebastian Redl wrote:
>>
>> Without understanding your motive for wrapping a reference, I  
>> cannot say.
>> But the move security should be preserved if you wrap an object  
>> instead.
>
>
> <textmate stdin DgA6VZ.txt>
>
> Here's a patch that makes FullExprArg wrap an object instead.
>
> One idea I have is to make FullExprArg just be a smart pointer style  
> wrapper around FullExpr, so we don't have to duplicate the ExprArg  
> API.
>
> Comments, thoughts?

This is one ugly const_cast...

+    FullExprArg(const FullExprArg& Other)
+      : Expr(move(const_cast<FullExprArg&>(Other).Expr)) {}

but, since this will be so much nicer with rvalue references  
(eventually), I think we can cope with the ugliness for now, since the  
alternative is a lot of code duplicating. Please put in a FIXME noting  
that this is could/should be tightened up at some point.

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090518/c7276397/attachment.html>


More information about the cfe-dev mailing list