From: Ted Kremenek Date: Wed, 6 Feb 2008 03:56:15 +0000 (+0000) Subject: Modified state pretty-printing to include the '!=' and '==' constraints on X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed4de31d97d80786818deb2dd75ba207933b2932;p=clang Modified state pretty-printing to include the '!=' and '==' constraints on symbols (for constant integers). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46795 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp index 5116499f17..39a50a55ce 100644 --- a/Analysis/GRConstants.cpp +++ b/Analysis/GRConstants.cpp @@ -1001,6 +1001,43 @@ struct VISIBILITY_HIDDEN DOTGraphTraits : } } + 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 : 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();