Trying to write new clang-tidy check, have a problem with RecursiveASTVisitor.

Hi all!

I'm attempting to write a new clang-tidy check, misc-assertion-count.
The current version of the code is available in :
https://github.com/LebedevRI/clang-tools-extra/tree/misc-assertion-count--for-cfe-dev.
What's missing is docs, and handling for a few more special cases, at least
C++ lambdas.

As the subj suggests, i'm having a trouble with RecursiveASTVisitor. During
function AST traversal, i would like to completely avoid c++11's lambdas.

As it was suggested on #llvm, i implemented TraverseLambdaExpr() and
TraverseLambdaBody(), but as you can see from those assert()'s, they are never
called. So the lambdas are still visited... The lit test for the check would
start failing if they are no longer visited.

So here comes the question: am i missing something really obvious?
Am i overriding those functions incorrectly? Or are they not supposed to be
overridden? How to do it?

Roman.

Solved.

As expected, there is no problem with the TraverseLambdaExpr().
It was not called because in dataTraverseStmtPre(), i have already avoided
traversing declarations, so naturally, LambdaExpr() would never be called...

One less TODO, one step closer to something worth a review :slight_smile:

Thank you all.

Roman.