diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2007-12-01 19:58:28 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2007-12-01 19:58:28 +0000 |
commit | ab38e4b50268633f037a10841fdfb612513f8d33 (patch) | |
tree | 91d86ee16a66a6de592b12d5d44c74c4ab450f5d | |
parent | 6e340496341a4704be0ede9c1ff4f8eacea7ee2c (diff) |
Compute side-effect for conditional expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44492 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | AST/Expr.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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<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 |