Getting strcut member attributes

Hi,

I need a help,

#define OPT
#define MAN

struct A
{
   int i;
   char* c;
};

struct B
{
  OPT A a;
  MAN int i;
};

After parsing the above .h file, how to get the attributes of B members specifically
for member A which is prefixed with OPT...

So far am able to get type of a as A but unable to OPT...as it might be preprocessed and as it is empty
it may discarded or...

regards
ragha

Hi ragha, as this is a clang question I suggest you ask on the clang mailing
list.

Best wishes, Duncan.

Hi,

I need a help,

#define OPT
#define MAN

struct A
{
   int i;
   char* c;
};

struct B
{
  OPT A a;
  MAN int i;
};

After parsing the above .h file, how to get the attributes of B members specifically
for member A which is prefixed with OPT...

So far am able to get type of a as A but unable to OPT...as it might be preprocessed and as it is empty
it may discarded or...

regards
ragha

Are you talking about Clang's AST (in which case you should ask your question on cfe-dev, not here) or IR?
In either case, empty preprocessor defines are gone. There's no way to recover them. Instead, define OPT and MAN to be something like __attribute__((annotate("opt"))), which will be preserved.

Sebastian