make the unused expression warning less noisy by not warning about comma exprs whose

LHS and RHS both have side effects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44486 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-12-01 06:07:34 +00:00
Родитель a977636a9c
Коммит e7716e6133
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -243,8 +243,15 @@ bool Expr::hasLocalSideEffect() const {
return UO->getSubExpr()->hasLocalSideEffect();
}
}
case BinaryOperatorClass:
return cast<BinaryOperator>(this)->isAssignmentOp();
case BinaryOperatorClass: {
const BinaryOperator *BinOp = cast<BinaryOperator>(this);
// Consider comma to have side effects if the LHS and RHS both do.
if (BinOp->getOpcode() == BinaryOperator::Comma)
return BinOp->getLHS()->hasLocalSideEffect() &&
BinOp->getRHS()->hasLocalSideEffect();
return BinOp->isAssignmentOp();
}
case CompoundAssignOperatorClass:
return true;