svf-lib 1.0.1375 → 1.0.1376

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
  2. package/SVF-osx/svf/include/include/AbstractExecution/AbstractValue.h +79 -0
  3. package/SVF-osx/svf/include/include/AbstractExecution/AddressValue.h +210 -0
  4. package/SVF-osx/svf/include/include/AbstractExecution/ExeState.h +223 -0
  5. package/SVF-osx/svf/include/include/AbstractExecution/IntervalExeState.h +425 -0
  6. package/SVF-osx/svf/include/include/AbstractExecution/IntervalValue.h +868 -0
  7. package/SVF-osx/svf/include/include/AbstractExecution/NumericLiteral.h +406 -0
  8. package/SVF-osx/svf/include/include/AbstractExecution/RelExeState.h +225 -0
  9. package/SVF-osx/svf/include/include/AbstractExecution/RelationSolver.h +68 -0
  10. package/SVF-osx/svf/include/include/AbstractExecution/SVFIR2ItvExeState.h +186 -0
  11. package/SVF-osx/svf/include/include/AbstractExecution/WTO.h +845 -0
  12. package/SVF-osx/svf/include/include/CFL/CFGNormalizer.h +84 -0
  13. package/SVF-osx/svf/include/include/CFL/CFLAlias.h +176 -0
  14. package/SVF-osx/svf/include/include/CFL/CFLBase.h +115 -0
  15. package/SVF-osx/svf/include/include/CFL/CFLData.h +316 -0
  16. package/SVF-osx/svf/include/include/CFL/CFLDataBuilder.h +91 -0
  17. package/SVF-osx/svf/include/include/CFL/CFLGramGraphChecker.h +74 -0
  18. package/SVF-osx/svf/include/include/CFL/CFLGrammar.h +468 -0
  19. package/SVF-osx/svf/include/include/CFL/CFLGrammar.txt +15 -0
  20. package/SVF-osx/svf/include/include/CFL/CFLGraphBuilder.h +193 -0
  21. package/SVF-osx/svf/include/include/CFL/CFLSolver.h +136 -0
  22. package/SVF-osx/svf/include/include/CFL/CFLStat.h +67 -0
  23. package/SVF-osx/svf/include/include/CFL/CFLVF.h +65 -0
  24. package/SVF-osx/svf/include/include/CFL/GrammarBuilder.h +100 -0
  25. package/SVF-osx/svf/include/include/CFL/PEGGrammar.txt +11 -0
  26. package/SVF-osx/svf/include/include/CFL/VFG.txt +7 -0
  27. package/SVF-osx/svf/include/include/DDA/ContextDDA.h +230 -0
  28. package/SVF-osx/svf/include/include/DDA/DDAClient.h +168 -0
  29. package/SVF-osx/svf/include/include/DDA/DDAPass.h +99 -0
  30. package/SVF-osx/svf/include/include/DDA/DDAStat.h +138 -0
  31. package/SVF-osx/svf/include/include/DDA/DDAVFSolver.h +789 -0
  32. package/SVF-osx/svf/include/include/DDA/FlowDDA.h +178 -0
  33. package/SVF-osx/svf/include/include/FastCluster/LICENSE.TXT +13 -0
  34. package/SVF-osx/svf/include/include/FastCluster/fastcluster.h +80 -0
  35. package/SVF-osx/svf/include/include/Graphs/CFLGraph.h +215 -0
  36. package/SVF-osx/svf/include/include/Graphs/CHG.h +351 -0
  37. package/SVF-osx/svf/include/include/Graphs/ConsG.h +408 -0
  38. package/SVF-osx/svf/include/include/Graphs/ConsGEdge.h +353 -0
  39. package/SVF-osx/svf/include/include/Graphs/ConsGNode.h +391 -0
  40. package/SVF-osx/svf/include/include/Graphs/DOTGraphTraits.h +188 -0
  41. package/SVF-osx/svf/include/include/Graphs/GenericGraph.h +620 -0
  42. package/SVF-osx/svf/include/include/Graphs/GraphPrinter.h +111 -0
  43. package/SVF-osx/svf/include/include/Graphs/GraphTraits.h +150 -0
  44. package/SVF-osx/svf/include/include/Graphs/GraphWriter.h +380 -0
  45. package/SVF-osx/svf/include/include/Graphs/ICFG.h +331 -0
  46. package/SVF-osx/svf/include/include/Graphs/ICFGEdge.h +264 -0
  47. package/SVF-osx/svf/include/include/Graphs/ICFGNode.h +523 -0
  48. package/SVF-osx/svf/include/include/Graphs/ICFGStat.h +164 -0
  49. package/SVF-osx/svf/include/include/Graphs/IRGraph.h +243 -0
  50. package/SVF-osx/svf/include/include/Graphs/PTACallGraph.h +471 -0
  51. package/SVF-osx/svf/include/include/Graphs/SVFG.h +490 -0
  52. package/SVF-osx/svf/include/include/Graphs/SVFGEdge.h +237 -0
  53. package/SVF-osx/svf/include/include/Graphs/SVFGNode.h +513 -0
  54. package/SVF-osx/svf/include/include/Graphs/SVFGOPT.h +362 -0
  55. package/SVF-osx/svf/include/include/Graphs/SVFGStat.h +273 -0
  56. package/SVF-osx/svf/include/include/Graphs/ThreadCallGraph.h +422 -0
  57. package/SVF-osx/svf/include/include/Graphs/VFG.h +664 -0
  58. package/SVF-osx/svf/include/include/Graphs/VFGEdge.h +295 -0
  59. package/SVF-osx/svf/include/include/Graphs/VFGNode.h +1197 -0
  60. package/SVF-osx/svf/include/include/MSSA/MSSAMuChi.h +722 -0
  61. package/SVF-osx/svf/include/include/MSSA/MemPartition.h +169 -0
  62. package/SVF-osx/svf/include/include/MSSA/MemRegion.h +491 -0
  63. package/SVF-osx/svf/include/include/MSSA/MemSSA.h +452 -0
  64. package/SVF-osx/svf/include/include/MSSA/SVFGBuilder.h +98 -0
  65. package/SVF-osx/svf/include/include/MTA/FSMPTA.h +270 -0
  66. package/SVF-osx/svf/include/include/MTA/LockAnalysis.h +517 -0
  67. package/SVF-osx/svf/include/include/MTA/MHP.h +565 -0
  68. package/SVF-osx/svf/include/include/MTA/MTA.h +101 -0
  69. package/SVF-osx/svf/include/include/MTA/MTAResultValidator.h +448 -0
  70. package/SVF-osx/svf/include/include/MTA/MTAStat.h +74 -0
  71. package/SVF-osx/svf/include/include/MTA/PCG.h +229 -0
  72. package/SVF-osx/svf/include/include/MTA/TCT.h +599 -0
  73. package/SVF-osx/svf/include/include/MemoryModel/AbstractPointsToDS.h +316 -0
  74. package/SVF-osx/svf/include/include/MemoryModel/ConditionalPT.h +878 -0
  75. package/SVF-osx/svf/include/include/MemoryModel/LocationSet.h +148 -0
  76. package/SVF-osx/svf/include/include/MemoryModel/MutablePointsToDS.h +1025 -0
  77. package/SVF-osx/svf/include/include/MemoryModel/PersistentPointsToCache.h +463 -0
  78. package/SVF-osx/svf/include/include/MemoryModel/PersistentPointsToDS.h +955 -0
  79. package/SVF-osx/svf/include/include/MemoryModel/PointerAnalysis.h +452 -0
  80. package/SVF-osx/svf/include/include/MemoryModel/PointerAnalysisImpl.h +590 -0
  81. package/SVF-osx/svf/include/include/MemoryModel/PointsTo.h +255 -0
  82. package/SVF-osx/svf/include/include/MemoryModel/SVFLoop.h +164 -0
  83. package/SVF-osx/svf/include/include/SABER/DoubleFreeChecker.h +76 -0
  84. package/SVF-osx/svf/include/include/SABER/FileChecker.h +82 -0
  85. package/SVF-osx/svf/include/include/SABER/LeakChecker.h +124 -0
  86. package/SVF-osx/svf/include/include/SABER/ProgSlice.h +313 -0
  87. package/SVF-osx/svf/include/include/SABER/SaberCheckerAPI.h +166 -0
  88. package/SVF-osx/svf/include/include/SABER/SaberCondAllocator.h +310 -0
  89. package/SVF-osx/svf/include/include/SABER/SaberSVFGBuilder.h +104 -0
  90. package/SVF-osx/svf/include/include/SABER/SrcSnkDDA.h +321 -0
  91. package/SVF-osx/svf/include/include/SABER/SrcSnkSolver.h +186 -0
  92. package/SVF-osx/svf/include/include/SVFIR/PAGBuilderFromFile.h +80 -0
  93. package/SVF-osx/svf/include/include/SVFIR/SVFIR.h +659 -0
  94. package/SVF-osx/svf/include/include/SVFIR/SVFModule.h +233 -0
  95. package/SVF-osx/svf/include/include/SVFIR/SVFStatements.h +1136 -0
  96. package/SVF-osx/svf/include/include/SVFIR/SVFType.h +527 -0
  97. package/SVF-osx/svf/include/include/SVFIR/SVFValue.h +1120 -0
  98. package/SVF-osx/svf/include/include/SVFIR/SVFVariables.h +721 -0
  99. package/SVF-osx/svf/include/include/SVFIR/SymbolTableInfo.h +597 -0
  100. package/SVF-osx/svf/include/include/Util/Annotator.h +180 -0
  101. package/SVF-osx/svf/include/include/Util/BitVector.h +55 -0
  102. package/SVF-osx/svf/include/include/Util/CallGraphBuilder.h +74 -0
  103. package/SVF-osx/svf/include/include/Util/Casting.h +426 -0
  104. package/SVF-osx/svf/include/include/Util/CommandLine.h +530 -0
  105. package/SVF-osx/svf/include/include/Util/CoreBitVector.h +214 -0
  106. package/SVF-osx/svf/include/include/Util/CppUtil.h +81 -0
  107. package/SVF-osx/svf/include/include/Util/CxtStmt.h +501 -0
  108. package/SVF-osx/svf/include/include/Util/DPItem.h +618 -0
  109. package/SVF-osx/svf/include/include/Util/ExtAPI.h +339 -0
  110. package/SVF-osx/svf/include/include/Util/ExtAPI.json +5707 -0
  111. package/SVF-osx/svf/include/include/Util/GraphReachSolver.h +186 -0
  112. package/SVF-osx/svf/include/include/Util/NodeIDAllocator.h +194 -0
  113. package/SVF-osx/svf/include/include/Util/Options.h +266 -0
  114. package/SVF-osx/svf/include/include/Util/PTAStat.h +65 -0
  115. package/SVF-osx/svf/include/include/Util/SCC.h +354 -0
  116. package/SVF-osx/svf/include/include/Util/SVFStat.h +100 -0
  117. package/SVF-osx/svf/include/include/Util/SVFUtil.h +660 -0
  118. package/SVF-osx/svf/include/include/Util/SparseBitVector.h +1202 -0
  119. package/SVF-osx/svf/include/include/Util/ThreadAPI.h +330 -0
  120. package/SVF-osx/svf/include/include/Util/WorkList.h +317 -0
  121. package/SVF-osx/svf/include/include/Util/Z3Expr.h +318 -0
  122. package/SVF-osx/svf/include/include/Util/cJSON.h +300 -0
  123. package/SVF-osx/svf/include/include/Util/iterator.h +407 -0
  124. package/SVF-osx/svf/include/include/Util/iterator_range.h +76 -0
  125. package/SVF-osx/svf/include/include/WPA/Andersen.h +416 -0
  126. package/SVF-osx/svf/include/include/WPA/AndersenPWC.h +160 -0
  127. package/SVF-osx/svf/include/include/WPA/CSC.h +95 -0
  128. package/SVF-osx/svf/include/include/WPA/FlowSensitive.h +317 -0
  129. package/SVF-osx/svf/include/include/WPA/Steensgaard.h +126 -0
  130. package/SVF-osx/svf/include/include/WPA/TypeAnalysis.h +83 -0
  131. package/SVF-osx/svf/include/include/WPA/VersionedFlowSensitive.h +287 -0
  132. package/SVF-osx/svf/include/include/WPA/WPAFSSolver.h +254 -0
  133. package/SVF-osx/svf/include/include/WPA/WPAPass.h +119 -0
  134. package/SVF-osx/svf/include/include/WPA/WPASolver.h +205 -0
  135. package/SVF-osx/svf/include/include/WPA/WPAStat.h +222 -0
  136. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/BasicTypes.h +250 -0
  137. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/BreakConstantExpr.h +94 -0
  138. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/CHGBuilder.h +73 -0
  139. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/DCHG.h +484 -0
  140. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/GEPTypeBridgeIterator.h +183 -0
  141. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/ICFGBuilder.h +106 -0
  142. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMLoopAnalysis.h +61 -0
  143. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMModule.h +360 -0
  144. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMUtil.h +466 -0
  145. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/SVFIRBuilder.h +417 -0
  146. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/SymbolTableBuilder.h +110 -0
  147. package/package.json +1 -1
@@ -0,0 +1,1197 @@
1
+ //===- VFGNode.h ----------------------------------------------------------------//
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 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 General Public License for more details.
17
+
18
+ // You should have received a copy of the GNU General Public License
19
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ //
21
+ //===----------------------------------------------------------------------===//
22
+
23
+ /*
24
+ * VFGNode.h
25
+ *
26
+ * Created on: 18 Sep. 2018
27
+ * Author: Yulei Sui
28
+ */
29
+
30
+ #ifndef INCLUDE_UTIL_VFGNODE_H_
31
+ #define INCLUDE_UTIL_VFGNODE_H_
32
+
33
+ #include "Graphs/GenericGraph.h"
34
+ #include "Graphs/SVFGEdge.h"
35
+ #include "Graphs/ICFGNode.h"
36
+ #include "SVFIR/SVFIR.h"
37
+
38
+ namespace SVF
39
+ {
40
+
41
+ /*!
42
+ * Interprocedural control-flow graph node, representing different kinds of program statements
43
+ * including top-level pointers (ValVar) and address-taken objects (ObjVar)
44
+ */
45
+ typedef GenericNode<VFGNode,VFGEdge> GenericVFGNodeTy;
46
+ class VFGNode : public GenericVFGNodeTy
47
+ {
48
+
49
+ public:
50
+ /// 24 kinds of ICFG node
51
+ /// Gep represents offset edge for field sensitivity
52
+ enum VFGNodeK
53
+ {
54
+ Addr, Copy, Gep, Store, Load, Cmp, BinaryOp, UnaryOp, Branch, TPhi, TIntraPhi, TInterPhi,
55
+ MPhi, MIntraPhi, MInterPhi, FRet, ARet, AParm, FParm,
56
+ FunRet, APIN, APOUT, FPIN, FPOUT, NPtr, DummyVProp
57
+ };
58
+
59
+ typedef VFGEdge::VFGEdgeSetTy::iterator iterator;
60
+ typedef VFGEdge::VFGEdgeSetTy::const_iterator const_iterator;
61
+ typedef Set<const CallPE*> CallPESet;
62
+ typedef Set<const RetPE*> RetPESet;
63
+
64
+ public:
65
+ /// Constructor
66
+ VFGNode(NodeID i, VFGNodeK k): GenericVFGNodeTy(i,k), icfgNode(nullptr)
67
+ {
68
+
69
+ }
70
+
71
+ /// Return corresponding ICFG node
72
+ virtual const ICFGNode* getICFGNode() const
73
+ {
74
+ return icfgNode;
75
+ }
76
+
77
+ /// Set corresponding ICFG node
78
+ virtual void setICFGNode(const ICFGNode* node )
79
+ {
80
+ icfgNode = node;
81
+ }
82
+
83
+ /// Get the function of this SVFGNode
84
+ virtual const SVFFunction* getFun() const
85
+ {
86
+ return icfgNode->getFun();
87
+ }
88
+
89
+ /// Return the corresponding LLVM value, if possible, nullptr otherwise.
90
+ virtual const SVFValue* getValue() const
91
+ {
92
+ return nullptr;
93
+ }
94
+
95
+ /// Return the left hand side SVF Vars
96
+ virtual const NodeBS getDefSVFVars() const = 0;
97
+
98
+ /// Overloading operator << for dumping ICFG node ID
99
+ //@{
100
+ friend OutStream& operator<< (OutStream &o, const VFGNode &node)
101
+ {
102
+ o << node.toString();
103
+ return o;
104
+ }
105
+ //@}
106
+
107
+ virtual const std::string toString() const;
108
+
109
+ protected:
110
+ const ICFGNode* icfgNode;
111
+ };
112
+
113
+ /*!
114
+ * ICFG node stands for a program statement
115
+ */
116
+ class StmtVFGNode : public VFGNode
117
+ {
118
+
119
+ private:
120
+ const PAGEdge* pagEdge;
121
+
122
+ public:
123
+ /// Constructor
124
+ StmtVFGNode(NodeID id, const PAGEdge* e, VFGNodeK k): VFGNode(id,k), pagEdge(e)
125
+ {
126
+ }
127
+
128
+ /// Whether this node is used for pointer analysis. Both src and dst PAGNodes are of ptr type.
129
+ inline bool isPTANode() const
130
+ {
131
+ return pagEdge->isPTAEdge();
132
+ }
133
+
134
+ /// PAGNode and PAGEdge
135
+ ///@{
136
+ inline const PAGEdge* getPAGEdge() const
137
+ {
138
+ return pagEdge;
139
+ }
140
+
141
+ inline NodeID getPAGSrcNodeID() const
142
+ {
143
+ return pagEdge->getSrcID();
144
+ }
145
+
146
+ inline NodeID getPAGDstNodeID() const
147
+ {
148
+ return pagEdge->getDstID();
149
+ }
150
+
151
+ inline PAGNode* getPAGSrcNode() const
152
+ {
153
+ return pagEdge->getSrcNode();
154
+ }
155
+
156
+ inline PAGNode* getPAGDstNode() const
157
+ {
158
+ return pagEdge->getDstNode();
159
+ }
160
+ //@}
161
+
162
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
163
+ //@{
164
+ static inline bool classof(const StmtVFGNode *)
165
+ {
166
+ return true;
167
+ }
168
+ static inline bool classof(const VFGNode *node)
169
+ {
170
+ return node->getNodeKind() == Addr
171
+ || node->getNodeKind() == Copy
172
+ || node->getNodeKind() == Gep
173
+ || node->getNodeKind() == Store
174
+ || node->getNodeKind() == Load;
175
+ }
176
+ static inline bool classof(const GenericVFGNodeTy *node)
177
+ {
178
+ return node->getNodeKind() == Addr
179
+ || node->getNodeKind() == Copy
180
+ || node->getNodeKind() == Gep
181
+ || node->getNodeKind() == Store
182
+ || node->getNodeKind() == Load;
183
+ }
184
+
185
+ inline const SVFInstruction* getInst() const
186
+ {
187
+ /// should return a valid instruction unless it is a global PAGEdge
188
+ return pagEdge->getInst();
189
+ }
190
+ //@}
191
+
192
+ const SVFValue* getValue() const override;
193
+ const std::string toString() const override;
194
+ };
195
+
196
+ /*!
197
+ * VFGNode for loads
198
+ */
199
+ class LoadVFGNode: public StmtVFGNode
200
+ {
201
+ private:
202
+ LoadVFGNode(); ///< place holder
203
+ LoadVFGNode(const LoadVFGNode &); ///< place holder
204
+ void operator=(const LoadVFGNode &); ///< place holder
205
+
206
+ public:
207
+ /// Constructor
208
+ LoadVFGNode(NodeID id, const LoadStmt* edge): StmtVFGNode(id, edge,Load)
209
+ {
210
+
211
+ }
212
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
213
+ //@{
214
+ static inline bool classof(const LoadVFGNode *)
215
+ {
216
+ return true;
217
+ }
218
+ static inline bool classof(const StmtVFGNode *node)
219
+ {
220
+ return node->getNodeKind() == Load;
221
+ }
222
+ static inline bool classof(const VFGNode *node)
223
+ {
224
+ return node->getNodeKind() == Load;
225
+ }
226
+ static inline bool classof(const GenericVFGNodeTy *node)
227
+ {
228
+ return node->getNodeKind() == Load;
229
+ }
230
+ //@}
231
+
232
+ const NodeBS getDefSVFVars() const override;
233
+
234
+ const std::string toString() const override;
235
+ };
236
+
237
+ /*!
238
+ * VFGNode for stores
239
+ */
240
+ class StoreVFGNode: public StmtVFGNode
241
+ {
242
+ private:
243
+ StoreVFGNode(); ///< place holder
244
+ StoreVFGNode(const StoreVFGNode &); ///< place holder
245
+ void operator=(const StoreVFGNode &); ///< place holder
246
+
247
+ public:
248
+ /// Constructor
249
+ StoreVFGNode(NodeID id,const StoreStmt* edge): StmtVFGNode(id,edge,Store)
250
+ {
251
+
252
+ }
253
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
254
+ //@{
255
+ static inline bool classof(const StoreVFGNode *)
256
+ {
257
+ return true;
258
+ }
259
+ static inline bool classof(const StmtVFGNode *node)
260
+ {
261
+ return node->getNodeKind() == Store;
262
+ }
263
+ static inline bool classof(const VFGNode *node)
264
+ {
265
+ return node->getNodeKind() == Store;
266
+ }
267
+ static inline bool classof(const GenericVFGNodeTy *node)
268
+ {
269
+ return node->getNodeKind() == Store;
270
+ }
271
+ //@}
272
+
273
+ const NodeBS getDefSVFVars() const override;
274
+
275
+ const std::string toString() const override;
276
+ };
277
+
278
+ /*!
279
+ * VFGNode for copies
280
+ */
281
+ class CopyVFGNode: public StmtVFGNode
282
+ {
283
+ private:
284
+ CopyVFGNode(); ///< place holder
285
+ CopyVFGNode(const CopyVFGNode &); ///< place holder
286
+ void operator=(const CopyVFGNode &); ///< place holder
287
+
288
+ public:
289
+ /// Constructor
290
+ CopyVFGNode(NodeID id,const CopyStmt* copy): StmtVFGNode(id,copy,Copy)
291
+ {
292
+
293
+ }
294
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
295
+ //@{
296
+ static inline bool classof(const CopyVFGNode *)
297
+ {
298
+ return true;
299
+ }
300
+ static inline bool classof(const StmtVFGNode *node)
301
+ {
302
+ return node->getNodeKind() == Copy;
303
+ }
304
+ static inline bool classof(const VFGNode *node)
305
+ {
306
+ return node->getNodeKind() == Copy;
307
+ }
308
+ static inline bool classof(const GenericVFGNodeTy *node)
309
+ {
310
+ return node->getNodeKind() == Copy;
311
+ }
312
+ //@}
313
+
314
+ const NodeBS getDefSVFVars() const override;
315
+
316
+ const std::string toString() const override;
317
+ };
318
+
319
+
320
+ /*!
321
+ * VFGNode for compare instruction, e.g., bool b = (a!=c);
322
+ */
323
+
324
+ class CmpVFGNode: public VFGNode
325
+ {
326
+ public:
327
+ typedef Map<u32_t,const PAGNode*> OPVers;
328
+ protected:
329
+ const PAGNode* res;
330
+ OPVers opVers;
331
+
332
+ private:
333
+ CmpVFGNode(); ///< place holder
334
+ CmpVFGNode(const CmpVFGNode &); ///< place holder
335
+ void operator=(const CmpVFGNode &); ///< place holder
336
+
337
+ public:
338
+ /// Constructor
339
+ CmpVFGNode(NodeID id,const PAGNode* r): VFGNode(id,Cmp), res(r) { }
340
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
341
+ //@{
342
+ static inline bool classof(const CmpVFGNode *)
343
+ {
344
+ return true;
345
+ }
346
+ static inline bool classof(const VFGNode *node)
347
+ {
348
+ return node->getNodeKind() == Cmp;
349
+ }
350
+ static inline bool classof(const GenericVFGNodeTy *node)
351
+ {
352
+ return node->getNodeKind() == Cmp;
353
+ }
354
+ //@}
355
+ /// Operands at a BinaryNode
356
+ //@{
357
+ inline const PAGNode* getOpVer(u32_t pos) const
358
+ {
359
+ OPVers::const_iterator it = opVers.find(pos);
360
+ assert(it!=opVers.end() && "version is nullptr, did not rename?");
361
+ return it->second;
362
+ }
363
+ inline void setOpVer(u32_t pos, const PAGNode* node)
364
+ {
365
+ opVers[pos] = node;
366
+ }
367
+ inline const PAGNode* getRes() const
368
+ {
369
+ return res;
370
+ }
371
+ inline u32_t getOpVerNum() const
372
+ {
373
+ return opVers.size();
374
+ }
375
+ inline OPVers::const_iterator opVerBegin() const
376
+ {
377
+ return opVers.begin();
378
+ }
379
+ inline OPVers::const_iterator opVerEnd() const
380
+ {
381
+ return opVers.end();
382
+ }
383
+ //@}
384
+
385
+ const NodeBS getDefSVFVars() const override;
386
+
387
+ const SVFValue* getValue() const override;
388
+ const std::string toString() const override;
389
+ };
390
+
391
+
392
+ /*!
393
+ * VFGNode for binary operator instructions, e.g., a = b + c;
394
+ */
395
+ class BinaryOPVFGNode: public VFGNode
396
+ {
397
+ public:
398
+ typedef Map<u32_t,const PAGNode*> OPVers;
399
+ protected:
400
+ const PAGNode* res;
401
+ OPVers opVers;
402
+
403
+ private:
404
+ BinaryOPVFGNode(); ///< place holder
405
+ BinaryOPVFGNode(const BinaryOPVFGNode &); ///< place holder
406
+ void operator=(const BinaryOPVFGNode &); ///< place holder
407
+
408
+ public:
409
+ /// Constructor
410
+ BinaryOPVFGNode(NodeID id,const PAGNode* r): VFGNode(id,BinaryOp), res(r) { }
411
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
412
+ //@{
413
+ static inline bool classof(const BinaryOPVFGNode *)
414
+ {
415
+ return true;
416
+ }
417
+ static inline bool classof(const VFGNode *node)
418
+ {
419
+ return node->getNodeKind() == BinaryOp;
420
+ }
421
+ static inline bool classof(const GenericVFGNodeTy *node)
422
+ {
423
+ return node->getNodeKind() == BinaryOp;
424
+ }
425
+ //@}
426
+ /// Operands at a BinaryNode
427
+ //@{
428
+ inline const PAGNode* getOpVer(u32_t pos) const
429
+ {
430
+ OPVers::const_iterator it = opVers.find(pos);
431
+ assert(it!=opVers.end() && "version is nullptr, did not rename?");
432
+ return it->second;
433
+ }
434
+ inline void setOpVer(u32_t pos, const PAGNode* node)
435
+ {
436
+ opVers[pos] = node;
437
+ }
438
+ inline const PAGNode* getRes() const
439
+ {
440
+ return res;
441
+ }
442
+ inline u32_t getOpVerNum() const
443
+ {
444
+ return opVers.size();
445
+ }
446
+ inline OPVers::const_iterator opVerBegin() const
447
+ {
448
+ return opVers.begin();
449
+ }
450
+ inline OPVers::const_iterator opVerEnd() const
451
+ {
452
+ return opVers.end();
453
+ }
454
+ //@}
455
+
456
+ const NodeBS getDefSVFVars() const override;
457
+
458
+ const SVFValue* getValue() const override;
459
+ const std::string toString() const override;
460
+ };
461
+
462
+ /*!
463
+ * VFGNode for unary operator instructions, e.g., a = -b;
464
+ */
465
+ class UnaryOPVFGNode: public VFGNode
466
+ {
467
+ public:
468
+ typedef Map<u32_t,const PAGNode*> OPVers;
469
+ protected:
470
+ const PAGNode* res;
471
+ OPVers opVers;
472
+
473
+ private:
474
+ UnaryOPVFGNode(); ///< place holder
475
+ UnaryOPVFGNode(const UnaryOPVFGNode &); ///< place holder
476
+ void operator=(const UnaryOPVFGNode &); ///< place holder
477
+
478
+ public:
479
+ /// Constructor
480
+ UnaryOPVFGNode(NodeID id, const PAGNode *r) : VFGNode(id, UnaryOp), res(r) { }
481
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
482
+ //@{
483
+ static inline bool classof(const UnaryOPVFGNode *)
484
+ {
485
+ return true;
486
+ }
487
+ static inline bool classof(const VFGNode *node)
488
+ {
489
+ return node->getNodeKind() == UnaryOp;
490
+ }
491
+ static inline bool classof(const GenericVFGNodeTy *node)
492
+ {
493
+ return node->getNodeKind() == UnaryOp;
494
+ }
495
+ //@}
496
+ /// Operands at a UnaryNode
497
+ //@{
498
+ inline const PAGNode* getOpVer(u32_t pos) const
499
+ {
500
+ OPVers::const_iterator it = opVers.find(pos);
501
+ assert(it!=opVers.end() && "version is nullptr, did not rename?");
502
+ return it->second;
503
+ }
504
+ inline void setOpVer(u32_t pos, const PAGNode* node)
505
+ {
506
+ opVers[pos] = node;
507
+ }
508
+ inline const PAGNode* getRes() const
509
+ {
510
+ return res;
511
+ }
512
+ inline const PAGNode* getOpVar() const
513
+ {
514
+ assert(getOpVerNum()==1 && "UnaryNode can only have one operand!");
515
+ return getOpVer(0);
516
+ }
517
+ inline u32_t getOpVerNum() const
518
+ {
519
+ return opVers.size();
520
+ }
521
+ inline OPVers::const_iterator opVerBegin() const
522
+ {
523
+ return opVers.begin();
524
+ }
525
+ inline OPVers::const_iterator opVerEnd() const
526
+ {
527
+ return opVers.end();
528
+ }
529
+ //@}
530
+
531
+ const NodeBS getDefSVFVars() const override;
532
+
533
+ virtual const std::string toString() const override;
534
+ };
535
+
536
+ /*
537
+ * Branch VFGNode including if/else and switch statements
538
+ */
539
+ class BranchVFGNode: public VFGNode
540
+ {
541
+ private:
542
+ BranchVFGNode(); ///< place holder
543
+ BranchVFGNode(const BranchVFGNode &); ///< place holder
544
+ void operator=(const BranchVFGNode &); ///< place holder
545
+ const BranchStmt* brstmt;
546
+ public:
547
+ /// Constructor
548
+ BranchVFGNode(NodeID id, const BranchStmt* r) : VFGNode(id, Branch), brstmt(r) { }
549
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
550
+ //@{
551
+ static inline bool classof(const BranchVFGNode *)
552
+ {
553
+ return true;
554
+ }
555
+ static inline bool classof(const VFGNode *node)
556
+ {
557
+ return node->getNodeKind() == Branch;
558
+ }
559
+ static inline bool classof(const GenericVFGNodeTy *node)
560
+ {
561
+ return node->getNodeKind() == Branch;
562
+ }
563
+ //@}
564
+
565
+ /// Return the branch statement
566
+ const BranchStmt* getBranchStmt() const
567
+ {
568
+ return brstmt;
569
+ }
570
+ /// Successors of this branch statement
571
+ ///@{
572
+ u32_t getNumSuccessors() const
573
+ {
574
+ return brstmt->getNumSuccessors();
575
+ }
576
+ const BranchStmt::SuccAndCondPairVec& getSuccessors() const
577
+ {
578
+ return brstmt->getSuccessors();
579
+ }
580
+ const ICFGNode* getSuccessor (u32_t i) const
581
+ {
582
+ return brstmt->getSuccessor(i);
583
+ }
584
+ ///@}
585
+
586
+ const NodeBS getDefSVFVars() const override;
587
+
588
+ virtual const std::string toString() const override;
589
+ };
590
+
591
+ /*!
592
+ * VFGNode for Gep
593
+ */
594
+ class GepVFGNode: public StmtVFGNode
595
+ {
596
+ private:
597
+ GepVFGNode(); ///< place holder
598
+ GepVFGNode(const GepVFGNode &); ///< place holder
599
+ void operator=(const GepVFGNode &); ///< place holder
600
+
601
+ public:
602
+ /// Constructor
603
+ GepVFGNode(NodeID id,const GepStmt* edge): StmtVFGNode(id,edge,Gep)
604
+ {
605
+
606
+ }
607
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
608
+ //@{
609
+ static inline bool classof(const GepVFGNode *)
610
+ {
611
+ return true;
612
+ }
613
+ static inline bool classof(const StmtVFGNode *node)
614
+ {
615
+ return node->getNodeKind() == Gep;
616
+ }
617
+ static inline bool classof(const VFGNode *node)
618
+ {
619
+ return node->getNodeKind() == Gep;
620
+ }
621
+ static inline bool classof(const GenericVFGNodeTy *node)
622
+ {
623
+ return node->getNodeKind() == Gep;
624
+ }
625
+ //@}
626
+
627
+ const NodeBS getDefSVFVars() const override;
628
+
629
+ const std::string toString() const override;
630
+ };
631
+
632
+ /*
633
+ * ICFG Node stands for a top level pointer ssa phi node or a formal parameter or a return parameter
634
+ */
635
+ class PHIVFGNode : public VFGNode
636
+ {
637
+
638
+ public:
639
+ typedef Map<u32_t,const PAGNode*> OPVers;
640
+ protected:
641
+ const PAGNode* res;
642
+ OPVers opVers;
643
+
644
+ public:
645
+ /// Constructor
646
+ PHIVFGNode(NodeID id, const PAGNode* r,VFGNodeK k = TPhi);
647
+
648
+ /// Whether this phi node is of pointer type (used for pointer analysis).
649
+ inline bool isPTANode() const
650
+ {
651
+ return res->isPointer();
652
+ }
653
+
654
+ /// Operands at a llvm PHINode
655
+ //@{
656
+ inline const PAGNode* getOpVer(u32_t pos) const
657
+ {
658
+ OPVers::const_iterator it = opVers.find(pos);
659
+ assert(it!=opVers.end() && "version is nullptr, did not rename?");
660
+ return it->second;
661
+ }
662
+ inline void setOpVer(u32_t pos, const PAGNode* node)
663
+ {
664
+ opVers[pos] = node;
665
+ }
666
+ inline const PAGNode* getRes() const
667
+ {
668
+ return res;
669
+ }
670
+ inline u32_t getOpVerNum() const
671
+ {
672
+ return opVers.size();
673
+ }
674
+ inline OPVers::const_iterator opVerBegin() const
675
+ {
676
+ return opVers.begin();
677
+ }
678
+ inline OPVers::const_iterator opVerEnd() const
679
+ {
680
+ return opVers.end();
681
+ }
682
+ //@}
683
+
684
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
685
+ //@{
686
+ static inline bool classof(const PHIVFGNode *)
687
+ {
688
+ return true;
689
+ }
690
+ static inline bool classof(const VFGNode *node)
691
+ {
692
+ return (node->getNodeKind() == TPhi || node->getNodeKind() == TIntraPhi || node->getNodeKind() == TInterPhi);
693
+ }
694
+ static inline bool classof(const GenericVFGNodeTy *node)
695
+ {
696
+ return (node->getNodeKind() == TPhi || node->getNodeKind() == TIntraPhi || node->getNodeKind() == TInterPhi);
697
+ }
698
+ //@}
699
+
700
+ const NodeBS getDefSVFVars() const override;
701
+
702
+ const SVFValue* getValue() const override;
703
+ const std::string toString() const override;
704
+ };
705
+
706
+
707
+ /*
708
+ * Intra LLVM PHI Node
709
+ */
710
+ class IntraPHIVFGNode : public PHIVFGNode
711
+ {
712
+
713
+ public:
714
+ typedef Map<u32_t,const ICFGNode*> OPIncomingBBs;
715
+
716
+ private:
717
+ OPIncomingBBs opIncomingBBs;
718
+ public:
719
+ /// Constructor
720
+ IntraPHIVFGNode(NodeID id, const PAGNode* r): PHIVFGNode(id, r, TIntraPhi)
721
+ {
722
+ }
723
+
724
+ inline const ICFGNode* getOpIncomingBB(u32_t pos) const
725
+ {
726
+ OPIncomingBBs::const_iterator it = opIncomingBBs.find(pos);
727
+ assert(it!=opIncomingBBs.end() && "version is nullptr, did not rename?");
728
+ return it->second;
729
+ }
730
+ inline void setOpVerAndBB(u32_t pos, const PAGNode* node, const ICFGNode* bb)
731
+ {
732
+ opVers[pos] = node;
733
+ opIncomingBBs[pos] = bb;
734
+ }
735
+
736
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
737
+ //@{
738
+ static inline bool classof(const IntraPHIVFGNode*)
739
+ {
740
+ return true;
741
+ }
742
+ static inline bool classof(const PHIVFGNode *node)
743
+ {
744
+ return node->getNodeKind() == TIntraPhi;
745
+ }
746
+ static inline bool classof(const VFGNode *node)
747
+ {
748
+ return node->getNodeKind() == TIntraPhi;
749
+ }
750
+ static inline bool classof(const GenericVFGNodeTy *node)
751
+ {
752
+ return node->getNodeKind() == TIntraPhi;
753
+ }
754
+ //@}
755
+
756
+ const std::string toString() const override;
757
+ };
758
+
759
+
760
+ class AddrVFGNode: public StmtVFGNode
761
+ {
762
+ private:
763
+ AddrVFGNode(); ///< place holder
764
+ AddrVFGNode(const AddrVFGNode &); ///< place holder
765
+ void operator=(const AddrVFGNode &); ///< place holder
766
+
767
+ public:
768
+ /// Constructor
769
+ AddrVFGNode(NodeID id, const AddrStmt* edge): StmtVFGNode(id, edge,Addr)
770
+ {
771
+
772
+ }
773
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
774
+ //@{
775
+ static inline bool classof(const AddrVFGNode *)
776
+ {
777
+ return true;
778
+ }
779
+ static inline bool classof(const StmtVFGNode *node)
780
+ {
781
+ return node->getNodeKind() == Addr;
782
+ }
783
+ static inline bool classof(const VFGNode *node)
784
+ {
785
+ return node->getNodeKind() == Addr;
786
+ }
787
+ static inline bool classof(const GenericVFGNodeTy *node)
788
+ {
789
+ return node->getNodeKind() == Addr;
790
+ }
791
+ //@}
792
+
793
+ const NodeBS getDefSVFVars() const override;
794
+
795
+ const std::string toString() const override;
796
+ };
797
+
798
+
799
+ class ArgumentVFGNode : public VFGNode
800
+ {
801
+
802
+ protected:
803
+ const PAGNode* param;
804
+
805
+ public:
806
+ /// Constructor
807
+ ArgumentVFGNode(NodeID id, const PAGNode* p, VFGNodeK k): VFGNode(id,k), param(p)
808
+ {
809
+ }
810
+
811
+ /// Whether this argument node is of pointer type (used for pointer analysis).
812
+ inline bool isPTANode() const
813
+ {
814
+ return param->isPointer();
815
+ }
816
+
817
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
818
+ //@{
819
+ static inline bool classof(const ArgumentVFGNode *)
820
+ {
821
+ return true;
822
+ }
823
+ static inline bool classof(const VFGNode *node)
824
+ {
825
+ return node->getNodeKind() == FRet
826
+ || node->getNodeKind() == ARet
827
+ || node->getNodeKind() == AParm
828
+ || node->getNodeKind() == FParm;
829
+ }
830
+ static inline bool classof(const GenericVFGNodeTy *node)
831
+ {
832
+ return node->getNodeKind() == FRet
833
+ || node->getNodeKind() == ARet
834
+ || node->getNodeKind() == AParm
835
+ || node->getNodeKind() == FParm;
836
+ }
837
+ //@}
838
+
839
+ const SVFValue* getValue() const override;
840
+ const std::string toString() const override;
841
+ };
842
+
843
+ /*
844
+ * ICFG Node stands for acutal parameter node (top level pointers)
845
+ */
846
+ class ActualParmVFGNode : public ArgumentVFGNode
847
+ {
848
+ private:
849
+ const CallICFGNode* cs;
850
+ public:
851
+ /// Constructor
852
+ ActualParmVFGNode(NodeID id, const PAGNode* n, const CallICFGNode* c) :
853
+ ArgumentVFGNode(id, n, AParm), cs(c)
854
+ {
855
+ }
856
+
857
+ /// Return callsite
858
+ inline const CallICFGNode* getCallSite() const
859
+ {
860
+ return cs;
861
+ }
862
+
863
+ /// Return parameter
864
+ inline const PAGNode* getParam() const
865
+ {
866
+ return param;
867
+ }
868
+
869
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
870
+ //@{
871
+ static inline bool classof(const ActualParmVFGNode *)
872
+ {
873
+ return true;
874
+ }
875
+ static inline bool classof(const ArgumentVFGNode *node)
876
+ {
877
+ return node->getNodeKind() == AParm;
878
+ }
879
+ static inline bool classof(const VFGNode *node)
880
+ {
881
+ return node->getNodeKind() == AParm;
882
+ }
883
+ static inline bool classof(const GenericVFGNodeTy *node)
884
+ {
885
+ return node->getNodeKind() == AParm;
886
+ }
887
+ //@}
888
+
889
+ const NodeBS getDefSVFVars() const override;
890
+
891
+ const std::string toString() const override;
892
+ };
893
+
894
+
895
+ /*
896
+ * ICFG Node stands for formal parameter node (top level pointers)
897
+ */
898
+ class FormalParmVFGNode : public ArgumentVFGNode
899
+ {
900
+ private:
901
+ const SVFFunction* fun;
902
+ CallPESet callPEs;
903
+
904
+ public:
905
+ /// Constructor
906
+ FormalParmVFGNode(NodeID id, const PAGNode* n, const SVFFunction* f):
907
+ ArgumentVFGNode(id, n, FParm), fun(f)
908
+ {
909
+ }
910
+
911
+ /// Return parameter
912
+ inline const PAGNode* getParam() const
913
+ {
914
+ return param;
915
+ }
916
+
917
+ /// Return function
918
+ inline const SVFFunction* getFun() const override
919
+ {
920
+ return fun;
921
+ }
922
+ /// Return call edge
923
+ inline void addCallPE(const CallPE* call)
924
+ {
925
+ callPEs.insert(call);
926
+ }
927
+ /// Call edge iterator
928
+ ///@{
929
+ inline CallPESet::const_iterator callPEBegin() const
930
+ {
931
+ return callPEs.begin();
932
+ }
933
+ inline CallPESet::const_iterator callPEEnd() const
934
+ {
935
+ return callPEs.end();
936
+ }
937
+ //@}
938
+
939
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
940
+ //@{
941
+ static inline bool classof(const FormalParmVFGNode *)
942
+ {
943
+ return true;
944
+ }
945
+ static inline bool classof(const VFGNode *node)
946
+ {
947
+ return node->getNodeKind() == FParm;
948
+ }
949
+ static inline bool classof(const ArgumentVFGNode *node)
950
+ {
951
+ return node->getNodeKind() == FParm;
952
+ }
953
+ static inline bool classof(const GenericVFGNodeTy *node)
954
+ {
955
+ return node->getNodeKind() == FParm;
956
+ }
957
+ //@}
958
+
959
+ const NodeBS getDefSVFVars() const override;
960
+
961
+ const std::string toString() const override;
962
+ };
963
+
964
+ /*!
965
+ * Callsite receive paramter
966
+ */
967
+ class ActualRetVFGNode: public ArgumentVFGNode
968
+ {
969
+ private:
970
+ const CallICFGNode* cs;
971
+
972
+ ActualRetVFGNode(); ///< place holder
973
+ ActualRetVFGNode(const ActualRetVFGNode &); ///< place holder
974
+ void operator=(const ActualRetVFGNode &); ///< place holder
975
+
976
+ public:
977
+ /// Constructor
978
+ ActualRetVFGNode(NodeID id, const PAGNode* n, const CallICFGNode* c) :
979
+ ArgumentVFGNode(id, n, ARet), cs(c)
980
+ {
981
+ }
982
+ /// Return callsite
983
+ inline const CallICFGNode* getCallSite() const
984
+ {
985
+ return cs;
986
+ }
987
+ /// Receive parameter at callsite
988
+ inline const SVFFunction* getCaller() const
989
+ {
990
+ return cs->getCaller();
991
+ }
992
+ /// Receive parameter at callsite
993
+ inline const PAGNode* getRev() const
994
+ {
995
+ return param;
996
+ }
997
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
998
+ //@{
999
+ static inline bool classof(const ActualRetVFGNode *)
1000
+ {
1001
+ return true;
1002
+ }
1003
+ static inline bool classof(const ArgumentVFGNode *node)
1004
+ {
1005
+ return node->getNodeKind() == ARet;
1006
+ }
1007
+ static inline bool classof(const VFGNode *node)
1008
+ {
1009
+ return node->getNodeKind() == ARet;
1010
+ }
1011
+ static inline bool classof(const GenericVFGNodeTy *node)
1012
+ {
1013
+ return node->getNodeKind() == ARet;
1014
+ }
1015
+ //@}
1016
+
1017
+ const NodeBS getDefSVFVars() const override;
1018
+
1019
+ const std::string toString() const override;
1020
+ };
1021
+
1022
+ /*!
1023
+ * Callee return ICFG node
1024
+ */
1025
+ class FormalRetVFGNode: public ArgumentVFGNode
1026
+ {
1027
+ private:
1028
+ const SVFFunction* fun;
1029
+ RetPESet retPEs;
1030
+
1031
+ FormalRetVFGNode(); ///< place holder
1032
+ FormalRetVFGNode(const FormalRetVFGNode &); ///< place holder
1033
+ void operator=(const FormalRetVFGNode &); ///< place holder
1034
+
1035
+ public:
1036
+ /// Constructor
1037
+ FormalRetVFGNode(NodeID id, const PAGNode* n, const SVFFunction* f);
1038
+
1039
+ /// Return value at callee
1040
+ inline const PAGNode* getRet() const
1041
+ {
1042
+ return param;
1043
+ }
1044
+ /// Function
1045
+ inline const SVFFunction* getFun() const override
1046
+ {
1047
+ return fun;
1048
+ }
1049
+ /// RetPE
1050
+ inline void addRetPE(const RetPE* retPE)
1051
+ {
1052
+ retPEs.insert(retPE);
1053
+ }
1054
+ /// RetPE iterators
1055
+ inline RetPESet::const_iterator retPEBegin() const
1056
+ {
1057
+ return retPEs.begin();
1058
+ }
1059
+ inline RetPESet::const_iterator retPEEnd() const
1060
+ {
1061
+ return retPEs.end();
1062
+ }
1063
+ ///Methods for support type inquiry through isa, cast, and dyn_cast:
1064
+ //@{
1065
+ static inline bool classof(const FormalRetVFGNode )
1066
+ {
1067
+ return true;
1068
+ }
1069
+ static inline bool classof(const VFGNode *node)
1070
+ {
1071
+ return node->getNodeKind() == FRet;
1072
+ }
1073
+ static inline bool classof(const ArgumentVFGNode *node)
1074
+ {
1075
+ return node->getNodeKind() == FRet;
1076
+ }
1077
+ static inline bool classof(const GenericVFGNodeTy *node)
1078
+ {
1079
+ return node->getNodeKind() == FRet;
1080
+ }
1081
+ //@}
1082
+
1083
+ const NodeBS getDefSVFVars() const override;
1084
+
1085
+ const std::string toString() const override;
1086
+ };
1087
+
1088
+ /*
1089
+ * Inter LLVM PHI node (formal parameter)
1090
+ */
1091
+ class InterPHIVFGNode : public PHIVFGNode
1092
+ {
1093
+
1094
+ public:
1095
+ /// Constructor interPHI for formal parameter
1096
+ InterPHIVFGNode(NodeID id, const FormalParmVFGNode* fp) : PHIVFGNode(id, fp->getParam(), TInterPhi),fun(fp->getFun()),callInst(nullptr) {}
1097
+ /// Constructor interPHI for actual return
1098
+ InterPHIVFGNode(NodeID id, const ActualRetVFGNode* ar) : PHIVFGNode(id, ar->getRev(), TInterPhi), fun(ar->getCaller()),callInst(ar->getCallSite()) {}
1099
+
1100
+ inline bool isFormalParmPHI() const
1101
+ {
1102
+ return (fun!=nullptr) && (callInst == nullptr);
1103
+ }
1104
+
1105
+ inline bool isActualRetPHI() const
1106
+ {
1107
+ return (fun!=nullptr) && (callInst != nullptr);
1108
+ }
1109
+
1110
+ inline const SVFFunction* getFun() const override
1111
+ {
1112
+ assert((isFormalParmPHI() || isActualRetPHI()) && "expect a formal parameter phi");
1113
+ return fun;
1114
+ }
1115
+
1116
+ inline const CallICFGNode* getCallSite() const
1117
+ {
1118
+ assert(isActualRetPHI() && "expect a actual return phi");
1119
+ return callInst;
1120
+ }
1121
+
1122
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
1123
+ //@{
1124
+ static inline bool classof(const InterPHIVFGNode*)
1125
+ {
1126
+ return true;
1127
+ }
1128
+ static inline bool classof(const PHIVFGNode *node)
1129
+ {
1130
+ return node->getNodeKind() == TInterPhi;
1131
+ }
1132
+ static inline bool classof(const VFGNode *node)
1133
+ {
1134
+ return node->getNodeKind() == TInterPhi;
1135
+ }
1136
+ static inline bool classof(const GenericVFGNodeTy *node)
1137
+ {
1138
+ return node->getNodeKind() == TInterPhi;
1139
+ }
1140
+ //@}
1141
+
1142
+ const std::string toString() const override;
1143
+
1144
+ private:
1145
+ const SVFFunction* fun;
1146
+ const CallICFGNode* callInst;
1147
+ };
1148
+
1149
+
1150
+
1151
+ /*!
1152
+ * Dummy Definition for undef and null pointers
1153
+ */
1154
+ class NullPtrVFGNode : public VFGNode
1155
+ {
1156
+ private:
1157
+ const PAGNode* node;
1158
+ public:
1159
+ /// Constructor
1160
+ NullPtrVFGNode(NodeID id, const PAGNode* n) : VFGNode(id,NPtr), node(n)
1161
+ {
1162
+
1163
+ }
1164
+ /// Whether this node is of pointer type (used for pointer analysis).
1165
+ inline bool isPTANode() const
1166
+ {
1167
+ return node->isPointer();
1168
+ }
1169
+ /// Return corresponding PAGNode
1170
+ const PAGNode* getPAGNode() const
1171
+ {
1172
+ return node;
1173
+ }
1174
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
1175
+ //@{
1176
+ static inline bool classof(const NullPtrVFGNode *)
1177
+ {
1178
+ return true;
1179
+ }
1180
+ static inline bool classof(const VFGNode *node)
1181
+ {
1182
+ return node->getNodeKind() == NPtr;
1183
+ }
1184
+ static inline bool classof(const GenericVFGNodeTy *node)
1185
+ {
1186
+ return node->getNodeKind() == NPtr;
1187
+ }
1188
+ //@}
1189
+
1190
+ const NodeBS getDefSVFVars() const override;
1191
+
1192
+ const std::string toString() const override;
1193
+ };
1194
+
1195
+ } // End namespace SVF
1196
+
1197
+ #endif /* INCLUDE_UTIL_VFGNODE_H_ */