@@ -25,8 +25,13 @@ namespace clang {
25
25
26
26
class ProgramPoint {
27
27
public:
28
- enum Kind { BlockEntranceKind=0 , PostStmtKind=1 , BlockExitKind=2 ,
29
- BlockEdgeSrcKind=3 , BlockEdgeDstKind=4 , BlockEdgeAuxKind=5 };
28
+ enum Kind { LayeredNodeKind = 0x0 ,
29
+ BlockEntranceKind = 0x1 ,
30
+ PostStmtKind = 0x2 ,
31
+ BlockExitKind = 0x3 ,
32
+ BlockEdgeSrcKind = 0x5 , // Skip 0x4.
33
+ BlockEdgeDstKind = 0x6 ,
34
+ BlockEdgeAuxKind = 0x7 };
30
35
protected:
31
36
uintptr_t Data;
32
37
@@ -40,8 +45,16 @@ class ProgramPoint {
40
45
ProgramPoint () : Data(0 ) {}
41
46
42
47
public:
43
- unsigned getKind () const { return Data & 0x7 ; }
44
- void * getRawPtr () const { return reinterpret_cast <void *>(Data & ~0x7 ); }
48
+
49
+ unsigned getKind () const {
50
+ unsigned x = Data & 0x7 ;
51
+ return x & 0x3 ? x : 0 ; // Use only lower 2 bits for 0x0.
52
+ }
53
+
54
+ void * getRawPtr () const {
55
+ return (void *) (getKind () ? Data & ~0x7 : Data & ~0x3 );
56
+ }
57
+
45
58
void * getRawData () const { return reinterpret_cast <void *>(Data); }
46
59
47
60
static bool classof (const ProgramPoint*) { return true ; }
@@ -53,6 +66,27 @@ class ProgramPoint {
53
66
ID.AddPointer (getRawPtr ());
54
67
}
55
68
};
69
+
70
+ class ExplodedNodeImpl ;
71
+ template <typename StateTy> class ExplodedNode ;
72
+
73
+ class LayeredNode : public ProgramPoint {
74
+ public:
75
+ LayeredNode (ExplodedNodeImpl* N) : ProgramPoint(N, LayeredNodeKind) {
76
+ assert (reinterpret_cast <uintptr_t >(N) & 0x3 == 0 &&
77
+ " Address of ExplodedNode must have 4-byte alignment." );
78
+ }
79
+
80
+ ExplodedNodeImpl* getNodeImpl () const {
81
+ return (ExplodedNodeImpl*) getRawPtr ();
82
+ }
83
+
84
+ template <typename StateTy>
85
+ ExplodedNode<StateTy>* getNode () const {
86
+ return (ExplodedNode<StateTy>*) getRawPtr ();
87
+ }
88
+
89
+ };
56
90
57
91
class BlockEntrance : public ProgramPoint {
58
92
public:
0 commit comments