diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-03-23 05:05:02 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-03-23 05:05:02 +0000 |
commit | d9e0c0fc47d5881a609ec34372d554e3652db66c (patch) | |
tree | 605da92604493dac0bcfce972b4736022cc63da3 /include/clang | |
parent | ee5ab9f7a6368e516ab4e9eeadff0b2e9df03b34 (diff) |
Since we now may have basicblocks with the same block is in different function,
change the block counter map from unsigned -> unsigned to
<StackFrameContext*, unsigned> -> unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99255 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
4 files changed, 16 insertions, 7 deletions
diff --git a/include/clang/Checker/PathSensitive/GRBlockCounter.h b/include/clang/Checker/PathSensitive/GRBlockCounter.h index 67ed9532db..b7d0e8ae0c 100644 --- a/include/clang/Checker/PathSensitive/GRBlockCounter.h +++ b/include/clang/Checker/PathSensitive/GRBlockCounter.h @@ -22,6 +22,8 @@ namespace llvm { namespace clang { +class StackFrameContext; + class GRBlockCounter { void* Data; @@ -30,7 +32,8 @@ class GRBlockCounter { public: GRBlockCounter() : Data(0) {} - unsigned getNumVisited(unsigned BlockID) const; + unsigned getNumVisited(const StackFrameContext *CallSite, + unsigned BlockID) const; class Factory { void* F; @@ -39,7 +42,9 @@ public: ~Factory(); GRBlockCounter GetEmptyCounter(); - GRBlockCounter IncrementCount(GRBlockCounter BC, unsigned BlockID); + GRBlockCounter IncrementCount(GRBlockCounter BC, + const StackFrameContext *CallSite, + unsigned BlockID); }; friend class Factory; diff --git a/include/clang/Checker/PathSensitive/GRCoreEngine.h b/include/clang/Checker/PathSensitive/GRCoreEngine.h index c5bf5138a6..a3ff0dbedc 100644 --- a/include/clang/Checker/PathSensitive/GRCoreEngine.h +++ b/include/clang/Checker/PathSensitive/GRCoreEngine.h @@ -82,7 +82,7 @@ class GRCoreEngine { void ProcessStmt(CFGElement E, GRStmtNodeBuilder& Builder); - bool ProcessBlockEntrance(CFGBlock* Blk, const GRState* State, + bool ProcessBlockEntrance(CFGBlock* Blk, const ExplodedNode *Pred, GRBlockCounter BC); @@ -174,7 +174,9 @@ public: GRBlockCounter getBlockCounter() const { return Eng.WList->getBlockCounter();} unsigned getCurrentBlockCount() const { - return getBlockCounter().getNumVisited(B.getBlockID()); + return getBlockCounter().getNumVisited( + Pred->getLocationContext()->getCurrentStackFrame(), + B.getBlockID()); } ExplodedNode* generateNode(PostStmt PP,const GRState* St,ExplodedNode* Pred) { @@ -434,7 +436,9 @@ public: } unsigned getCurrentBlockCount() const { - return getBlockCounter().getNumVisited(B.getBlockID()); + return getBlockCounter().getNumVisited( + Pred->getLocationContext()->getCurrentStackFrame(), + B.getBlockID()); } ExplodedNode* generateNode(const GRState* State, const void *tag = 0, diff --git a/include/clang/Checker/PathSensitive/GRExprEngine.h b/include/clang/Checker/PathSensitive/GRExprEngine.h index 916511e8bd..dd8e71ed9b 100644 --- a/include/clang/Checker/PathSensitive/GRExprEngine.h +++ b/include/clang/Checker/PathSensitive/GRExprEngine.h @@ -153,7 +153,7 @@ public: /// ProcessBlockEntrance - Called by GRCoreEngine when start processing /// a CFGBlock. This method returns true if the analysis should continue /// exploring the given path, and false otherwise. - bool ProcessBlockEntrance(CFGBlock* B, const GRState* St, + bool ProcessBlockEntrance(CFGBlock* B, const ExplodedNode *Pred, GRBlockCounter BC); /// ProcessBranch - Called by GRCoreEngine. Used to generate successor diff --git a/include/clang/Checker/PathSensitive/GRSubEngine.h b/include/clang/Checker/PathSensitive/GRSubEngine.h index f2cd0486e3..93f9e846ab 100644 --- a/include/clang/Checker/PathSensitive/GRSubEngine.h +++ b/include/clang/Checker/PathSensitive/GRSubEngine.h @@ -47,7 +47,7 @@ public: /// ProcessBlockEntrance - Called by GRCoreEngine when start processing /// a CFGBlock. This method returns true if the analysis should continue /// exploring the given path, and false otherwise. - virtual bool ProcessBlockEntrance(CFGBlock* B, const GRState* St, + virtual bool ProcessBlockEntrance(CFGBlock* B, const ExplodedNode *Pred, GRBlockCounter BC) = 0; /// ProcessBranch - Called by GRCoreEngine. Used to generate successor |