Expanded graph-visualization to include optional pretty-printing of checker-specific state.

llvm-svn: 48238
This commit is contained in:
Ted Kremenek 2008-03-11 19:02:40 +00:00
parent 827d0fcd57
commit d01efb547f
2 changed files with 11 additions and 4 deletions

View File

@ -1554,6 +1554,7 @@ GRExprEngine::AssumeSymInt(ValueState* St, bool Assumption,
#ifndef NDEBUG #ifndef NDEBUG
static GRExprEngine* GraphPrintCheckerState; static GRExprEngine* GraphPrintCheckerState;
static SourceManager* GraphPrintSourceManager; static SourceManager* GraphPrintSourceManager;
static ValueState::CheckerStatePrinter* GraphCheckerStatePrinter;
namespace llvm { namespace llvm {
template<> template<>
@ -1794,7 +1795,7 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<GRExprEngine::NodeTy*> :
Out << "\\|StateID: " << (void*) N->getState() << "\\|"; Out << "\\|StateID: " << (void*) N->getState() << "\\|";
N->getState()->printDOT(Out); N->getState()->printDOT(Out, GraphCheckerStatePrinter);
Out << "\\l"; Out << "\\l";
return Out.str(); return Out.str();
@ -1825,11 +1826,13 @@ void GRExprEngine::ViewGraph(bool trim) {
else { else {
GraphPrintCheckerState = this; GraphPrintCheckerState = this;
GraphPrintSourceManager = &getContext().getSourceManager(); GraphPrintSourceManager = &getContext().getSourceManager();
GraphCheckerStatePrinter = TF->getCheckerStatePrinter();
llvm::ViewGraph(*G.roots_begin(), "GRExprEngine"); llvm::ViewGraph(*G.roots_begin(), "GRExprEngine");
GraphPrintCheckerState = NULL; GraphPrintCheckerState = NULL;
GraphPrintSourceManager = NULL; GraphPrintSourceManager = NULL;
GraphCheckerStatePrinter = NULL;
} }
#endif #endif
} }
@ -1838,6 +1841,7 @@ void GRExprEngine::ViewGraph(NodeTy** Beg, NodeTy** End) {
#ifndef NDEBUG #ifndef NDEBUG
GraphPrintCheckerState = this; GraphPrintCheckerState = this;
GraphPrintSourceManager = &getContext().getSourceManager(); GraphPrintSourceManager = &getContext().getSourceManager();
GraphCheckerStatePrinter = TF->getCheckerStatePrinter();
GRExprEngine::GraphTy* TrimmedG = G.Trim(Beg, End); GRExprEngine::GraphTy* TrimmedG = G.Trim(Beg, End);
@ -1850,5 +1854,6 @@ void GRExprEngine::ViewGraph(NodeTy** Beg, NodeTy** End) {
GraphPrintCheckerState = NULL; GraphPrintCheckerState = NULL;
GraphPrintSourceManager = NULL; GraphPrintSourceManager = NULL;
GraphCheckerStatePrinter = NULL;
#endif #endif
} }

View File

@ -17,17 +17,19 @@
#include "clang/Analysis/PathSensitive/RValues.h" #include "clang/Analysis/PathSensitive/RValues.h"
#include "clang/Analysis/PathSensitive/GRCoreEngine.h" #include "clang/Analysis/PathSensitive/GRCoreEngine.h"
#include "clang/Analysis/PathSensitive/ValueState.h"
namespace clang { namespace clang {
class ValueState;
class ValueStateManager;
class GRTransferFuncs { class GRTransferFuncs {
public: public:
GRTransferFuncs() {} GRTransferFuncs() {}
virtual ~GRTransferFuncs() {} virtual ~GRTransferFuncs() {}
virtual ValueState::CheckerStatePrinter* getCheckerStatePrinter() {
return NULL;
}
// Casts. // Casts.
virtual RVal EvalCast(BasicValueFactory& BasicVals, NonLVal V, virtual RVal EvalCast(BasicValueFactory& BasicVals, NonLVal V,