diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-03-05 00:59:43 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-03-05 00:59:43 +0000 |
commit | 424f67155475296804f9b9159dba606859441924 (patch) | |
tree | d2ae13976d77ea41133022c69c2c84383e5c21a9 /include | |
parent | 544f043d7667d581792f3ac232d24343481d61d7 (diff) |
Added support for ProgramPoints to represent ExplodedNodes in another
ExplodedGraph. This allows us to build "layered" ExplodedGraphs where one
simulation is layered on another.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47926 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Analysis/ProgramPoint.h | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h index a046268cfd..6d182d9a24 100644 --- a/include/clang/Analysis/ProgramPoint.h +++ b/include/clang/Analysis/ProgramPoint.h @@ -25,8 +25,13 @@ namespace clang { class ProgramPoint { public: - enum Kind { BlockEntranceKind=0, PostStmtKind=1, BlockExitKind=2, - BlockEdgeSrcKind=3, BlockEdgeDstKind=4, BlockEdgeAuxKind=5 }; + enum Kind { LayeredNodeKind = 0x0, + BlockEntranceKind = 0x1, + PostStmtKind = 0x2, + BlockExitKind = 0x3, + BlockEdgeSrcKind = 0x5, // Skip 0x4. + BlockEdgeDstKind = 0x6, + BlockEdgeAuxKind = 0x7 }; protected: uintptr_t Data; @@ -40,8 +45,16 @@ protected: ProgramPoint() : Data(0) {} public: - unsigned getKind() const { return Data & 0x7; } - void* getRawPtr() const { return reinterpret_cast<void*>(Data & ~0x7); } + + unsigned getKind() const { + unsigned x = Data & 0x7; + return x & 0x3 ? x : 0; // Use only lower 2 bits for 0x0. + } + + void* getRawPtr() const { + return (void*) (getKind() ? Data & ~0x7 : Data & ~0x3); + } + void* getRawData() const { return reinterpret_cast<void*>(Data); } static bool classof(const ProgramPoint*) { return true; } @@ -53,6 +66,27 @@ public: ID.AddPointer(getRawPtr()); } }; + +class ExplodedNodeImpl; +template <typename StateTy> class ExplodedNode; + +class LayeredNode : public ProgramPoint { +public: + LayeredNode(ExplodedNodeImpl* N) : ProgramPoint(N, LayeredNodeKind) { + assert (reinterpret_cast<uintptr_t>(N) & 0x3 == 0 && + "Address of ExplodedNode must have 4-byte alignment."); + } + + ExplodedNodeImpl* getNodeImpl() const { + return (ExplodedNodeImpl*) getRawPtr(); + } + + template <typename StateTy> + ExplodedNode<StateTy>* getNode() const { + return (ExplodedNode<StateTy>*) getRawPtr(); + } + +}; class BlockEntrance : public ProgramPoint { public: |