[cfe-commits] [PATCH] Automatically generate Attr

Sean Hunt rideau3 at gmail.com
Sat Aug 14 02:50:10 PDT 2010


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-attr-class.patch
Type: text/x-diff
Size: 120415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100814/64e4277a/attachment.patch>


More information about the cfe-commits mailing list