[cfe-dev] Getting meta-data into Clang's AST

Cédric Venet cedric.venet at laposte.net
Sat Jul 3 02:38:02 PDT 2010


  Le 02/07/2010 22:59, chris nuernberger a écrit :
> OK, now I know what you mean by attributes; these won't work for me.
>
> You meant things like _cdecl and such, correct?

not really, attributes are part of C++0x specification using the syntax 
[[...]] but gcc had another syntax since a long time 
(__attribute__((...)) ):
http://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html
MSVC has something similar with __declspec

if you want other compiler to ignore your attribute, I think you need to 
put them in a macro:

#if METADATAPARSING
#define ADD_MYATTRIB(param) __attribute__((myattrib(param)))
#else
#define ADD_MYATTRIB(param)
#end

class A {
     int m ADD_MYATTRIB("blabla");
};


or something like that.

Your project seems interesting, will the code be public?

regards,

-- 
Cédric



More information about the cfe-dev mailing list