[PATCH] D23895: [ms] Add support for parsing uuid as a MS attribute

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 25 18:33:30 PDT 2016


On Thu, Aug 25, 2016 at 9:16 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Thu, Aug 25, 2016 at 5:46 PM, Reid Kleckner <rnk at google.com> wrote:
>>
>> rnk added a comment.
>>
>> I think these are known as "IDL attributes":
>> https://msdn.microsoft.com/en-us/library/8tesw2eh.aspx
>>
>> Let's update the naming to use that terminology, so AS_MS should be
>> AS_IDL, and MaybeParseMicrosoftAttributes should be
>> MaybeParseMicrosoftIDLAttributes, etc.

I disagree that these are IDL attributes, though they are certainly
used in IDL. They're also used for SAL, COM, the compiler, etc. For
instance: https://msdn.microsoft.com/en-us/library/3c3t8ddh.aspx

We've usually called these "Microsoft" attributes in the past (see
Parser::ParseMicrosoftAttributes()), and I think that's reasonable
terminology for them (I am comfortable having declspec attributes be
different than whatever we wind up calling these because they are
distinct syntactic constructs anyway).

>>
>> Also, doesn't this introduce ambiguities into the grammar? Something like
>> this:
>>
>>   void useit(int);
>>   int main() {
>>     int uuid = 42;
>>     [uuid]() {
>>       useit(uuid);
>>     }();
>>   }
>>
>> Will we keep parsing that as a lambda after this change or not?
>
>
> I can see why (paraphrasing that MSDN article) parsing these attributes
> requires you to be a wizard.

We tried implementing this once before and ran into some considerable
roadblocks, both with C++ lambdas and with Objective-C message sends
(which is somewhat less concerning than lambdas).

~Aaron


More information about the cfe-commits mailing list