[PATCH] Attribute parameters and arguments

Aaron Ballman aaron at aaronballman.com
Tue Aug 27 15:16:54 PDT 2013


Attributes can have a single parameter, as well as multiple (sometimes
optional) arguments.  However, tablegen currently does not do a very
good job of expressing this, and so the semantic checks have to be
implemented in many different places.

This patch overhauls the way arguments and parameters are handled in
tablegen.  Specifically, it:

1) Adds the notion of an explicit parameter to the attribute
definition, instead of implicitly relying on it being the first,
"blessed" type in an argument list.
2) Arguments can now specify that they are optional (by default, all
arguments are mandatory).
3) Updates the tablegen for these new features.  This includes adding
a second attribute constructor which elides the optional arguments
(they can be set later via an explicit setter).
4) Updates the AttributeList to express more information garnered from
the tablegen.
5) Updates the semantic checking for declarations so that it can make
use of this new information on AttributeList and consolidates a bunch
of checking into one function.

This may seem like the patch is doing a lot of different things, but
in the end, the combination is required in order to make this patch
useful as a unit.  The good news is: subsequent patches consolidating
more error checking should be considerably smaller.  Future error
checking includes: optional parameters and attribute subjects (there
are likely other things we can consolidate as well).

~Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AttrParamArgs.patch
Type: application/octet-stream
Size: 54335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130827/e66c5c81/attachment.obj>


More information about the cfe-commits mailing list