Bug fix in VisitChildren: Only visit the last statement in a StmtExpr and the RHS of a comma expression, as the other Stmts will be visited elsewhere in a CFGBlock.

llvm-svn: 49710
This commit is contained in:
Ted Kremenek 2008-04-15 05:11:28 +00:00
parent 8adeebb274
commit 2ecc9d42f7
1 changed files with 20 additions and 0 deletions

View File

@ -118,6 +118,26 @@ public:
/// VisitChildren: Call "Visit" on each child of S.
void VisitChildren(Stmt* S) {
switch (S->getStmtClass()) {
default:
break;
case Stmt::StmtExprClass: {
CompoundStmt* CS = cast<StmtExpr>(S)->getSubStmt();
if (CS->body_empty()) return;
static_cast<ImplClass*>(this)->Visit(CS->body_back());
return;
}
case Stmt::BinaryOperatorClass: {
BinaryOperator* B = cast<BinaryOperator>(S);
if (B->getOpcode() != BinaryOperator::Comma) break;
static_cast<ImplClass*>(this)->Visit(B->getRHS());
return;
}
}
for (Stmt::child_iterator I=S->child_begin(), E=S->child_end(); I != E;++I)
if (*I) static_cast<ImplClass*>(this)->Visit(*I);
}