[PATCH] Cleaning up __has_attribute without changing it

Aaron Ballman aaron at aaronballman.com
Thu Mar 27 12:20:12 PDT 2014


This patch cleans up the __has_attribute implementation, but does not
modify its behavior. This is a partial application of the patch
discussed in http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-March/036130.html

This patch replaces the tablegen-driven AttrSpellings.inc, which lived
in the lexing layer with AttrHasAttributeImpl.inc, which lives in the
basic layer. It then updates the preprocessor to call through to this
new functionality which can take additional information into account
(such as scopes and syntaxes). It exposes the ability for parts of the
compiler to ask whether an attribute is supported for a given spelling
(including scope), syntax, triple and language options.

To be clear: this patch is not intended to change the behavior of
__has_attribute. Passing AttrSyntax::Generic ensures that the current
behavior matches the previous implementation in that it *only*
considers the attribute's name and triple, not the scope or language
options. This is why there are no additional test cases supplied with
the patch.

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


More information about the cfe-commits mailing list