From ab38e4b50268633f037a10841fdfb612513f8d33 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Sat, 1 Dec 2007 19:58:28 +0000 Subject: [PATCH] Compute side-effect for conditional expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44492 91177308-0d34-0410-b5e6-96231b3b80d8 --- AST/Expr.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/AST/Expr.cpp b/AST/Expr.cpp index 5871a5c868..76b2d853f4 100644 --- a/AST/Expr.cpp +++ b/AST/Expr.cpp @@ -255,6 +255,13 @@ bool Expr::hasLocalSideEffect() const { case CompoundAssignOperatorClass: return true; + case ConditionalOperatorClass: { + const ConditionalOperator *Exp = cast(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