r177181 - c: perform integer overflow check on all binary

Fariborz Jahanian fjahanian at apple.com
Fri Mar 15 13:47:07 PDT 2013


Author: fjahanian
Date: Fri Mar 15 15:47:07 2013
New Revision: 177181

URL: http://llvm.org/viewvc/llvm-project?rev=177181&view=rev
Log:
c: perform integer overflow check on all binary
operations. // rdar://13423975

Modified:
    cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=177181&r1=177180&r2=177181&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Mar 15 15:47:07 2013
@@ -5186,18 +5186,7 @@ void Sema::CheckImplicitConversions(Expr
 /// 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);
   }





More information about the cfe-commits mailing list