[PATCH] Step 1: Simple Generic lambda (no captures or nested lambdas)

Faisal Vali faisalv at gmail.com
Thu Jul 4 21:19:10 PDT 2013

Attached is a patch that addresses most of Richards comments, except for the
IsParameterPack parameter to AutoType.  I could not figure out an easy way
to get rid of this.  Its use is modeled after the way parameter pack types
are created from ASTContext::getTemplateTypeParmType.

On Sun, Jun 16, 2013 at 6:48 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Sun, Jun 16, 2013 at 7:24 AM, Faisal Vali <faisalv at gmail.com> wrote:

> It seems surprising to me that you need to save the CallOperator and
> StaticInvoker on the LambdaDefinitionData class; could you find those
> when needed by looking them up within the RecordDecl?

Yes.  Fixed.  Once again, I am assuming we are fine with the overhead
of lookup, vs space.  I have also removed the IsGenericLambda bit
to save space.

> I don't think you need the IsParameterPack parameter to AutoType --
> instead, you could look at whether the
> DeducedType.containsUnexpandedParameterPack().
I have tried to get rid of this, but no easy solution leaps out at me.

> IsGenericLambdaAutoParameter in Sema::Declarator should be a bitfield,
> but I think this would be better handled by instead adding a new kind
> of declarator context for lambda parameters.

> I would prefer for the parser to not need to know about the
> implicitly-generated template parameters, if you can arrange that.
> Maybe the relevant data can be maintained by Sema in the
> LambdaScopeInfo?

> Are the changes to ActOnReturnStmt necessary? ActOnCapScopeReturnStmt
> already deals with auto return types for lambdas, and has some other
> special cases which should be applied to lambdas (different
> diagnostics, slightly different rules).

OK. I removed all the changes from ActOnReturnStmt and I routed the call
through ActOnCapScopeReturnStmt, and made it so that  the C++1y logic
gets used in C++1y mode.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit-simple-GL+return-deduction+fix-sema-leak+declarator-3.1.patch
Type: application/octet-stream
Size: 80395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130704/5c61c561/attachment.obj>

More information about the cfe-commits mailing list