[PATCH] Multiple target-specific attributes with the same spelling

Aaron Ballman aaron at aaronballman.com
Mon Dec 9 08:12:45 PST 2013


Currently, all attributes are expected to have unique spellings.
However, this does not meet our needs for target-specific attributes,
which really only exist for a given target. For instance, ARM and
MSP430 both have an attribute spelled "interrupt", but with different
arguments.

This was previously handled by making the attributes have no spelling
whatsoever, and doing string comparisons when the target was asked
about the attribute. However, that does not work with things like
__has_attribute and is non-tenable.

This patch exposes a "ParseKind" member for target-specific attributes
that lets distinct attributes share a common spelling. The attributes
will be given a common parsed attribute enumeration (the AT_* enum),
but retain a distinct Attr subclass. It then uses this functionality
to handle the ARM and MSP430 interrupt attributes, and adds new tests
to ensure the attributes are applied appropriately based on target.

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


More information about the cfe-commits mailing list