[cfe-dev] Finding members in a translation unit

Konstantin Weitz konstantin.weitz at googlemail.com
Wed Jul 13 10:46:31 PDT 2011

The solution is to set
_langOpts.CPlusPlus = 1;

On Thu, Jul 7, 2011 at 4:57 PM, Konstantin Weitz <
konstantin.weitz at googlemail.com> wrote:

> 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/20110713/e2ef9991/attachment.html>

More information about the cfe-dev mailing list