From: Fariborz Jahanian Date: Fri, 15 Mar 2013 20:47:07 +0000 (+0000) Subject: c: perform integer overflow check on all binary X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=28c781f03902c9fc8e7425c573fb9a91be93df46;p=platform%2Fupstream%2Fllvm.git c: perform integer overflow check on all binary operations. // rdar://13423975 llvm-svn: 177181 --- diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 2f8d857..dd797bb 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/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(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(E->IgnoreParens())) { llvm::SmallVector Diags; E->EvaluateForOverflow(Context, &Diags); }