check an AST node's parent node ?

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

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

Thanks. To solve this problem, i implement TraverseForStmt below:

virtual bool TraverseForStmt(ForStmt *s) {
if (!WalkUpFromForStmt(s))
return false;
m_inForLine = true;
for (Stmt::child_range range = s->children(); range; ++range) {
if (*range == s->getBody())
m_inForLine = false;
TraverseStmt(*range);
}
return true;
}

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