svf-lib 1.0.765 → 1.0.769

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.
@@ -45,6 +45,9 @@ class SVFVar;
45
45
  typedef GenericNode<SVFVar,SVFStmt> GenericPAGNodeTy;
46
46
  class SVFVar : public GenericPAGNodeTy
47
47
  {
48
+ friend class IRGraph;
49
+ friend class SVFIR;
50
+ friend class VFG;
48
51
 
49
52
  public:
50
53
  /// Nine kinds of SVFIR variables
@@ -162,13 +165,11 @@ public:
162
165
  {
163
166
  return InEdgeKindToSetMap[kind];
164
167
  }
165
-
166
168
  /// Get outgoing SVFIR statements (edges)
167
169
  inline SVFStmt::SVFStmtSetTy& getOutgoingEdges(SVFStmt::PEDGEK kind)
168
170
  {
169
171
  return OutEdgeKindToSetMap[kind];
170
172
  }
171
-
172
173
  /// Has incoming SVFIR statements (edges)
173
174
  inline bool hasIncomingEdges(SVFStmt::PEDGEK kind) const
174
175
  {
@@ -178,18 +179,16 @@ public:
178
179
  else
179
180
  return false;
180
181
  }
181
-
182
- /// Has incoming VariantGepEdges
183
- inline bool hasIncomingVariantGepEdge() const
182
+ /// Has outgoing SVFIR statements (edges)
183
+ inline bool hasOutgoingEdges(SVFStmt::PEDGEK kind) const
184
184
  {
185
- SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(SVFStmt::VariantGep);
186
- if (it != InEdgeKindToSetMap.end())
187
- {
185
+ SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
186
+ if (it != OutEdgeKindToSetMap.end())
188
187
  return (!it->second.empty());
189
- }
190
- return false;
188
+ else
189
+ return false;
191
190
  }
192
-
191
+
193
192
  /// Get incoming SVFStmt iterator
194
193
  inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const
195
194
  {
@@ -206,16 +205,6 @@ public:
206
205
  return it->second.end();
207
206
  }
208
207
 
209
- /// Has outgoing SVFIR statements (edges)
210
- inline bool hasOutgoingEdges(SVFStmt::PEDGEK kind) const
211
- {
212
- SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
213
- if (it != OutEdgeKindToSetMap.end())
214
- return (!it->second.empty());
215
- else
216
- return false;
217
- }
218
-
219
208
  /// Get outgoing SVFStmt iterator
220
209
  inline SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesBegin(SVFStmt::PEDGEK kind) const
221
210
  {
@@ -233,6 +222,7 @@ public:
233
222
  }
234
223
  //@}
235
224
 
225
+ private:
236
226
  /// add methods of the components
237
227
  //@{
238
228
  inline void addInEdge(SVFStmt* inEdge)
@@ -248,7 +238,18 @@ public:
248
238
  OutEdgeKindToSetMap[kind].insert(outEdge);
249
239
  addOutgoingEdge(outEdge);
250
240
  }
241
+ /// Has incoming VariantGepEdges
242
+ inline bool hasIncomingVariantGepEdge() const
243
+ {
244
+ SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(SVFStmt::VariantGep);
245
+ if (it != InEdgeKindToSetMap.end())
246
+ {
247
+ return (!it->second.empty());
248
+ }
249
+ return false;
250
+ }
251
251
 
252
+ public:
252
253
  virtual const std::string toString() const;
253
254
 
254
255
  /// Dump to console for debugging
Binary file
@@ -291,7 +291,7 @@ public:
291
291
  inline bool isZeroOffsettedGepCGEdge(ConstraintEdge *edge) const
292
292
  {
293
293
  if (NormalGepCGEdge *normalGepCGEdge = SVFUtil::dyn_cast<NormalGepCGEdge>(edge))
294
- if (0 == normalGepCGEdge->getOffset())
294
+ if (0 == normalGepCGEdge->getFieldOffset())
295
295
  return true;
296
296
  return false;
297
297
  }
@@ -304,9 +304,9 @@ public:
304
304
  }
305
305
 
306
306
  /// Get location set of the gep edge
307
- inline Size_t getOffset() const
307
+ inline Size_t getFieldOffset() const
308
308
  {
309
- return ls.accumulateConstantOffset();
309
+ return ls.accumulateConstantFieldIdx();
310
310
  }
311
311
  };
312
312
 
@@ -487,28 +487,28 @@ protected:
487
487
  {
488
488
  AddrVFGNode* sNode = new AddrVFGNode(totalVFGNode++,addr);
489
489
  addStmtVFGNode(sNode, addr);
490
- setDef(addr->getDstNode(),sNode);
490
+ setDef(addr->getLHSVar(),sNode);
491
491
  }
492
492
  /// Add a Copy VFG node
493
493
  inline void addCopyVFGNode(const CopyStmt* copy)
494
494
  {
495
495
  CopyVFGNode* sNode = new CopyVFGNode(totalVFGNode++,copy);
496
496
  addStmtVFGNode(sNode, copy);
497
- setDef(copy->getDstNode(),sNode);
497
+ setDef(copy->getLHSVar(),sNode);
498
498
  }
499
499
  /// Add a Gep VFG node
500
500
  inline void addGepVFGNode(const GepStmt* gep)
501
501
  {
502
502
  GepVFGNode* sNode = new GepVFGNode(totalVFGNode++,gep);
503
503
  addStmtVFGNode(sNode, gep);
504
- setDef(gep->getDstNode(),sNode);
504
+ setDef(gep->getLHSVar(),sNode);
505
505
  }
506
506
  /// Add a Load VFG node
507
507
  void addLoadVFGNode(const LoadStmt* load)
508
508
  {
509
509
  LoadVFGNode* sNode = new LoadVFGNode(totalVFGNode++,load);
510
510
  addStmtVFGNode(sNode, load);
511
- setDef(load->getDstNode(),sNode);
511
+ setDef(load->getLHSVar(),sNode);
512
512
  }
513
513
  /// Add a Store VFG node,
514
514
  /// To be noted store does not create a new pointer, we do not set def for any SVFIR node
@@ -104,7 +104,7 @@ public:
104
104
  inline LocationSet operator+ (const LocationSet& rhs) const
105
105
  {
106
106
  LocationSet ls(rhs);
107
- ls.fldIdx += accumulateConstantOffset();
107
+ ls.fldIdx += accumulateConstantFieldIdx();
108
108
  OffsetValueVec::const_iterator it = getOffsetValueVec().begin();
109
109
  OffsetValueVec::const_iterator eit = getOffsetValueVec().end();
110
110
  for (; it != eit; ++it)
@@ -151,7 +151,7 @@ public:
151
151
 
152
152
  /// Get methods
153
153
  //@{
154
- inline Size_t accumulateConstantOffset() const
154
+ inline Size_t accumulateConstantFieldIdx() const
155
155
  {
156
156
  return fldIdx;
157
157
  }
@@ -203,7 +203,7 @@ template <> struct std::hash<SVF::LocationSet> {
203
203
  size_t operator()(const SVF::LocationSet &ls) const {
204
204
  SVF::Hash<std::pair<SVF::NodeID, SVF::NodeID>> h;
205
205
  std::hash<SVF::LocationSet::OffsetValueVec> v;
206
- return h(std::make_pair(ls.accumulateConstantOffset(), v(ls.getOffsetValueVec())));
206
+ return h(std::make_pair(ls.accumulateConstantFieldIdx(), v(ls.getOffsetValueVec())));
207
207
  }
208
208
  };
209
209
 
@@ -651,7 +651,7 @@ private:
651
651
  /// Add Offset(Gep) edge
652
652
  NormalGepStmt* addNormalGepStmt(NodeID src, NodeID dst, const LocationSet& ls);
653
653
  /// Add Variant(Gep) edge
654
- VariantGepStmt* addVariantGepStmt(NodeID src, NodeID dst);
654
+ VariantGepStmt* addVariantGepStmt(NodeID src, NodeID dst, const LocationSet& ls);
655
655
  /// Add Thread fork edge for parameter passing
656
656
  TDForkPE* addThreadForkPE(NodeID src, NodeID dst, const CallBlockNode* cs);
657
657
  /// Add Thread join edge for parameter passing