[cfe-dev] Finding members in a translation unit

Konstantin Weitz konstantin.weitz at googlemail.com
Thu Jul 7 16:57:09 PDT 2011


 Greetings,
I posted the same question earlier today on the IRC channel but nobody was
able to answer it.
My goal is to find all member functions in a translation unit.
I was advised, that I can use CXXRecordDecl to iterate over the members of
one class.

In order to get the CXXRecordDecl object for each class in a translation
unit, I'm overriding RecursiveASTVisitor's
VisitCXXRecordDecl member function. I would expect to get called for each
class. What actually happens is that
the VisitVarDecl member is called instead.

Any idea why this is happening and how I can fix it?

If you would like to reproduce my results, here is my code

http://pastebin.com/eFhBfDzb <cfe-dev at cs.uiuc.edu>

Thanks in advance
Konstantin Weitz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110707/faffeb34/attachment.html>


More information about the cfe-dev mailing list