aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Checkers/ExprEngine.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2011-01-10 03:54:19 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2011-01-10 03:54:19 +0000
commitf9d3cbbe07afa05c2414c7120d7141409e5a3663 (patch)
tree981c29fec5ac237c0654659ea4c7bf55e22b4378 /lib/StaticAnalyzer/Checkers/ExprEngine.cpp
parentb08624414a923e0df93dd7630fee51b0ff3cb7b1 (diff)
In C++, assignment and compound assignment operators return an lvalue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123158 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/ExprEngine.cpp')
-rw-r--r--lib/StaticAnalyzer/Checkers/ExprEngine.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/StaticAnalyzer/Checkers/ExprEngine.cpp b/lib/StaticAnalyzer/Checkers/ExprEngine.cpp
index 7c1d313453..ca960142ee 100644
--- a/lib/StaticAnalyzer/Checkers/ExprEngine.cpp
+++ b/lib/StaticAnalyzer/Checkers/ExprEngine.cpp
@@ -3241,8 +3241,14 @@ void ExprEngine::VisitBinaryOperator(const BinaryOperator* B,
LHSVal = svalBuilder.evalCast(Result, LTy, CTy);
}
- evalStore(Tmp3, B, LHS, *I4, state->BindExpr(B, Result),
- location, LHSVal);
+ // In C++, assignment and compound assignment operators return an
+ // lvalue.
+ if (B->isLValue())
+ state = state->BindExpr(B, location);
+ else
+ state = state->BindExpr(B, Result);
+
+ evalStore(Tmp3, B, LHS, *I4, state, location, LHSVal);
}
}
}