From bec724cbb08ab510b30a2677c3cf0afdf77741eb Mon Sep 17 00:00:00 2001 From: Diana Picus Date: Tue, 13 Jun 2017 12:50:06 +0000 Subject: Revert "Revert r301742 which made ExprConstant checking apply to all full-exprs." This reverts commit r305239 because it broke the buildbots (the diag-flags.cpp test is failing). llvm-svn: 305287 --- clang/lib/Sema/SemaChecking.cpp | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'clang/lib/Sema/SemaChecking.cpp') diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 44184c73664..b794628db73 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -9935,28 +9935,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 Exprs(1, E); - - do { - Expr *E = Exprs.pop_back_val(); - - if (isa(E->IgnoreParenCasts())) { - E->IgnoreParenCasts()->EvaluateForOverflow(Context); - continue; - } - - if (auto InitList = dyn_cast(E)) - Exprs.append(InitList->inits().begin(), InitList->inits().end()); - - if (isa(E)) - E->IgnoreParenCasts()->EvaluateForOverflow(Context); - } while (!Exprs.empty()); -} - namespace { /// \brief Visitor for expressions which looks for unsequenced operations on the /// same object. @@ -10458,7 +10436,7 @@ void Sema::CheckCompletedExpr(Expr *E, SourceLocation CheckLoc, if (!E->isInstantiationDependent()) CheckUnsequencedOperations(E); if (!IsConstexpr && !E->isValueDependent()) - CheckForIntOverflow(E); + E->EvaluateForOverflow(Context); DiagnoseMisalignedMembers(); } -- cgit v1.2.3