I have detected all the places where there are assignment statements by visiting Binary Operators that are "="
From there I got the LHS and RHS by doing binaryOperator->getLHS() and getRHS() respectively
How should I go about iterating through all the nodes within the RHS.
Currently I have tried to use Stmt::child_iterator
recursively to visit all the child nodes but it seems to only be going 1 level down.
bool recursiveVisit (Stmt *stmt) {
for (Stmt::child_iterator i = stmt->child_begin(), e = stmt->child_end(); i != e; ++i) {
Stmt *currStmt = *i;
errs() << "Hello";
recursiveVisit(currStmt);
}
}
Am I doing something wrong in the code? Some of my trees only have "Hello" printed once, it's not going any further down. Others don't even print "Hello" once at all.