[cfe-commits] [PATCH] Sema and AST for C++0x Lambda Expressions
jfreeman at cse.tamu.edu
Sat Oct 15 20:21:14 PDT 2011
> + /// Declaration for the closure type.
> + CXXRecordDecl *ClosureType;
> This is just getType()->getAsCXXRecordDecl(), no?
To my knowledge, yes it is. I added the ClosureType member simply for
caching. I saw you removed it. The same could be done for the Function
member as well. Is the general policy to keep the AST classes as small
> + /// The temporary object resulting from evaluating the lambda expression,
> + /// represented by a call to the constructor of the closure type.
> + CXXConstructExpr *ClosureObject;
> This makes me think that LambdaExpr should just be a subclass of CXXConstructExpr, because there's a lot of behavior we get "for free" for lambdas if it derives from CXXConstructExpr (such as proper handling of the temporary). It would require some twisting-around of the logic for building lambda expressions (in particular, the LambdaExpr wouldn't be built until the whole body had been parsed), but I think the result would be better.
How should we store the bits and pieces up until the body has been
parsed? Should there be a separate data structure just to hold them that
gets passed between Sema functions, or should there be members within
Sema for things like CurLambdaIntroducer and CurLambdaMethod, or
More information about the cfe-commits