diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-15 20:47:07 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-15 20:47:07 +0000 |
commit | 1fd8d46d222fab7f17b91846e2c50bef640a60a0 (patch) | |
tree | 9350acc21503c4d2d08432f15a6b60ffab3441a5 /lib/Sema/SemaChecking.cpp | |
parent | 8e694d21342d020551be688f63d7f77b83b27dd7 (diff) |
c: perform integer overflow check on all binary
operations. // rdar://13423975
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177181 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 2f8d8576b9..dd797bbdb1 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -5186,18 +5186,7 @@ void Sema::CheckImplicitConversions(Expr *E, SourceLocation CC) { /// Diagnose when expression is an integer constant expression and its evaluation /// results in integer overflow void Sema::CheckForIntOverflow (Expr *E) { - if (const BinaryOperator *BExpr = dyn_cast<BinaryOperator>(E->IgnoreParens())) { - unsigned Opc = BExpr->getOpcode(); - switch (Opc) { - case BO_Add: - case BO_Sub: - case BO_Mul: - case BO_Div: - case BO_Rem: - break; - default: - return; - } + if (isa<BinaryOperator>(E->IgnoreParens())) { llvm::SmallVector<PartialDiagnosticAt, 4> Diags; E->EvaluateForOverflow(Context, &Diags); } |