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 | 28c781f03902c9fc8e7425c573fb9a91be93df46 (patch) | |
tree | b021c8eee908f067785c8dce38c5a6b9b947b19c | |
parent | b4cff1184adf6390c084ef8d6d702c120f5f32cf (diff) | |
download | bcm5719-llvm-28c781f03902c9fc8e7425c573fb9a91be93df46.tar.gz bcm5719-llvm-28c781f03902c9fc8e7425c573fb9a91be93df46.zip |
c: perform integer overflow check on all binary
operations. // rdar://13423975
llvm-svn: 177181
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 2f8d8576b9d..dd797bbdb11 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<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); } |