[cfe-commits] [PATCH] Sema and AST for C++0x Lambda Expressions

John Freeman jfreeman at cse.tamu.edu
Mon Aug 22 18:44:59 PDT 2011

Attached is an updated patch.

- There is a LambdaExpr AST node, and no LambdaDecl.

- Documentation may be sparse in some areas. Please let me know where it 
is insufficient.

- In the fix-its for explicit captures that conflict with the default, 
the suggestion is to remove the explicit capture, not the default. My 
expectation is that this more closely aligns with programmer intent.

- I have not yet implemented any traverse/visit/transform functions yet. 
I want to wait until the AST node is a little more settled before I 
start that. It seems that some of these functions will have duplicate 
functionality. Is that true, and is there any opportunity for reuse?

Doug wrote:
> The ParmVarDecls will be the same in both places. I suggest grabbing them from the Declarator, since that's easiest.

I do not believe it is easier to get ParmVarDecls from a Declarator than 
from a FunctionProtoTypeLoc. It seems like GetTypeForDeclarator does all 
the heavy lifting for me. Am I missing something?

Doug wrote:
> The way we typically address this chicken-and-egg problem is to actually build the ParmVarDecls for the constructor before building the constructor itself. The ParmVarDecls are given the translation unit as their DeclContext, and then later (after the constructor is built) we update their DeclContext to point to the constructor. This allows us to build the full type of the constructor before building the constructor itself.

I favored building the type after because it is a little easier. There 
do not seem to be any problems so far. Should I still build the type first?

Thank you,
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: lambda-sema.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110822/aeddff72/attachment.ksh>

More information about the cfe-commits mailing list