[PATCH] Distinguishing between user-written and implicit attributes

Richard Smith metafoo at gmail.com
Wed Jan 15 18:58:19 PST 2014


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!

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.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140116/b4f61b8a/attachment.html>


More information about the cfe-commits mailing list