[PATCH] Distinguishing between user-written and implicit attributes

Aaron Ballman aaron at aaronballman.com
Wed Jan 15 19:38:34 PST 2014


On Wed, Jan 15, 2014 at 9:58 PM, Richard Smith <metafoo at gmail.com> wrote:
>
>
> On Wed Jan 15 2014 at 6:17:50 PM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
>>
>> This patch implements the ability to distinguish between attributes
>> explicitly written at the request of the user, and attributes
>> implicitly generated to assist in bookkeeping by the compiler. It
>> additionally removes the optional nature of the spelling list index
>> when creating attributes. These two things go hand in hand because the
>> spelling of the attribute is semantically important in some cases.
>>
>> All attributes now receive a table-generated factory function named
>> CreateImplicit. This function creates a new instance of the attribute,
>> and flags it as being implicitly created. This attribute is then
>> inserted into the AST as normal, but consumers of the AST are able to
>> check whether the attribute was implicitly generated, if it suits
>> them. Currently, no AST consumer cares (outside of the AST dumper, for
>> testing purposes), but the expectation is that this will change.
>>
>>
>>
>> If the attribute has distinct spellings (where distinct is defined as
>> "differing in more than just spelling varieties and leading/trailing
>> underscores), it also receives a Spelling enumeration. This allows
>> spelling-specific implicit attributes to be created without relying on
>> fragile mechanisms.
>
>
> This looks great, thanks!

Thanks!

>
> It looks like this patch marks the AsmLabelAttr as always being implicit
> (but maybe I'm misreading). I don't think that's the best choice; it
> corresponds to something the user explicitly wrote in the source code, and
> is our only AST representation of that thing. (It should probably also be
> given a Keyword spelling.)

Yes, that is what's currently happening. I'll change it up -- if you
notice any others like that, please let me know and I'll modify them
as well. I also suspect there are cases where we add attributes
explicitly which should be implicit that I've missed.

I'll likely commit in the morning, and we can tackle anything that's
amiss as it comes up.

Thanks, again!

~Aaron



More information about the cfe-commits mailing list