[PATCH] Initial support for Attribute subjects

Aaron Ballman aaron at aaronballman.com
Thu Jun 20 14:34:32 PDT 2013


This patch adds support for the Subjects part of the Attr tablegen
file.  Specifically, it modifies tablegen to pay attention to
Subjects, and emit a templated member function for attribute
subclasses called appertainTo.  The purpose is to be able to determine
whether a given attribute appertains to a particular subject.

template <typename Subject>
bool appertainTo(const Subject *S) const;

If the attribute has no subjects, then the default behavior of
appertainTo is to return true.  This makes it backwards compatible
with the fact that we've always ignored subjects previously (and many
attributes do not have a specific subject specified).

If the attribute does have subjects, then the default appertainTo will
return false, but specializations will be generated that return true
for each subject case.  If the subject happens to be a SubsetSubject,
the code from CheckCode is emitted (hence the reason for having the
subject passed into the function) and the proper base is taken from
the subject.

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


More information about the cfe-commits mailing list