[cfe-dev] accessing struct's members

Eli Friedman eli.friedman at gmail.com
Mon Oct 24 13:18:37 PDT 2011

On Mon, Oct 24, 2011 at 1:04 PM, ret val <retval386 at gmail.com> wrote:
> I'm using a RecursiveASTVisitor and implementing its VisitDecl()
> method. Once I find one thats a stuct(by calling isStructureType()),
> how can I iterate over its members?

RecordDecl::field_begin and RecordDecl::field_end.

> Ive looked for uses of isStructureType() in the sources, expecting to
> see it before getting its members and so far I haven't found any
> examples.

Take a look at lib/AST/RecordLayoutBuilder.cpp.


More information about the cfe-dev mailing list