Finding members in a translation unit

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

Thanks in advance
Konstantin Weitz

The solution is to set
_langOpts.CPlusPlus = 1;