[cfe-dev] getting information from TagDecl

Sebastian Redl sebastian.redl at getdesigned.at
Thu Jun 23 05:01:45 PDT 2011


On 23.06.2011, at 13:25, harsh gupta wrote:

> 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.

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

Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110623/d33f00af/attachment.html>


More information about the cfe-dev mailing list