diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-01-14 23:24:37 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-01-14 23:24:37 +0000 |
commit | f24af5bc2e01ca8e7396ed997378a77fddfa521e (patch) | |
tree | 0f20008d8213ec33243b7b7dbf77e7a150bfb096 /include/clang/Analysis/PathSensitive/ExplodedGraph.h | |
parent | be7a7d6f2e5b86807afd08a568863df973baaa38 (diff) |
Added prototype implementation of path-sens. analysis core engine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45986 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/PathSensitive/ExplodedGraph.h')
-rw-r--r-- | include/clang/Analysis/PathSensitive/ExplodedGraph.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/clang/Analysis/PathSensitive/ExplodedGraph.h b/include/clang/Analysis/PathSensitive/ExplodedGraph.h index d2241dca23..1fd2f40859 100644 --- a/include/clang/Analysis/PathSensitive/ExplodedGraph.h +++ b/include/clang/Analysis/PathSensitive/ExplodedGraph.h @@ -28,13 +28,16 @@ namespace clang { class GREngineImpl; class ExplodedNodeImpl; +class GRNodeBuilderImpl; class ExplodedNodeImpl : public llvm::FoldingSetNode { protected: friend class ExplodedGraphImpl; + friend class GREngineImpl; + friend class GRNodeBuilderImpl; class NodeGroup { - enum { Size1 = 0x0, SizeOther = 0x1, Flags = 0x1 }; + enum { Size1 = 0x0, SizeOther = 0x1, Infeasible = 0x2, Flags = 0x3 }; uintptr_t P; unsigned getKind() const { return P & Flags; } @@ -55,6 +58,14 @@ protected: bool empty() const; void addNode(ExplodedNodeImpl* N); + + void setInfeasibleFlag() { + P |= Infeasible; + } + + bool getInfeasibleFlag() const { + return P & Infeasible ? true : false; + } }; @@ -78,9 +89,9 @@ protected: : Location(loc), State(state) {} /// addPredeccessor - Adds a predecessor to the current node, and - /// in tandem add this node as a successor of the other node. This - /// method is intended to be used only by ExplodedGraphImpl. + /// in tandem add this node as a successor of the other node. void addPredecessor(ExplodedNodeImpl* V) { + assert (!V->isInfeasible()); Preds.addNode(V); V->Succs.addNode(this); } @@ -103,6 +114,9 @@ public: unsigned pred_size() const { return Preds.size(); } bool succ_empty() const { return Succs.empty(); } bool pred_empty() const { return Preds.size(); } + + bool isInfeasible() const { return Preds.getInfeasibleFlag(); } + void setInfeasible() { Preds.setInfeasibleFlag(); } }; @@ -166,6 +180,7 @@ public: class ExplodedGraphImpl { protected: friend class GREngineImpl; + friend class GRNodeBuilderImpl; // Type definitions. typedef llvm::DenseMap<ProgramPoint,void*> EdgeNodeSetMap; |