<div><div>I've got an AST visitor override for class members:</div><div><br></div><div> bool VisitFieldDecl( FieldDecl * f )</div><div> {</div><div> RecordDecl * r = f->getParent() ;</div><div> cout << "CLASS: " << r->getName().str() << endl ;</div>
<div> cout << "MEMBER: " << f->getName().str() << " ( " ;</div><div><br></div><div> TypeSourceInfo * t = f->getTypeSourceInfo() ;</div><div><br></div><div> TypeLoc TL = t->getTypeLoc() ;</div>
<div><br></div><div> const QualType & q = TL.getType() ;</div><div><br></div><div> cout << "TYPE: " << q.getAsString() << " )" << endl ;<br></div><div><br></div><div>
return true ;</div><div> }</div></div><div><br></div><div>I'd like to be able to check a few things about the types of the class/struct/union members that this finds:<br><br>- ask if q is a basic type (pointer, reference, char, short, int, ...)?</div>
<div>- if q is an array type, what's the underlying array type?</div><div><br></div><div>(motivation: I'd like to know what all the true dependencies of a given struct is, with an eventual goal of comparing the header file dependencies to the actual structure dependencies ... ignoring for now dependencies that are introduced by inline member functions).</div>
<div><br></div><div>-- <br></div>Peeter<br>