diff options
author | Anna Zaks <ganna@apple.com> | 2012-11-03 02:54:11 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-11-03 02:54:11 +0000 |
commit | b355be838a22a511d078504b2277f70aea52ca85 (patch) | |
tree | 5c4953b25f3e2c62ba02d0e1a7037ad9724097be /include/clang/StaticAnalyzer/Core | |
parent | 085b76ca42b1fafb8b574dc587f356f511bb059e (diff) |
[analyzer] Refactor: Remove Pred from NodeBuilderContext.
Node builders should manage the nodes, not the context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167350 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/StaticAnalyzer/Core')
4 files changed, 12 insertions, 9 deletions
diff --git a/include/clang/StaticAnalyzer/Core/CheckerManager.h b/include/clang/StaticAnalyzer/Core/CheckerManager.h index 84959390b5..7ae8e53784 100644 --- a/include/clang/StaticAnalyzer/Core/CheckerManager.h +++ b/include/clang/StaticAnalyzer/Core/CheckerManager.h @@ -267,6 +267,7 @@ public: /// \brief Run checkers for end of path. void runCheckersForEndPath(NodeBuilderContext &BC, ExplodedNodeSet &Dst, + ExplodedNode *Pred, ExprEngine &Eng); /// \brief Run checkers for branch condition. diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h index d3f87b7d33..b6686409e5 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h @@ -180,11 +180,9 @@ public: struct NodeBuilderContext { const CoreEngine &Eng; const CFGBlock *Block; - ExplodedNode *Pred; + const LocationContext *LC; NodeBuilderContext(const CoreEngine &E, const CFGBlock *B, ExplodedNode *N) - : Eng(E), Block(B), Pred(N) { assert(B); assert(!N->isSink()); } - - ExplodedNode *getPred() const { return Pred; } + : Eng(E), Block(B), LC(N->getLocationContext()) { assert(B); } /// \brief Return the CFGBlock associated with this builder. const CFGBlock *getBlock() const { return Block; } @@ -193,7 +191,7 @@ struct NodeBuilderContext { /// visited on the exploded graph path. unsigned blockCount() const { return Eng.WList->getBlockCounter().getNumVisited( - Pred->getLocationContext()->getCurrentStackFrame(), + LC->getCurrentStackFrame(), Block->getBlockID()); } }; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h index eba9cc4c65..6ac69c1aac 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h @@ -194,7 +194,8 @@ public: /// Called by CoreEngine when processing the entrance of a CFGBlock. virtual void processCFGBlockEntrance(const BlockEdge &L, - NodeBuilderWithSinks &nodeBuilder); + NodeBuilderWithSinks &nodeBuilder, + ExplodedNode *Pred); /// ProcessBranch - Called by CoreEngine. Used to generate successor /// nodes by processing the 'effects' of a branch condition. @@ -215,7 +216,8 @@ public: /// ProcessEndPath - Called by CoreEngine. Used to generate end-of-path /// nodes when the control reaches the end of a function. - void processEndOfFunction(NodeBuilderContext& BC); + void processEndOfFunction(NodeBuilderContext& BC, + ExplodedNode *Pred); /// Generate the entry node of the callee. void processCallEnter(CallEnter CE, ExplodedNode *Pred); diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h index 68b81f19a4..1e710778d9 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h @@ -60,7 +60,8 @@ public: /// SubEngine is expected to populate dstNodes with new nodes representing /// updated analysis state, or generate no nodes at all if it doesn't. virtual void processCFGBlockEntrance(const BlockEdge &L, - NodeBuilderWithSinks &nodeBuilder) = 0; + NodeBuilderWithSinks &nodeBuilder, + ExplodedNode *Pred) = 0; /// Called by CoreEngine. Used to generate successor /// nodes by processing the 'effects' of a branch condition. @@ -81,7 +82,8 @@ public: /// Called by CoreEngine. Used to generate end-of-path /// nodes when the control reaches the end of a function. - virtual void processEndOfFunction(NodeBuilderContext& BC) = 0; + virtual void processEndOfFunction(NodeBuilderContext& BC, + ExplodedNode *Pred) = 0; // Generate the entry node of the callee. virtual void processCallEnter(CallEnter CE, ExplodedNode *Pred) = 0; |