[cfe-dev] C++11 attributes parsing

Michael Han Michael.Han at autodesk.com
Fri Jul 6 16:30:14 PDT 2012


It would be very helpful to tablegen-ized SemaDeclAttr for those adding a lot of non-standard attributes to Clang

The handle*Attr contains both generic semantic checks like arguments and subjects and for some attributes it also contains attribute specific semantic checks. Assuming the generic checks are generated by tablegen, I am curious on how to combine these generated code with hand written attribute specific checks in one single function handle*Attr.

Or instead of one handle*Attr there could be a new handle*AttrGenericChecks that is generated by tablegen (along with the big switch statement in ProcessInheritableDeclAttr) and the handle*Attr would only contain hand written attribute specific semantic checks?

Cheers
Michael

From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Sean Hunt
Sent: Friday, July 06, 2012 9:20 AM
To: Dmitri Gribenko
Cc: Richard Smith; cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] C++11 attributes parsing


On Fri, Jul 6, 2012 at 11:54 AM, Dmitri Gribenko <gribozavr at gmail.com<mailto:gribozavr at gmail.com>> wrote:
Hi Alexander,

On Fri, Jul 6, 2012 at 7:16 AM, Alexander Kornienko <alexfh at google.com<mailto:alexfh at google.com>> wrote:
> 4. do we need common code for checking attribute subjects? (currently,
> subjects are checked in handle.*Attr functions)
It would be awesome if we could automatically generate with TableGen
most of subject checking and argument checking.  It seems like we can
because SemaDeclAttr.cpp is mostly boring copy-pasted code.  I think
that we could describe attribute arguments declaratively in Attr.td
and remove most argument checks in SemaDeclAttr.cpp (like, is this an
ICE?  is this an ICE that is a valid function argument number?  is
that a string literal? etc), thus leaving only important
attribute-specific checks to be manually written.

Dmitri

This was always the goal. I wanted to unify parsing of arguments first, but there's no reason in principle that handle*Attr couldn't go first, I think.

Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120706/2f45c0d0/attachment.html>


More information about the cfe-dev mailing list