for C++ access specifiers, accept an additional (trailing) q_* attribute, and add the attribute to all AST nodes for methods until the next specifier.
Then the proposed change to clang is to handle it as follows: #define Q_INVOKABLE attribute((q_invokable)) #define signals protected attribute((q_signal)) Taking a leaf from Cocoa’s book, we can use the pre-processor to inject: (To be used properly with Qt, the class would also have to inherit from QObject, and have the Q_OBJECT macro right after the opening brace.) Qt’s meta-type system also allows for “invokable methods”, which can be called/invoked without being tagged as slot. These changes use the attributes to mark AST nodes as signal/slot/invokable, and expose those attributes through libclang.Ī bit of background: if you are more familiar with Objective-C, then the signal/slot mechanism works nearly exactly the same as Cocoa’s IBAction/IBOutlet: it uses a meta-type system to invoke the methods, or let slots connected to a signal know that the signal was emitted. For that, I have a proposal for a few small changes to the clang parser. I would like to add support for recognising Qt’s signal/slot mechanism to clang by using attributes.