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
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 2f8d857..dd797bb 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -5186,18 +5186,7 @@
/// 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);
}