[cfe-dev] getting info about fields in a RecursiveASTVisitor::VisitFieldDecl override
peeter.joot at gmail.com
Fri Nov 30 15:10:43 PST 2012
I've got an AST visitor override for class members:
bool VisitFieldDecl( FieldDecl * f )
RecordDecl * r = f->getParent() ;
cout << "CLASS: " << r->getName().str() << endl ;
cout << "MEMBER: " << f->getName().str() << " ( " ;
TypeSourceInfo * t = f->getTypeSourceInfo() ;
TypeLoc TL = t->getTypeLoc() ;
const QualType & q = TL.getType() ;
cout << "TYPE: " << q.getAsString() << " )" << endl ;
return true ;
I'd like to be able to check a few things about the types of the
class/struct/union members that this finds:
- ask if q is a basic type (pointer, reference, char, short, int, ...)?
- if q is an array type, what's the underlying array type?
(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).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev