[cfe-commits] [Patch][Review Request] Improve Clang attribute system
Michael Han
Michael.Han at autodesk.com
Mon Mar 5 15:04:32 PST 2012
Hi DeLesley,
Thanks for the review!
Attach an updated patch with several fixes.
Michael
-----Original Message-----
From: Delesley Hutchins [mailto:delesley at google.com]
Sent: Monday, March 05, 2012 10:12 AM
To: Michael Han; Richard Smith
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: [cfe-commits] [Patch][Review Request] Improve Clang attribute system
A few comments are attached. Looks good to me once those are fixed.
-DeLesley
On Fri, Mar 2, 2012 at 3:52 PM, Michael Han <Michael.Han at autodesk.com> wrote:
> Ping. Any comments?
>
>
>
> Attach latest patch generated against r151945.
>
>
>
> Michael
>
>
>
> From: Michael Han
> Sent: Wednesday, February 22, 2012 3:49 PM
> To: cfe-commits at cs.uiuc.edu
> Subject: RE: [Patch][Review Request] Improve Clang attribute system
>
>
>
> Hi,
>
>
>
> Here is the updated patch which also generates the case statements for
> AttributeList::getKind, along with a fix to normalize the name of
> generated attribute enumerator.
>
>
>
> Please review, thanks!
>
>
>
> Michael
>
>
>
> From: Michael Han
> Sent: Tuesday, February 21, 2012 4:46 PM
> To: cfe-commits at cs.uiuc.edu
> Subject: [Patch][Review Request] Improve Clang attribute system
>
>
>
> Hi,
>
>
>
> I am starting working on a set of patches that aim at making the
> process of adding attribute extensions to Clang more automated, and less error prone.
> Currently, to add an attribute, besides modify the attribute TD file,
> one has to modify several entries in Sema, and such manual effort
> could be automated the same way attribute parsing is automated in
> parser via table gen. This will hopefully save a lot of boilerplate
> code, and make maintaining attributes easier.
>
>
>
> So, my plan is to try to kill the attribute code in Sema that looks
> like could be generated in table gen. I remember someone mentioned
> that ultimately the AttributeList should be removed also but I felt it
> is too aggressive for me so I am going the incremental approach by
> starting refactoring existing attributes code in Sema into table gen,
> with the hope once it is done we don't need AttributeList anymore : )
>
>
>
> Here is the first patch that generate the attribute kind enumeration
> list from Attr.td. I noticed that some attributes in Attr.td does not
> have an entry in Sema AttributeList, for example, here is the list
>
>
>
> AlignMac68k
>
> AsmLabel
>
> Final
>
> MBlazeInterruptHandler
>
> MBlazeSaveVoliles
>
> MSP430Interrupt
>
> MaxFieldAlignment
>
> Override
>
>
>
> I added a bit field "SemaHandler" in Attr.td and this value is by
> default set to 1 since most of attributes described in Attr.td has
> entry in AttributeList. For the attributes in the above list, this
> field is set to 0 so there would not be entry generated for them in
> AttributeList (though.. it seems no harm to generate the entries for
> them..)
>
>
>
> Also, some entries in AttributeList are not present in Attr.td, here
> is the list
>
> _address_space
>
> _base_check
>
> _cf_returns_autoreleased
>
> _ext_vector_type
>
> _mode
>
> _neon_polyvector_type
>
> _neon_vector_type
>
> _objc_gc
>
> _objc_ownership
>
> _opencl_image_access
>
> _vector_size,
>
>
>
> I simply hard code them in the enumeration list with the enumerators
> generated by table gen together. Also, since the enumerator names are
> generated automatically they may differ slightly in spelling comparing
> to some of hand coded enumerators, so I also updated several places to
> use new enumerator.
>
>
>
> Please review and let me know if this is the right direction to go.
> Then, I will start moving more code into table gen, like the
> AttributeList::getKind, and refactor common semantic checking code
> like argument checking into table gen too. Thanks!
>
>
>
> Cheers
>
> Michael
>
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
--
DeLesley Hutchins | Software Engineer | delesley at google.com | 505-206-0315
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sema_attr.patch
Type: application/octet-stream
Size: 25090 bytes
Desc: sema_attr.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120305/d0b93f24/attachment.obj>
More information about the cfe-commits
mailing list