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

Ted Kremenek kremenek at apple.com
Tue Feb 12 13:37:26 PST 2008


Author: kremenek
Date: Tue Feb 12 15:37:25 2008
New Revision: 47029

URL: http://llvm.org/viewvc/llvm-project?rev=47029&view=rev
Log:
Minor (cosmetic) reshuffling of code. Fixed a bug in "Assume" logic when
handling Non-Lvalues of the type nonlval::SymbolVal; we were accidentally
casting them to lval::SymbolVal.

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=47029&r1=47028&r2=47029&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRConstants.cpp (original)
+++ cfe/trunk/Analysis/GRConstants.cpp Tue Feb 12 15:37:25 2008
@@ -272,17 +272,14 @@
   ///  other functions that handle specific kinds of statements.
   void Visit(Stmt* S, NodeTy* Pred, NodeSet& Dst);
 
-  /// VisitCast - Transfer function logic for all casts (implicit and explicit).
-  void VisitCast(Expr* CastE, Expr* E, NodeTy* Pred, NodeSet& Dst);
-  
-  /// VisitUnaryOperator - Transfer function logic for unary operators.
-  void VisitUnaryOperator(UnaryOperator* B, NodeTy* Pred, NodeSet& Dst);
-  
   /// VisitBinaryOperator - Transfer function logic for binary operators.
   void VisitBinaryOperator(BinaryOperator* B, NodeTy* Pred, NodeSet& Dst);
   
   void VisitAssignmentLHS(Expr* E, NodeTy* Pred, NodeSet& Dst);
 
+  /// VisitCast - Transfer function logic for all casts (implicit and explicit).
+  void VisitCast(Expr* CastE, Expr* E, NodeTy* Pred, NodeSet& Dst);  
+  
   /// VisitDeclRefExpr - Transfer function logic for DeclRefExprs.
   void VisitDeclRefExpr(DeclRefExpr* DR, NodeTy* Pred, NodeSet& Dst); 
 
@@ -299,6 +296,10 @@
   /// VisitSizeOfAlignOfTypeExpr - Transfer function for sizeof(type).
   void VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr* S, NodeTy* Pred,
                                   NodeSet& Dst);
+  
+  /// VisitUnaryOperator - Transfer function logic for unary operators.
+  void VisitUnaryOperator(UnaryOperator* B, NodeTy* Pred, NodeSet& Dst);
+  
 };
 } // end anonymous namespace
 
@@ -919,6 +920,14 @@
   }
 
   switch (S->getStmtClass()) {
+      
+    default:
+      // Cases we intentionally have "default" handle:
+      //   AddrLabelExpr, CharacterLiteral, IntegerLiteral
+      
+      Dst.Add(Pred); // No-op. Simply propagate the current state unchanged.
+      break;
+                                                       
     case Stmt::BinaryOperatorClass: {
       BinaryOperator* B = cast<BinaryOperator>(S);
  
@@ -1001,10 +1010,6 @@
     case Stmt::UnaryOperatorClass:
       VisitUnaryOperator(cast<UnaryOperator>(S), Pred, Dst);
       break;
-      
-    default:
-      Dst.Add(Pred); // No-op. Simply propagate the current state unchanged.
-      break;
   }
 }
 
@@ -1053,7 +1058,7 @@
       
       
     case nonlval::SymbolValKind: {
-      lval::SymbolVal& SV = cast<lval::SymbolVal>(Cond);
+      nonlval::SymbolVal& SV = cast<nonlval::SymbolVal>(Cond);
       SymbolID sym = SV.getSymbol();
       
       if (Assumption)





More information about the cfe-commits mailing list