Static Value-Flow Analysis
SVFGEdge.h
Go to the documentation of this file.
1 //===- SVFGEdge.h -- Sparse value-flow graph edge-------------------------------//
2 //
3 // SVF: Static Value-Flow Analysis
4 //
5 // Copyright (C) <2013-2018> <Yulei Sui>
6 //
7 
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Affero General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
17 
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 //
21 //===----------------------------------------------------------------------===//
22 
23 /*
24  * SVFGEdge.h
25  *
26  * Created on: 13 Sep. 2018
27  * Author: Yulei Sui
28  */
29 
30 #ifndef INCLUDE_MSSA_SVFGEDGE_H_
31 #define INCLUDE_MSSA_SVFGEDGE_H_
32 
33 #include "MSSA/MemSSA.h"
34 #include "Graphs/VFGEdge.h"
35 
36 namespace SVF
37 {
38 
42 class IndirectSVFGEdge : public VFGEdge
43 {
44 
45 public:
47 private:
49 public:
52  {
53  }
55 
56  inline bool addPointsTo(const NodeBS& c)
57  {
58  return (cpts |= c);
59  }
60  inline const NodeBS& getPointsTo() const
61  {
62  return cpts;
63  }
65 
67 
68  static inline bool classof(const IndirectSVFGEdge *)
69  {
70  return true;
71  }
72  static inline bool classof(const VFGEdge *edge)
73  {
74  return edge->getEdgeKind() == IntraIndirectVF ||
75  edge->getEdgeKind() == CallIndVF ||
76  edge->getEdgeKind() == RetIndVF ||
78  }
79  static inline bool classof(const GenericVFGEdgeTy *edge)
80  {
81  return edge->getEdgeKind() == IntraIndirectVF ||
82  edge->getEdgeKind() == CallIndVF ||
83  edge->getEdgeKind() == RetIndVF ||
85  }
87 
88  virtual const std::string toString() const;
89 };
90 
95 {
96 
97 public:
99  {
100  }
102  static inline bool classof(const IntraIndSVFGEdge*)
103  {
104  return true;
105  }
106  static inline bool classof(const IndirectSVFGEdge *edge)
107  {
108  return edge->getEdgeKind() == IntraIndirectVF;
109  }
110  static inline bool classof(const VFGEdge *edge)
111  {
112  return edge->getEdgeKind() == IntraIndirectVF;
113  }
114  static inline bool classof(const GenericVFGEdgeTy *edge)
115  {
116  return edge->getEdgeKind() == IntraIndirectVF;
117  }
119 
120  virtual const std::string toString() const;
121 };
122 
127 {
128 
129 private:
131 public:
134  {
135  }
136  inline CallSiteID getCallSiteId() const
137  {
138  return csId;
139  }
141  static inline bool classof(const CallIndSVFGEdge *)
142  {
143  return true;
144  }
145  static inline bool classof(const IndirectSVFGEdge *edge)
146  {
147  return edge->getEdgeKind() == CallIndVF;
148  }
149  static inline bool classof(const VFGEdge *edge)
150  {
151  return edge->getEdgeKind() == CallIndVF ;
152  }
153  static inline bool classof(const GenericVFGEdgeTy *edge)
154  {
155  return edge->getEdgeKind() == CallIndVF ;
156  }
158 
159  virtual const std::string toString() const;
160 };
161 
166 {
167 
168 private:
170 public:
173  {
174  }
175  inline CallSiteID getCallSiteId() const
176  {
177  return csId;
178  }
180  static inline bool classof(const RetIndSVFGEdge *)
181  {
182  return true;
183  }
184  static inline bool classof(const IndirectSVFGEdge *edge)
185  {
186  return edge->getEdgeKind() == RetIndVF;
187  }
188  static inline bool classof(const VFGEdge *edge)
189  {
190  return edge->getEdgeKind() == RetIndVF;
191  }
192  static inline bool classof(const GenericVFGEdgeTy *edge)
193  {
194  return edge->getEdgeKind() == RetIndVF;
195  }
197 
198  virtual const std::string toString() const;
199 };
200 
201 
207 {
208 
209 public:
211  {
212  }
214  static inline bool classof(const ThreadMHPIndSVFGEdge*)
215  {
216  return true;
217  }
218  static inline bool classof(const IndirectSVFGEdge *edge)
219  {
220  return edge->getEdgeKind() == TheadMHPIndirectVF;
221  }
222  static inline bool classof(const VFGEdge *edge)
223  {
224  return edge->getEdgeKind() == TheadMHPIndirectVF;
225  }
226  static inline bool classof(const GenericVFGEdgeTy *edge)
227  {
228  return edge->getEdgeKind() == TheadMHPIndirectVF;
229  }
231 
232  virtual const std::string toString() const;
233 };
234 
235 } // End namespace SVF
236 
237 #endif /* INCLUDE_MSSA_SVFGEDGE_H_ */
const char *const string
Definition: cJSON.h:172
virtual const std::string toString() const
Definition: SVFG.cpp:166
CallSiteID getCallSiteId() const
Definition: SVFGEdge.h:136
static bool classof(const VFGEdge *edge)
Definition: SVFGEdge.h:149
CallIndSVFGEdge(VFGNode *s, VFGNode *d, CallSiteID id)
Definition: SVFGEdge.h:132
static bool classof(const CallIndSVFGEdge *)
Definition: SVFGEdge.h:141
static bool classof(const GenericVFGEdgeTy *edge)
Definition: SVFGEdge.h:153
static bool classof(const IndirectSVFGEdge *edge)
Definition: SVFGEdge.h:145
CallSiteID csId
Definition: SVFGEdge.h:130
GEdgeKind getEdgeKind() const
Definition: GenericGraph.h:89
Set< const MRVer * > MRVerSet
Definition: SVFGEdge.h:46
const NodeBS & getPointsTo() const
Definition: SVFGEdge.h:60
virtual const std::string toString() const
Definition: SVFG.cpp:150
bool addPointsTo(const NodeBS &c)
Handle memory region.
Definition: SVFGEdge.h:56
static bool classof(const GenericVFGEdgeTy *edge)
Definition: SVFGEdge.h:79
static bool classof(const IndirectSVFGEdge *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: SVFGEdge.h:68
IndirectSVFGEdge(VFGNode *s, VFGNode *d, GEdgeFlag k)
Constructor.
Definition: SVFGEdge.h:51
static bool classof(const VFGEdge *edge)
Definition: SVFGEdge.h:72
static bool classof(const GenericVFGEdgeTy *edge)
Definition: SVFGEdge.h:114
IntraIndSVFGEdge(VFGNode *s, VFGNode *d)
Definition: SVFGEdge.h:98
static bool classof(const IndirectSVFGEdge *edge)
Definition: SVFGEdge.h:106
static bool classof(const VFGEdge *edge)
Definition: SVFGEdge.h:110
virtual const std::string toString() const
Definition: SVFG.cpp:158
static bool classof(const IntraIndSVFGEdge *)
Definition: SVFGEdge.h:102
CallSiteID getCallSiteId() const
Definition: SVFGEdge.h:175
static bool classof(const GenericVFGEdgeTy *edge)
Definition: SVFGEdge.h:192
static bool classof(const RetIndSVFGEdge *)
Definition: SVFGEdge.h:180
CallSiteID csId
Definition: SVFGEdge.h:169
static bool classof(const VFGEdge *edge)
Definition: SVFGEdge.h:188
virtual const std::string toString() const
Definition: SVFG.cpp:175
RetIndSVFGEdge(VFGNode *s, VFGNode *d, CallSiteID id)
Definition: SVFGEdge.h:171
static bool classof(const IndirectSVFGEdge *edge)
Definition: SVFGEdge.h:184
virtual const std::string toString() const
Definition: SVFG.cpp:185
static bool classof(const IndirectSVFGEdge *edge)
Definition: SVFGEdge.h:218
static bool classof(const ThreadMHPIndSVFGEdge *)
Definition: SVFGEdge.h:214
static bool classof(const VFGEdge *edge)
Definition: SVFGEdge.h:222
ThreadMHPIndSVFGEdge(VFGNode *s, VFGNode *d)
Definition: SVFGEdge.h:210
static bool classof(const GenericVFGEdgeTy *edge)
Definition: SVFGEdge.h:226
@ IntraIndirectVF
Definition: VFGEdge.h:54
@ TheadMHPIndirectVF
Definition: VFGEdge.h:59
static GEdgeFlag makeEdgeFlagWithInvokeID(GEdgeKind k, CallSiteID cs)
Compute the unique edgeFlag value from edge kind and CallSiteID.
Definition: VFGEdge.h:120
for isBitcode
Definition: BasicTypes.h:68
unsigned CallSiteID
Definition: GeneralType.h:58
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
Definition: GeneralType.h:96