summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-02 18:30:45 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-02 18:30:45 +0000
commit570918821a8492048e6ab54955c9864bd6c3e952 (patch)
treef9d0d3f3478c298aaf51987483bbbbefe8e6631b /lib/Sema/SemaChecking.cpp
parentf0c55418e2b09eaab37c820d3756cc1b4584d084 (diff)
Notes
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r--lib/Sema/SemaChecking.cpp21
1 files changed, 1 insertions, 20 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 044ec74679d5..b3ba86e0685b 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -9866,25 +9866,6 @@ void Sema::CheckBoolLikeConversion(Expr *E, SourceLocation CC) {
::CheckBoolLikeConversion(*this, E, CC);
}
-/// Diagnose when expression is an integer constant expression and its evaluation
-/// results in integer overflow
-void Sema::CheckForIntOverflow (Expr *E) {
- // Use a work list to deal with nested struct initializers.
- SmallVector<Expr *, 2> Exprs(1, E);
-
- do {
- Expr *E = Exprs.pop_back_val();
-
- if (isa<BinaryOperator>(E->IgnoreParenCasts())) {
- E->IgnoreParenCasts()->EvaluateForOverflow(Context);
- continue;
- }
-
- if (auto InitList = dyn_cast<InitListExpr>(E))
- Exprs.append(InitList->inits().begin(), InitList->inits().end());
- } while (!Exprs.empty());
-}
-
namespace {
/// \brief Visitor for expressions which looks for unsequenced operations on the
/// same object.
@@ -10386,7 +10367,7 @@ void Sema::CheckCompletedExpr(Expr *E, SourceLocation CheckLoc,
if (!E->isInstantiationDependent())
CheckUnsequencedOperations(E);
if (!IsConstexpr && !E->isValueDependent())
- CheckForIntOverflow(E);
+ E->EvaluateForOverflow(Context);
DiagnoseMisalignedMembers();
}