getting information from TagDecl

Is it possible to get the information about the members of a struct from the TagDecl for that struct.

for example i have :
struct foo{
int x;
char y;
};

Here how can i find out that the struct has a member of type int and another of type char.

Harsh Gupta

Is it possible to get the information about the members of a struct from the TagDecl for that struct.

for example i have :
struct foo{
int x;
char y;
};

Here how can i find out that the struct has a member of type int and another of type char.

Harsh Gupta

First, you cast the TagDecl to a RecordDecl. Then you can iterate over its FieldDecls.

Sebastian