summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorJosh Magee <joshua_magee@playstation.sony.com>2015-02-04 21:50:20 +0000
committerJosh Magee <joshua_magee@playstation.sony.com>2015-02-04 21:50:20 +0000
commit4d1a79b8c046eef6b1c37498856f571f94c6c12c (patch)
tree9d86f46793eba17dafca2f31ddd9077380c367de /clang/lib/AST/ExprConstant.cpp
parente032d73ec57c17c2e4cb9054edf893f77f0b2066 (diff)
downloadbcm5719-llvm-4d1a79b8c046eef6b1c37498856f571f94c6c12c.tar.gz
bcm5719-llvm-4d1a79b8c046eef6b1c37498856f571f94c6c12c.zip
Catch more cases when diagnosing integer-constant-expression overflows.
When visiting AssignmentOps, keep evaluating after a failure (when possible) in order to identify overflow in subexpressions. Differential Revision: http://reviews.llvm.org/D1238 llvm-svn: 228202
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 3d7f2dca7a2..30920a4f16f 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -6834,7 +6834,7 @@ void DataRecursiveIntBinOpEvaluator::process(EvalResult &Result) {
}
bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
- if (E->isAssignmentOp())
+ if (!Info.keepEvaluatingAfterFailure() && E->isAssignmentOp())
return Error(E);
if (DataRecursiveIntBinOpEvaluator::shouldEnqueue(E))
@@ -6846,7 +6846,11 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
if (LHSTy->isAnyComplexType() || RHSTy->isAnyComplexType()) {
ComplexValue LHS, RHS;
bool LHSOK;
- if (E->getLHS()->getType()->isRealFloatingType()) {
+ if (E->isAssignmentOp()) {
+ LValue LV;
+ EvaluateLValue(E->getLHS(), LV, Info);
+ LHSOK = false;
+ } else if (LHSTy->isRealFloatingType()) {
LHSOK = EvaluateFloat(E->getLHS(), LHS.FloatReal, Info);
if (LHSOK) {
LHS.makeComplexFloat();
OpenPOWER on IntegriCloud