[cfe-commits] r46851 - in /cfe/trunk/Analysis: GRConstants.cpp RValues.cpp

Ted Kremenek kremenek at apple.com
Thu Feb 7 07:20:14 PST 2008


Author: kremenek
Date: Thu Feb  7 09:20:13 2008
New Revision: 46851

URL: http://llvm.org/viewvc/llvm-project?rev=46851&view=rev
Log:
Added some more opcode pretty-printing.
Minor cleanups with generating nodes for NULL-pointer dereferences.

Modified:
    cfe/trunk/Analysis/GRConstants.cpp
    cfe/trunk/Analysis/RValues.cpp

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

==============================================================================
--- cfe/trunk/Analysis/GRConstants.cpp (original)
+++ cfe/trunk/Analysis/GRConstants.cpp Thu Feb  7 09:20:13 2008
@@ -260,8 +260,7 @@
   StateTy AssumeSymInt(StateTy St, bool Assumption, const SymIntConstraint& C,
                        bool& isFeasible);
   
-  NodeTy* Nodify(NodeSet& Dst, Stmt* S, NodeTy* Pred, StateTy St,
-                 bool AlwaysMakeNode = false);
+  NodeTy* Nodify(NodeSet& Dst, Stmt* S, NodeTy* Pred, StateTy St);
   
   /// Nodify - This version of Nodify is used to batch process a set of states.
   ///  The states are not guaranteed to be unique.
@@ -582,11 +581,10 @@
 }
 
 GRConstants::NodeTy*
-GRConstants::Nodify(NodeSet& Dst, Stmt* S, NodeTy* Pred, StateTy St,
-                    bool AlwaysMakeNode) {
+GRConstants::Nodify(NodeSet& Dst, Stmt* S, NodeTy* Pred, StateTy St) {
  
   // If the state hasn't changed, don't generate a new node.
-  if (!AlwaysMakeNode && St == Pred->getState())
+  if (St == Pred->getState())
     return NULL;
   
   NodeTy* N = Builder->generateNode(S, St, Pred);
@@ -807,7 +805,10 @@
         StateTy StNull = Assume(St, L1, false, isFeasibleNull);
         
         if (isFeasibleNull) {
-          NodeTy* NullNode = Nodify(Dst, U, N1, StNull, true);
+          // We don't use "Nodify" here because the node will be a sink
+          // and we have no intention of processing it later.
+          NodeTy* NullNode = Builder->generateNode(U, StNull, N1);
+
           if (NullNode) {
             NullNode->markAsSink();
             

Modified: cfe/trunk/Analysis/RValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/RValues.cpp?rev=46851&r1=46850&r2=46851&view=diff

==============================================================================
--- cfe/trunk/Analysis/RValues.cpp (original)
+++ cfe/trunk/Analysis/RValues.cpp Thu Feb  7 09:20:13 2008
@@ -525,7 +525,9 @@
 }
 
 static void printOpcode(std::ostream& Out, BinaryOperator::Opcode Op) {
-  switch (Op) {
+  switch (Op) {      
+    case BinaryOperator::Add: Out << "+" ; break;
+    case BinaryOperator::Sub: Out << "-" ; break;
     case BinaryOperator::EQ: Out << "=="; break;
     case BinaryOperator::NE: Out << "!="; break;
     default: assert(false && "Not yet implemented.");





More information about the cfe-commits mailing list