[PATCH] GNU-style attributes and lambdas

Delesley Hutchins delesley at google.com
Wed Mar 12 14:40:39 PDT 2014


Looks good, and my test case now works.  Thanks!

  -DeLesley

On Tue, Mar 11, 2014 at 5:07 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> 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



-- 
DeLesley Hutchins | Software Engineer | delesley at google.com | 505-206-0315



More information about the cfe-commits mailing list