From: Zhongxing Xu Date: Fri, 28 Nov 2008 03:07:05 +0000 (+0000) Subject: Enable the GRStateManager to do something when we finish a path. For example, X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e73dc26690776887bd2991461f6814498600d6eb;p=clang Enable the GRStateManager to do something when we finish a path. For example, the ConstraintManager can print its internal state before its solver instance is destroyed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60204 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/ConstraintManager.h b/include/clang/Analysis/PathSensitive/ConstraintManager.h index 3f2e60d3ef..54cdecbf21 100644 --- a/include/clang/Analysis/PathSensitive/ConstraintManager.h +++ b/include/clang/Analysis/PathSensitive/ConstraintManager.h @@ -51,6 +51,8 @@ public: virtual void print(const GRState* St, std::ostream& Out, const char* nl, const char *sep) = 0; + + virtual void EndPath(const GRState* St) {} }; ConstraintManager* CreateBasicConstraintManager(GRStateManager& statemgr); diff --git a/include/clang/Analysis/PathSensitive/GRExprEngine.h b/include/clang/Analysis/PathSensitive/GRExprEngine.h index 17be0370de..6b9dc03679 100644 --- a/include/clang/Analysis/PathSensitive/GRExprEngine.h +++ b/include/clang/Analysis/PathSensitive/GRExprEngine.h @@ -414,6 +414,7 @@ public: /// nodes when the control reaches the end of a function. void ProcessEndPath(EndPathNodeBuilder& builder) { getTF().EvalEndPath(*this, builder); + StateMgr.EndPath(builder.getState()); } GRStateManager& getStateManager() { return StateMgr; } diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h index c3ef35b460..b1e866c67c 100644 --- a/include/clang/Analysis/PathSensitive/GRState.h +++ b/include/clang/Analysis/PathSensitive/GRState.h @@ -536,6 +536,10 @@ public: const llvm::APSInt* getSymVal(const GRState* St, SymbolID sym) { return ConstraintMgr->getSymVal(St, sym); } + + void EndPath(const GRState* St) { + ConstraintMgr->EndPath(St); + } }; //===----------------------------------------------------------------------===//