]> granicus.if.org Git - clang/commitdiff
c: perform integer overflow check on all binary
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 15 Mar 2013 20:47:07 +0000 (20:47 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 15 Mar 2013 20:47:07 +0000 (20:47 +0000)
operations. // rdar://13423975

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177181 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaChecking.cpp

index 2f8d8576b9d28b1628761d8fd09ade85037764f2..dd797bbdb11f8c8addb290ff11c77608d1acb382 100644 (file)
@@ -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);
   }