[cfe-dev] Front-end with support for custom __attribute__'s

Douglas Gregor dgregor at apple.com
Thu Mar 17 10:42:06 PDT 2011


On Mar 17, 2011, at 4:59 AM, Konstantin Tokarev wrote:

> 
> Is it possible to create custom Clang frontend supporting new types of __attribute__ without 
> modification of Clang libraries?
> 
> As for attributes, I've read "How to add an attribute" manual, but (AFAIU) it requires modification 
> of Sema::Kind enum, and even if I inherit from Sema, I won't be able to replace existing Kind
> without breaking API compatibility of my Sema derivative with other libraries.


You might be able to use the "annotate" attribute for what you're doing. If that doesn't work, then the answer is "no": attributes need to have explicit code to support them in the parser, sema, AST, and code generator.

	- Doug



More information about the cfe-dev mailing list