How to find all class-member-variables

Hi, please can someone help me

I know how to find all class-member functions, and do it in the following
way:

bool MyASTConsumer::HandleTopLevelDecl(clang::DeclGroupRef d)
    clang::DeclGroupRef::iterator it;
    for( it = d.begin(); it != d.end(); it++)
    {
        clang::CXXMethodDecl * vd = llvm::dyn_cast<CXXMethodDecl>(*it);
        ....

BUT...
How can I find all class-member-variables?

Thanks, and best regards
Fritz Franz

Here’s one way:

// Member’s within class/struct/union:
bool VisitFieldDecl( FieldDecl * f )
{
RecordDecl * r = f->getParent() ;
const QualType & theMembersClassType = context.getRecordType( r ) ;
TypeSourceInfo * pThisFieldSourceInfo = f->getTypeSourceInfo() ;
TypeLoc thisFieldTypeLoc = pThisFieldSourceInfo->getTypeLoc() ;
const QualType & thisFieldQualType = thisFieldTypeLoc.getType() ;

cout
<< theMembersClassType.getAsString()
<< " : " << thisFieldQualType.getAsString() << endl ;

return true ;
}