[cfe-dev] Proposal: parsing Qt signals/slots with attributes

Erik Verbruggen erik.verbruggen at me.com
Thu Oct 6 02:12:00 PDT 2011

On 30 Sep, 2011,at 07:34 AM, Douglas Gregor <dgregor at apple.com> wrote:

Let's use the existing "annotate" attribute, which is a bit like the "user" attribute mentioned in (2) above, but already implemented in Clang. That way, Qt can have definitions such as:

#define Q_OBJECT __attribute__((annotate("qt_object")))

Then, you patch need only:

(a) add support for parsing attributes on access specifiers, and
(b) update libclang to expose the "annotate" attribute 

That should be sufficient, requires much less effort (and risk) than most of the other solutions, and won't require us to bring anything related to Qt into Clang itself.
Attached is a new patch, which adds parsing of attributes after a C++ access specifier. These attributes get propagated in the same manner as the access specifier. Then in c-index-test I changed the spelling of the annotate attribute to return the quoted string.

Question: should I add a check to disallow attributes other than the annotate attribute after an access specifier?

-- Erik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111006/d9f12f35/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: annotate-for-access-specifiers.patch
Type: application/octet-stream
Size: 13867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111006/d9f12f35/attachment.obj>

More information about the cfe-dev mailing list