check an AST node's parent node ?

Thanks, I use TraverseForStmt to solve this problem. And this makes me know TraverseXXX methods better.

------------------ Original ------------------

Careful with this; the body of a for-statement is also within the for statement:

for (int i = 0; i < 10; ++i) {
++i, --i;

Not familiar with the RecursiveASTVisitor traversal, so I can’t tell you exactly how to do it. Maybe you already got this correct.