[cfe-commits] [PATCH] Automatically generate Attr

Nuno Lopes nunoplopes at sapo.pt
Sat Aug 14 03:58:02 PDT 2010


I just gave a cursory review over your patch. The patch seems ok to me.
This patch is a nice step towards reducing the complexity of handling all 
that attrribute stuff.

What I would love to see next is to have most of the code in SemDecl*.cpp 
generated automatically :)  Most of it is simply copy-paste (like checking 
the number and type of arguments, and copying the arguments to the newly 
created object).

Nuno

----- Original Message ----- 
From: "Sean Hunt" <rideau3 at gmail.com>
To: <cfe-commits at cs.uiuc.edu>
Sent: Saturday, August 14, 2010 10:50 AM
Subject: [cfe-commits] [PATCH] Automatically generate Attr


> Hey,
>
> This is a freakin' huge patch, the primary purpose of which is to make
> it so that subclasses of Attr are generated automagically by TableGen.
>
> A few other changes slipped through from my main working branch and
> didn't seem like undoing (such as renaming Sema::MergeAttributes to
> Sema::MergeDeclAttributeS) since they will get done anyways in the future.
>
> The most noticeable other change is in the way that attributes are
> stored; they are now stored in SmallVectors rather than as linked lists.
> I can't recall exactly why this is at the moment, but Doug Gregor and I
> had a long talk where we decided it was optimal, so assuming we were
> both sane at the time, it is the correct thing to do.*
>
> A nice extra interface was added to Decl as well as generally - the
> specific_attr_iterator. This is an iterator to iterate over a specific
> type of attr, much as specific_decl_iterator already does elsewhere.
>
> Some other notes about newly-generated attribute classes:
>
>  - The constructor arguments are a SourceLocation and a Context&,
>    followed by the attributes arguments in the order that they were
>    defined in Attr.td
>
>  - Every argument in Attr.td has an appropriate accessor, and there are
>    sometimes a few extra ones.
>
> Also, it just occurs to me I've forgotten to add CMake build commands
> for the three new .inc files; it's very late so I'll hold off on those
> for the final version.
>
> One last note about EnumArguments for attributes - I will add an
> additional flag to specify where the value comes from - the attribute
> spelling, a string literal, or an identifier. This will come later, when
> TableGen-enhanced code becomes responsible for the parsing and semantic
> analysis of attributes.
>
> I'd appreciate reviews of this, as it's a fairly major change. Thanks.
>
> Sean Hunt
>
> P.S. AlignedAttr now burnss. I hates it, preciouss.
>
> * Given that we're working on a C++ compiler, this may be a long shot. 




More information about the cfe-commits mailing list