diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2017-04-29 09:33:46 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2017-04-29 09:33:46 +0000 |
commit | e7d6fbdfb766f7d20aca405a7136ce8f7e04e705 (patch) | |
tree | 9d2966a9d9fa9ecd57381addb646da0de2dd8977 /clang/lib/Sema/SemaChecking.cpp | |
parent | 8fb5a14cadd55ba865b802fbe77fdd60253b9bf3 (diff) | |
download | bcm5719-llvm-e7d6fbdfb766f7d20aca405a7136ce8f7e04e705.tar.gz bcm5719-llvm-e7d6fbdfb766f7d20aca405a7136ce8f7e04e705.zip |
Remove Sema::CheckForIntOverflow, and instead check all full-expressions.
CheckForIntOverflow used to implement a whitelist of top-level expressions to
send to the constant expression evaluator, which handled many more expressions
than the CheckForIntOverflow whitelist did.
llvm-svn: 301742
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index ea6f16e1c87..b3ba86e0685 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -9866,28 +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()); - - if (isa<ObjCBoxedExpr>(E)) - E->IgnoreParenCasts()->EvaluateForOverflow(Context); - } while (!Exprs.empty()); -} - namespace { /// \brief Visitor for expressions which looks for unsequenced operations on the /// same object. @@ -10389,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(); } |