]> granicus.if.org Git - clang/commitdiff
Modified state pretty-printing to include the '!=' and '==' constraints on
authorTed Kremenek <kremenek@apple.com>
Wed, 6 Feb 2008 03:56:15 +0000 (03:56 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 6 Feb 2008 03:56:15 +0000 (03:56 +0000)
symbols (for constant integers).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46795 91177308-0d34-0410-b5e6-96231b3b80d8

Analysis/GRConstants.cpp

index 5116499f17192dacedeedcc187a9ffec9c09e55c..39a50a55ce2d27e3ffd41172140c362ca97390a9 100644 (file)
@@ -1001,6 +1001,43 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<GRConstants::NodeTy*> :
     }
   }
     
+  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 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<GRConstants::NodeTy*> :
     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();