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

Ted Kremenek kremenek at apple.com
Tue Feb 5 19:56:15 PST 2008


Author: kremenek
Date: Tue Feb  5 21:56:15 2008
New Revision: 46795

URL: http://llvm.org/viewvc/llvm-project?rev=46795&view=rev
Log:
Modified state pretty-printing to include the '!=' and '==' constraints on
symbols (for constant integers).

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=46795&r1=46794&r2=46795&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRConstants.cpp (original)
+++ cfe/trunk/Analysis/GRConstants.cpp Tue Feb  5 21:56:15 2008
@@ -1001,6 +1001,43 @@
     }
   }
     
+  static void PrintEQ(std::ostream& Out, GRConstants::StateTy St) {
+    ValueState::ConstantEqTy CE = St.getImpl()->ConstantEq;
+    
+    if (CE.isEmpty())
+      return;
+    
+    Out << "\\l\\|'==' constraints:";
+
+    for (ValueState::ConstantEqTy::iterator I=CE.begin(), E=CE.end(); I!=E;++I)
+      Out << "\\l $" << I.getKey() << " : " << I.getData()->toString();
+  }
+    
+  static void PrintNE(std::ostream& Out, GRConstants::StateTy St) {
+    ValueState::ConstantNotEqTy NE = St.getImpl()->ConstantNotEq;
+    
+    if (NE.isEmpty())
+      return;
+    
+    Out << "\\l\\|'!=' constraints:";
+    
+    for (ValueState::ConstantNotEqTy::iterator I=NE.begin(), EI=NE.end();
+         I != EI; ++I){
+      
+      Out << "\\l $" << I.getKey() << " : ";
+      bool isFirst = true;
+      
+      ValueState::IntSetTy::iterator J=I.getData().begin(),
+                                    EJ=I.getData().end();      
+      for ( ; J != EJ; ++J) {        
+        if (isFirst) isFirst = false;
+        else Out << ", ";
+        
+        Out << (*J)->toString();
+      }    
+    }
+  }    
+    
   static std::string getNodeLabel(const GRConstants::NodeTy* N, void*) {
     std::ostringstream Out;
 
@@ -1060,6 +1097,9 @@
     PrintKind(Out, N->getState(), VarBindKey::IsDecl, true);
     PrintKind(Out, N->getState(), VarBindKey::IsBlkExpr);
     PrintKind(Out, N->getState(), VarBindKey::IsSubExpr);
+    
+    PrintEQ(Out, N->getState());
+    PrintNE(Out, N->getState());
       
     Out << "\\l";
     return Out.str();





More information about the cfe-commits mailing list