Fix bug in ParentMap::isConsumedExpr. A BinaryOperator always "consumes" the

value of its subexpressions unless it is a comma (in which case it doesn't
consume the left subexpression).

llvm-svn: 68628
This commit is contained in:
Ted Kremenek 2009-04-08 18:49:36 +00:00
parent 58a1eb0ba0
commit d43aaad1b1
1 changed files with 3 additions and 1 deletions

View File

@ -66,7 +66,9 @@ bool ParentMap::isConsumedExpr(Expr* E) const {
return true;
case Stmt::BinaryOperatorClass: {
BinaryOperator *BE = cast<BinaryOperator>(P);
return BE->getOpcode()==BinaryOperator::Comma && DirectChild==BE->getLHS();
// If it is a comma, only the left side is consumed.
// If it isn't a comma, both sides are consumed.
return BE->getOpcode()!=BinaryOperator::Comma || DirectChild==BE->getLHS();
}
case Stmt::ForStmtClass:
return DirectChild == cast<ForStmt>(P)->getCond();