[cfe-commits] [PATCH] Parsing C++0x lambda expressions

Douglas Gregor dgregor at apple.com
Thu Jul 7 23:26:03 PDT 2011



Sent from my iPhone

On Jul 7, 2011, at 11:35 AM, John Freeman <jfreeman at cse.tamu.edu> wrote:

> On 7/6/2011 2:59 PM, Douglas Gregor wrote:
>> +  // Parse lambda-declarator[opt].
>> +  // FIXME: Should we default the type quals, or store mutability in this?
>> +  DeclSpec DS(AttrFactory);
>> 
>> Parse as it's written, and let Sema/AST deal with the mutability.
>> 
>> +    // Parse 'mutable'[opt].
>> +    if (Tok.is(tok::kw_mutable)) {
>> +      // FIXME: How should we add this to the declarator? Should we instead
>> +      // add const-ness if we do not see 'mutable'?
>> +      ConsumeToken();
>> +    }
>> 
>> Just extend the Declarator class with a location for the lambda 'mutable' and Sema will deal with it.
> 
> What is the best place to keep the lambda 'mutable' location? Declarator, or perhaps DeclSpec, or DeclaratorChunk::FunctionTypeInfo (my best guess)?

DeclaratorChunk::FunctionTypeInfo is fine. 

> Also, there is an EllipsisLoc in Declarator. I don't see any code using it in either DeclSpec.h or DeclSpec.cpp. Is it used?

Parameter packs use it. 



More information about the cfe-commits mailing list