[cfe-dev] Proposal: parsing Qt signals/slots with attributes
Konstantin Tokarev
annulen at yandex.ru
Mon Sep 26 01:31:04 PDT 2011
26.09.2011, 04:33, "Miles Bader" <miles at gnu.org>:
> Konstantin Tokarev <annulen at yandex.ru>
> writes:
>
>>> I would like to add support for recognising Qt's signal/slot
>>> mechanism to clang by using attributes. For that, I have a proposal
>>> for a few small changes to the clang parser. These changes use the
>>> attributes to mark AST nodes as signal/slot/invokable, and expose
>>> those attributes through libclang.
>> Could anybody review this patch? It's very important for Qt community.
>
> It seems pretty weird to add special support for a specific GUI library
> to clang.
Disclaimer: I'm not affiliated with Nokia, and I'm not a developer of Qt (I've
submitted couple of patches though ;). Everything below is my personal
opinion.
Qt is not "a specific GUI library". It's framework for C++ development which
could be used to develop large range of applications including GUI and
non-GUI ones.
> Wouldn't some sort of generic mechanism be more desirable?
OK, could you recommend better way to mark methods in "signals" and "slots"
sections with specific attributes without significant performance loss?
> [Why is it "very important for Qt community" BTW? Surely they've gotten
> along for many years without this support...]
Clang-based inspection of Qt-based code can bring many new possibilities,
including:
* Reliable code completion in Qt Creator (and maybe other Qt IDEs), taking into
account Qt-specific semantics
* Additional facilities for static analysis of Qt code
* Possibility to write Qt-specific compiler optimizations
Of course it's possible to live without these things, like Apple's implementation of
Objective-C could live without all fancy stuff in clang written exclusively for it.
Erik: Could you bring some light into your future plans on this patch, e.g. are you
planning to maintain this code if it gets into Clang?
--
Regards,
Konstantin
More information about the cfe-dev
mailing list