forked from OSchip/llvm-project
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:
parent
8adeebb274
commit
2ecc9d42f7
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue