Compute side-effect for conditional expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44492 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2007-12-01 19:58:28 +00:00
Родитель 6e34049634
Коммит ab38e4b502
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -255,6 +255,13 @@ bool Expr::hasLocalSideEffect() const {
case CompoundAssignOperatorClass:
return true;
case ConditionalOperatorClass: {
const ConditionalOperator *Exp = cast<ConditionalOperator>(this);
return Exp->getCond()->hasLocalSideEffect()
|| (Exp->getLHS() && Exp->getLHS()->hasLocalSideEffect())
|| (Exp->getRHS() && Exp->getRHS()->hasLocalSideEffect());
}
case MemberExprClass:
case ArraySubscriptExprClass:
// If the base pointer or element is to a volatile pointer/field, accessing