[PATCH] GNU-style attributes and lambdas

Aaron Ballman aaron at aaronballman.com
Tue Mar 11 17:07:30 PDT 2014


Committed with fixes discussed in r203628.

~Aaron

On Tue, Mar 11, 2014 at 7:48 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> On Tue, Mar 11, 2014 at 7:27 PM, Richard Smith <richard at metafoo.co.uk> wrote:
>> @@ -1083,7 +1086,12 @@
>>        << FixItHint::CreateInsertion(Tok.getLocation(), "() ");
>>      SourceLocation DeclLoc = Tok.getLocation();
>>      SourceLocation DeclEndLoc = DeclLoc;
>> -
>> +
>> +    // GNU-style attributes must be parsed before the mutable specifier to
>> be
>> +    // compatible with GCC.
>> +    ParsedAttributes Attr(AttrFactory);
>> +    MaybeParseGNUAttributes(Attr, &DeclEndLoc);
>>
>>
>> We can't have GNU attributes here: we're inside an "if
>> (Tok.is(tok::kw_mutable) || Tok.is(tok::arrow))" and we've not parsed any
>> tokens yet.
>
> I changed that earlier today to include C++11 attributes, but you're
> correct that we'd never hit this code, so it's not quite right yet.
> Good catch!
>
>> GCC doesn't accept
>>
>>   [] __attribute__(( )) {}
>>
>> ... so I don't think we need to deal with __attribute__ with missing
>> preceding parens (but it might be nice to do so anyway, if you want!).
>>
>> Patch looks good with that change reverted.
>
> Thanks!
>
> ~Aaron



More information about the cfe-commits mailing list