diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-02-25 18:42:54 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-02-25 18:42:54 +0000 |
| commit | 3c8d0c58dba7968810ebe5e1137e2f268a4e5d14 (patch) | |
| tree | e79656fd611f9cd3bf82b6347529c04d47cb661a | |
| parent | 3bca92bab58a217a2db4bb7109f246667cabf284 (diff) | |
Expanded transfer function support for divide-by-zero checking to include
"remainder-by-zero" checking (operator '%').
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47549 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | Analysis/GRExprEngine.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp index 74fadcc9e3..dedeb7b1b7 100644 --- a/Analysis/GRExprEngine.cpp +++ b/Analysis/GRExprEngine.cpp @@ -846,11 +846,15 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, NodeTy* N2 = *I2; StateTy St = N2->getState(); - RVal RightV = GetRVal(St, B->getRHS()); + Expr* RHS = B->getRHS(); + RVal RightV = GetRVal(St, RHS); BinaryOperator::Opcode Op = B->getOpcode(); - if (Op == BinaryOperator::Div) { // Check for divide-by-zero. + if ((Op == BinaryOperator::Div || Op == BinaryOperator::Rem) + && RHS->getType()->isIntegerType()) { + + // Check for divide/remaindner-by-zero. // First, "assume" that the denominator is 0. @@ -992,7 +996,10 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, // Evaluate operands and promote to result type. - if (Op == BinaryOperator::Div) { // Check for divide-by-zero. + if ((Op == BinaryOperator::Div || Op == BinaryOperator::Rem) + && RHS->getType()->isIntegerType()) { + + // Check for divide/remainder-by-zero. // First, "assume" that the denominator is 0. |
