[cfe-commits] r46880 - /cfe/trunk/Analysis/GRConstants.cpp

Ted Kremenek kremenek at apple.com
Thu Feb 7 23:05:39 PST 2008


Author: kremenek
Date: Fri Feb  8 01:05:39 2008
New Revision: 46880

URL: http://llvm.org/viewvc/llvm-project?rev=46880&view=rev
Log:
Implemented transfer functions for Statement-Expressions and Commas.
Fixed bug in dispatching to the correct transfer function for |=, &=, and ^|.

Modified:
    cfe/trunk/Analysis/GRConstants.cpp

Modified: cfe/trunk/Analysis/GRConstants.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRConstants.cpp?rev=46880&r1=46879&r2=46880&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRConstants.cpp (original)
+++ cfe/trunk/Analysis/GRConstants.cpp Fri Feb  8 01:05:39 2008
@@ -917,8 +917,10 @@
           const LValue& L1 = cast<LValue>(V1);
           RValue Result = cast<NonLValue>(UnknownVal());
           
-          Op = (BinaryOperator::Opcode)
-                  (((unsigned) Op) - ((unsigned) BinaryOperator::MulAssign));
+          if (Op >= BinaryOperator::AndAssign)
+            ((int&) Op) -= (BinaryOperator::AndAssign - BinaryOperator::And);
+          else
+            ((int&) Op) -= BinaryOperator::MulAssign;
           
           if (isa<LValue>(V2)) {
             // FIXME: Add support for Non-LValues on RHS.
@@ -959,6 +961,12 @@
         VisitLogicalExpr(cast<BinaryOperator>(S), Pred, Dst);
         break;
       }
+      else if (cast<BinaryOperator>(S)->getOpcode() == BinaryOperator::Comma) {
+        StateTy St = Pred->getState();
+        Stmt* LastStmt = cast<BinaryOperator>(S)->getRHS();
+        Nodify(Dst, S, Pred, SetValue(St, S, GetValue(St, LastStmt)));
+        break;
+      }
       
       // Fall-through.
       
@@ -966,6 +974,13 @@
       VisitBinaryOperator(cast<BinaryOperator>(S), Pred, Dst);
       break;
       
+    case Stmt::StmtExprClass: {
+      StateTy St = Pred->getState();
+      Stmt* LastStmt = *(cast<StmtExpr>(S)->getSubStmt()->body_rbegin());
+      Nodify(Dst, S, Pred, SetValue(St, S, GetValue(St, LastStmt)));
+      break;      
+    }
+      
     case Stmt::UnaryOperatorClass:
       VisitUnaryOperator(cast<UnaryOperator>(S), Pred, Dst);
       break;





More information about the cfe-commits mailing list