[PATCH] Simplify handling of iboutletcollection and vec_type_hint attributes

Richard Smith richard at metafoo.co.uk
Thu Oct 24 15:14:06 PDT 2013


Currently, the iboutletcollection and vec_type_hint attributes are parsed
by contorting the normal list-of-expressions parsing logic. For
iboutletcollection, the "type" is parsed manually, by picking out an
identifier followed by an (optional) list of angle-bracketed identifiers,
and the latter is ignored. This is needlessly complex; the attached patch
modifies them to just parse a type as the attribute argument.

The custom handling also breaks parsing for other kinds of attributes which
*don't* take a type argument; for instance, in
"__attribute__((aligned(int)))" we parse and ignore the 'int', and in
"__attribute__((aligned(int(1))))" we reject a valid expression because we
get confused and think it's a type. This is not even bug-compatible with
g++, which does the right thing in these cases.

Other than fixing bugs, this makes one semantic change: when given a
protocol-qualified object type, IBOutletCollectionAttr now stores the full
type (including the protocol list) where it previously just stored the
interface. I've updated the only consumer of this information that I could
find (in libclang).

Please review!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131024/55893851/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: type-attr-cleanup.diff
Type: text/x-patch
Size: 17005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131024/55893851/attachment.bin>

More information about the cfe-commits mailing list