[cfe-dev] Proposal: parsing Qt signals/slots with attributes
Miles Bader
miles at gnu.org
Mon Sep 26 02:07:05 PDT 2011
Miles Bader <miles at gnu.org> writes:
> Since your basic goal seems to simply adding new attributes, which are
> then stored in the AST, and can be tested for, why not instead a
> implement a feature that allows new attributes to be added at runtime?
>
> E.g.,
>
> #pragma add_attribute oinkarific type
>
> adds the "oinkarific" type attribute.
>
> [Since attributes are a feature shared with gcc, it would be good to
> add this in a way that's not inherently clang-specific, so gcc could
> later add a similar feature if desired without too much ugliness.]
Hmm, or an alternative: just add a set of "tag" attributes, which
don't even need to be declared.
E.g.,:
#define q_variable __attribute__ ((__variable_tag__ "qt_rules"))
int my_variable q_variable;
["variable_tag" instead of just "tag", so that a macro expanding into
that attribute can be checked by the compiler as being used in the
right context.]
.. with corresponding "type_tag", etc. attributes.
[Hmm, I didn't check; maybe such attributes already exist!]
-Miles
--
Logic, n. The art of thinking and reasoning in strict accordance with the
limitations and incapacities of the human misunderstanding.
More information about the cfe-dev
mailing list