svf-tools 1.0.677 → 1.0.679

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.677",
3
+ "version": "1.0.679",
4
4
  "description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -61,7 +61,8 @@ public:
61
61
  virtual const VFunSet &getCSVFsBasedonCHA(CallSite cs) = 0;
62
62
  virtual bool csHasVtblsBasedonCHA(CallSite cs) = 0;
63
63
  virtual const VTableSet &getCSVtblsBasedonCHA(CallSite cs) = 0;
64
- virtual void getVFnsFromVtbls(CallSite cs, const VTableSet &vtbls, VFunSet &virtualFunctions) = 0;
64
+ virtual void getVFnsFromVtbls(CallSite cs, const VTableSet& vtbls,
65
+ VFunSet& virtualFunctions) = 0;
65
66
 
66
67
  CHGKind getKind(void) const
67
68
  {
@@ -76,17 +77,19 @@ protected:
76
77
  typedef GenericEdge<CHNode> GenericCHEdgeTy;
77
78
  class CHEdge: public GenericCHEdgeTy
78
79
  {
80
+ friend class SVFIRWriter;
81
+
79
82
  public:
80
83
  typedef enum
81
84
  {
82
85
  INHERITANCE = 0x1, // inheritance relation
83
- INSTANTCE = 0x2 // template-instance relation
86
+ INSTANTCE = 0x2 // template-instance relation
84
87
  } CHEDGETYPE;
85
88
 
86
- typedef GenericNode<CHNode,CHEdge>::GEdgeSetTy CHEdgeSetTy;
89
+ typedef GenericNode<CHNode, CHEdge>::GEdgeSetTy CHEdgeSetTy;
87
90
 
88
- CHEdge(CHNode *s, CHNode *d, CHEDGETYPE et, GEdgeFlag k = 0):
89
- GenericCHEdgeTy(s,d,k)
91
+ CHEdge(CHNode* s, CHNode* d, CHEDGETYPE et, GEdgeFlag k = 0)
92
+ : GenericCHEdgeTy(s, d, k)
90
93
  {
91
94
  edgeType = et;
92
95
  }
@@ -100,9 +103,11 @@ private:
100
103
  CHEDGETYPE edgeType;
101
104
  };
102
105
 
103
- typedef GenericNode<CHNode,CHEdge> GenericCHNodeTy;
106
+ typedef GenericNode<CHNode, CHEdge> GenericCHNodeTy;
104
107
  class CHNode: public GenericCHNodeTy
105
108
  {
109
+ friend class SVFIRWriter;
110
+
106
111
  public:
107
112
  typedef enum
108
113
  {
@@ -204,9 +209,10 @@ private:
204
209
  };
205
210
 
206
211
  /// class hierarchy graph
207
- typedef GenericGraph<CHNode,CHEdge> GenericCHGraphTy;
212
+ typedef GenericGraph<CHNode, CHEdge> GenericCHGraphTy;
208
213
  class CHGraph: public CommonCHGraph, public GenericCHGraphTy
209
214
  {
215
+ friend class SVFIRWriter;
210
216
  friend class CHGBuilder;
211
217
 
212
218
  public:
@@ -311,7 +317,7 @@ private:
311
317
  u32_t classNum;
312
318
  u32_t vfID;
313
319
  double buildingCHGTime;
314
- Map<std::string, CHNode *> classNameToNodeMap;
320
+ Map<std::string, CHNode*> classNameToNodeMap;
315
321
  NameToCHNodesMap classNameToDescendantsMap;
316
322
  NameToCHNodesMap classNameToAncestorsMap;
317
323
  NameToCHNodesMap classNameToInstAndDescsMap;
@@ -331,19 +337,26 @@ namespace SVF
331
337
  * GenericGraphTraits specializations for generic graph algorithms.
332
338
  * Provide graph traits for traversing from a constraint node using standard graph traversals.
333
339
  */
334
- template<> struct GenericGraphTraits<SVF::CHNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::CHNode,SVF::CHEdge>* >
340
+ template <>
341
+ struct GenericGraphTraits<SVF::CHNode*>
342
+ : public GenericGraphTraits<SVF::GenericNode<SVF::CHNode, SVF::CHEdge>*>
335
343
  {
336
344
  };
337
345
 
338
- /// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
339
- template<>
340
- struct GenericGraphTraits<Inverse<SVF::CHNode*> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::CHNode,SVF::CHEdge>* > >
346
+ /// Inverse GenericGraphTraits specializations for call graph node, it is used
347
+ /// for inverse traversal.
348
+ template <>
349
+ struct GenericGraphTraits<Inverse<SVF::CHNode*>>
350
+ : public GenericGraphTraits<
351
+ Inverse<SVF::GenericNode<SVF::CHNode, SVF::CHEdge>*>>
341
352
  {
342
353
  };
343
354
 
344
- template<> struct GenericGraphTraits<SVF::CHGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::CHNode,SVF::CHEdge>* >
355
+ template <>
356
+ struct GenericGraphTraits<SVF::CHGraph*>
357
+ : public GenericGraphTraits<SVF::GenericGraph<SVF::CHNode, SVF::CHEdge>*>
345
358
  {
346
- typedef SVF::CHNode *NodeRef;
359
+ typedef SVF::CHNode* NodeRef;
347
360
  };
348
361
 
349
362
  } // End namespace llvm
@@ -36,6 +36,10 @@
36
36
 
37
37
  namespace SVF
38
38
  {
39
+ /// Forward declaration of some friend classes
40
+ ///@{
41
+ template <typename, typename> class GenericGraphWriter;
42
+ ///@}
39
43
 
40
44
  /*!
41
45
  * Generic edge on the graph as base class
@@ -43,6 +47,7 @@ namespace SVF
43
47
  template<class NodeTy>
44
48
  class GenericEdge
45
49
  {
50
+ friend class SVFIRWriter;
46
51
 
47
52
  public:
48
53
  /// Node type
@@ -133,6 +138,7 @@ protected:
133
138
  template<class NodeTy,class EdgeTy>
134
139
  class GenericNode
135
140
  {
141
+ friend class SVFIRWriter;
136
142
 
137
143
  public:
138
144
  typedef NodeTy NodeType;
@@ -331,9 +337,11 @@ public:
331
337
  * Generic graph for program representation
332
338
  * It is base class and needs to be instantiated
333
339
  */
334
- template<class NodeTy,class EdgeTy>
340
+ template<class NodeTy, class EdgeTy>
335
341
  class GenericGraph
336
342
  {
343
+ friend class SVFIRWriter;
344
+ friend class GenericGraphWriter<NodeTy, EdgeTy>;
337
345
 
338
346
  public:
339
347
  typedef NodeTy NodeType;
@@ -348,9 +356,7 @@ public:
348
356
  //@}
349
357
 
350
358
  /// Constructor
351
- GenericGraph(): edgeNum(0),nodeNum(0)
352
- {
353
- }
359
+ GenericGraph() : edgeNum(0), nodeNum(0) {}
354
360
 
355
361
  /// Destructor
356
362
  virtual ~GenericGraph()
@@ -46,8 +46,8 @@ class PTACallGraph;
46
46
  typedef GenericGraph<ICFGNode,ICFGEdge> GenericICFGTy;
47
47
  class ICFG : public GenericICFGTy
48
48
  {
49
-
50
49
  friend class ICFGBuilder;
50
+ friend class SVFIRWriter;
51
51
 
52
52
  public:
53
53
 
@@ -141,6 +141,11 @@ public:
141
141
  return it->second;
142
142
  }
143
143
 
144
+ inline const ICFGNodeToSVFLoopVec& getIcfgNodeToSVFLoopVec() const
145
+ {
146
+ return icfgNodeToSVFLoopVec;
147
+ }
148
+
144
149
  protected:
145
150
  /// Remove a SVFG edge
146
151
  inline void removeICFGEdge(ICFGEdge* edge)
@@ -43,6 +43,7 @@ class RetPE;
43
43
  typedef GenericEdge<ICFGNode> GenericICFGEdgeTy;
44
44
  class ICFGEdge : public GenericICFGEdgeTy
45
45
  {
46
+ friend class SVFIRWriter;
46
47
 
47
48
  public:
48
49
  /// ten types of ICFG edge
@@ -59,19 +60,18 @@ public:
59
60
 
60
61
  public:
61
62
  /// Constructor
62
- ICFGEdge(ICFGNode* s, ICFGNode* d, GEdgeFlag k) : GenericICFGEdgeTy(s,d,k)
63
+ ICFGEdge(ICFGNode* s, ICFGNode* d, GEdgeFlag k) : GenericICFGEdgeTy(s, d, k)
63
64
  {
64
65
  }
65
66
  /// Destructor
66
- ~ICFGEdge()
67
- {
68
- }
67
+ ~ICFGEdge() {}
69
68
 
70
69
  /// Get methods of the components
71
70
  //@{
72
71
  inline bool isCFGEdge() const
73
72
  {
74
- return getEdgeKind() == IntraCF || getEdgeKind() == CallCF || getEdgeKind() == RetCF;
73
+ return getEdgeKind() == IntraCF || getEdgeKind() == CallCF ||
74
+ getEdgeKind() == RetCF;
75
75
  }
76
76
  inline bool isCallCFGEdge() const
77
77
  {
@@ -86,7 +86,7 @@ public:
86
86
  return getEdgeKind() == IntraCF;
87
87
  }
88
88
  //@}
89
- typedef GenericNode<ICFGNode,ICFGEdge>::GEdgeSetTy ICFGEdgeSetTy;
89
+ typedef GenericNode<ICFGNode, ICFGEdge>::GEdgeSetTy ICFGEdgeSetTy;
90
90
  typedef ICFGEdgeSetTy SVFGEdgeSetTy;
91
91
  /// Compute the unique edgeFlag value from edge kind and CallSiteID.
92
92
  static inline GEdgeFlag makeEdgeFlagWithInvokeID(GEdgeKind k, CallSiteID cs)
@@ -96,7 +96,7 @@ public:
96
96
 
97
97
  /// Overloading operator << for dumping ICFG node ID
98
98
  //@{
99
- friend OutStream& operator<< (OutStream &o, const ICFGEdge &edge)
99
+ friend OutStream& operator<<(OutStream& o, const ICFGEdge& edge)
100
100
  {
101
101
  o << edge.toString();
102
102
  return o;
@@ -106,29 +106,30 @@ public:
106
106
  virtual const std::string toString() const;
107
107
  };
108
108
 
109
-
110
109
  /*!
111
110
  * Intra ICFG edge representing control-flows between basic blocks within a function
112
111
  */
113
112
  class IntraCFGEdge : public ICFGEdge
114
113
  {
114
+ friend class SVFIRWriter;
115
115
 
116
116
  public:
117
117
  /// Constructor
118
- IntraCFGEdge(ICFGNode* s, ICFGNode* d): ICFGEdge(s,d,IntraCF), conditionVar(nullptr), branchCondVal(0)
118
+ IntraCFGEdge(ICFGNode* s, ICFGNode* d)
119
+ : ICFGEdge(s, d, IntraCF), conditionVar(nullptr), branchCondVal(0)
119
120
  {
120
121
  }
121
122
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
122
123
  //@{
123
- static inline bool classof(const IntraCFGEdge *)
124
+ static inline bool classof(const IntraCFGEdge*)
124
125
  {
125
126
  return true;
126
127
  }
127
- static inline bool classof(const ICFGEdge *edge)
128
+ static inline bool classof(const ICFGEdge* edge)
128
129
  {
129
130
  return edge->getEdgeKind() == IntraCF;
130
131
  }
131
- static inline bool classof(const GenericICFGEdgeTy *edge)
132
+ static inline bool classof(const GenericICFGEdgeTy* edge)
132
133
  {
133
134
  return edge->getEdgeKind() == IntraCF;
134
135
  }
@@ -154,10 +155,15 @@ public:
154
155
  virtual const std::string toString() const;
155
156
 
156
157
  private:
157
- /// conditionVar is a boolean (for if/else) or numeric condition variable (for switch)
158
- /// branchCondVal is the value when this condition should hold to execute this CFGEdge.
159
- /// e.g., Inst1: br %cmp label 0, label 1, Inst2 is label 0 and Inst 3 is label 1;
160
- /// for edge between Inst1 and Inst 2, the first element is %cmp and second element is 0
158
+ /// conditionVar is a boolean (for if/else) or numeric condition variable
159
+ /// (for switch).
160
+ /// branchCondVal is the value when this condition should hold to execute
161
+ /// this CFGEdge.
162
+ /// E.g., Inst1: br %cmp label 0, label 1,
163
+ /// Inst2: label 0
164
+ /// Inst3: label 1;
165
+ /// for edge between Inst1 and Inst 2, the first element is %cmp and
166
+ /// the second element is 0
161
167
  const SVFValue* conditionVar;
162
168
  s64_t branchCondVal;
163
169
  };
@@ -167,18 +173,20 @@ private:
167
173
  */
168
174
  class CallCFGEdge : public ICFGEdge
169
175
  {
176
+ friend class SVFIRWriter;
170
177
 
171
178
  private:
172
- const SVFInstruction* cs;
179
+ const SVFInstruction* cs;
173
180
  std::vector<const CallPE*> callPEs;
181
+
174
182
  public:
175
183
  /// Constructor
176
- CallCFGEdge(ICFGNode* s, ICFGNode* d, const SVFInstruction* c):
177
- ICFGEdge(s,d,CallCF),cs(c)
184
+ CallCFGEdge(ICFGNode* s, ICFGNode* d, const SVFInstruction* c)
185
+ : ICFGEdge(s, d, CallCF), cs(c)
178
186
  {
179
187
  }
180
188
  /// Return callsite ID
181
- inline const SVFInstruction* getCallSite() const
189
+ inline const SVFInstruction* getCallSite() const
182
190
  {
183
191
  return cs;
184
192
  }
@@ -194,15 +202,15 @@ public:
194
202
  }
195
203
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
196
204
  //@{
197
- static inline bool classof(const CallCFGEdge *)
205
+ static inline bool classof(const CallCFGEdge*)
198
206
  {
199
207
  return true;
200
208
  }
201
- static inline bool classof(const ICFGEdge *edge)
209
+ static inline bool classof(const ICFGEdge* edge)
202
210
  {
203
211
  return edge->getEdgeKind() == CallCF;
204
212
  }
205
- static inline bool classof(const GenericICFGEdgeTy *edge)
213
+ static inline bool classof(const GenericICFGEdgeTy* edge)
206
214
  {
207
215
  return edge->getEdgeKind() == CallCF;
208
216
  }
@@ -215,25 +223,27 @@ public:
215
223
  */
216
224
  class RetCFGEdge : public ICFGEdge
217
225
  {
226
+ friend class SVFIRWriter;
218
227
 
219
228
  private:
220
- const SVFInstruction* cs;
229
+ const SVFInstruction* cs;
221
230
  const RetPE* retPE;
231
+
222
232
  public:
223
233
  /// Constructor
224
- RetCFGEdge(ICFGNode* s, ICFGNode* d, const SVFInstruction* c):
225
- ICFGEdge(s,d,RetCF),cs(c),retPE(nullptr)
234
+ RetCFGEdge(ICFGNode* s, ICFGNode* d, const SVFInstruction* c)
235
+ : ICFGEdge(s, d, RetCF), cs(c), retPE(nullptr)
226
236
  {
227
237
  }
228
238
  /// Return callsite ID
229
- inline const SVFInstruction* getCallSite() const
239
+ inline const SVFInstruction* getCallSite() const
230
240
  {
231
241
  return cs;
232
242
  }
233
243
  /// Add call parameter edge to this CallCFGEdge
234
244
  inline void addRetPE(const RetPE* ret)
235
245
  {
236
- assert(retPE==nullptr && "we can only have one retPE for each RetCFGEdge");
246
+ assert(!retPE && "we can only have one retPE for each RetCFGEdge");
237
247
  retPE = ret;
238
248
  }
239
249
  /// Add get parameter edge to this CallCFGEdge
@@ -243,15 +253,15 @@ public:
243
253
  }
244
254
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
245
255
  //@{
246
- static inline bool classof(const RetCFGEdge *)
256
+ static inline bool classof(const RetCFGEdge*)
247
257
  {
248
258
  return true;
249
259
  }
250
- static inline bool classof(const ICFGEdge *edge)
260
+ static inline bool classof(const ICFGEdge* edge)
251
261
  {
252
262
  return edge->getEdgeKind() == RetCF;
253
263
  }
254
- static inline bool classof(const GenericICFGEdgeTy *edge)
264
+ static inline bool classof(const GenericICFGEdgeTy* edge)
255
265
  {
256
266
  return edge->getEdgeKind() == RetCF;
257
267
  }
@@ -53,13 +53,19 @@ typedef GenericNode<ICFGNode, ICFGEdge> GenericICFGNodeTy;
53
53
 
54
54
  class ICFGNode : public GenericICFGNodeTy
55
55
  {
56
+ friend class SVFIRWriter;
56
57
 
57
58
  public:
58
59
  /// 22 kinds of ICFG node
59
60
  /// Gep represents offset edge for field sensitivity
60
61
  enum ICFGNodeK
61
62
  {
62
- IntraBlock, FunEntryBlock, FunExitBlock, FunCallBlock, FunRetBlock, GlobalBlock
63
+ IntraBlock,
64
+ FunEntryBlock,
65
+ FunExitBlock,
66
+ FunCallBlock,
67
+ FunRetBlock,
68
+ GlobalBlock
63
69
  };
64
70
 
65
71
  typedef ICFGEdge::ICFGEdgeSetTy::iterator iterator;
@@ -174,6 +180,7 @@ public:
174
180
  */
175
181
  class IntraICFGNode : public ICFGNode
176
182
  {
183
+ friend class SVFIRWriter;
177
184
  private:
178
185
  const SVFInstruction *inst;
179
186
 
@@ -250,6 +257,7 @@ public:
250
257
  */
251
258
  class FunEntryICFGNode : public InterICFGNode
252
259
  {
260
+ friend class SVFIRWriter;
253
261
 
254
262
  public:
255
263
  typedef std::vector<const SVFVar *> FormalParmNodeVec;
@@ -307,6 +315,7 @@ public:
307
315
  */
308
316
  class FunExitICFGNode : public InterICFGNode
309
317
  {
318
+ friend class SVFIRWriter;
310
319
 
311
320
  private:
312
321
  const SVFVar *formalRet;
@@ -362,6 +371,7 @@ public:
362
371
  */
363
372
  class CallICFGNode : public InterICFGNode
364
373
  {
374
+ friend class SVFIRWriter;
365
375
 
366
376
  public:
367
377
  typedef std::vector<const SVFVar *> ActualParmNodeVec;
@@ -370,7 +380,8 @@ private:
370
380
  const RetICFGNode* ret;
371
381
  ActualParmNodeVec APNodes;
372
382
  public:
373
- CallICFGNode(NodeID id, const SVFInstruction* c) : InterICFGNode(id, FunCallBlock), cs(c), ret(nullptr)
383
+ CallICFGNode(NodeID id, const SVFInstruction* c)
384
+ : InterICFGNode(id, FunCallBlock), cs(c), ret(nullptr)
374
385
  {
375
386
  fun = cs->getFunction();
376
387
  bb = cs->getParent();
@@ -457,6 +468,7 @@ public:
457
468
  */
458
469
  class RetICFGNode : public InterICFGNode
459
470
  {
471
+ friend class SVFIRWriter;
460
472
 
461
473
  private:
462
474
  const SVFInstruction* cs;
@@ -1,4 +1,4 @@
1
- //===- SVFIR.h -- SVF IR Graph or PAG (Program Assignment Graph)--------------------------------------//
1
+ //===- SVFIR.h -- SVF IR Graph or PAG (Program Assignment Graph)--------------//
2
2
  //
3
3
  // SVF: Static Value-Flow Analysis
4
4
  //
@@ -44,21 +44,24 @@ typedef SVFVar PAGNode;
44
44
  typedef SVFStmt PAGEdge;
45
45
 
46
46
  /*
47
- * Graph representation of SVF IR. It can be seen as a program assignment graph (PAG)
48
- */
49
- class IRGraph : public GenericGraph<SVFVar,SVFStmt>
47
+ * Graph representation of SVF IR.
48
+ * It can be seen as a program assignment graph (PAG).
49
+ */
50
+ class IRGraph : public GenericGraph<SVFVar, SVFStmt>
50
51
  {
52
+ friend class SVFIRWriter;
53
+
51
54
  public:
52
55
  typedef Set<const SVFStmt*> SVFStmtSet;
53
56
  typedef Map<const SVFValue*,SVFStmtSet> ValueToEdgeMap;
54
57
 
55
58
  protected:
56
- SVFStmt::KindToSVFStmtMapTy KindToSVFStmtSetMap; // < SVFIR edge map containing all PAGEdges
57
- SVFStmt::KindToSVFStmtMapTy KindToPTASVFStmtSetMap; // < SVFIR edge map containing only pointer-related edges, i.e, both LHS and RHS are of pointer type
59
+ SVFStmt::KindToSVFStmtMapTy KindToSVFStmtSetMap; ///< SVFIR edge map containing all PAGEdges
60
+ SVFStmt::KindToSVFStmtMapTy KindToPTASVFStmtSetMap; ///< SVFIR edge map containing only pointer-related edges, i.e., both LHS and RHS are of pointer type
58
61
  bool fromFile; ///< Whether the SVFIR is built according to user specified data from a txt file
59
- NodeID nodeNumAfterPAGBuild; // initial node number after building SVFIR, excluding later added nodes, e.g., gepobj nodes
62
+ NodeID nodeNumAfterPAGBuild; ///< initial node number after building SVFIR, excluding later added nodes, e.g., gepobj nodes
60
63
  u32_t totalPTAPAGEdge;
61
- ValueToEdgeMap valueToEdgeMap; ///< Map llvm::Values to all corresponding PAGEdges
64
+ ValueToEdgeMap valueToEdgeMap; ///< Map llvm::Values to all corresponding PAGEdges
62
65
  SymbolTableInfo* symInfo;
63
66
 
64
67
  /// Add a node into the graph
@@ -73,10 +76,14 @@ protected:
73
76
  //// Return true if this edge exits
74
77
  SVFStmt* hasNonlabeledEdge(SVFVar* src, SVFVar* dst, SVFStmt::PEDGEK kind);
75
78
  /// Return true if this labeled edge exits, including store, call and load
76
- /// two store edge can have same dst and src but located in different basic blocks, thus flags are needed to distinguish them
77
- SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* dst, SVFStmt::PEDGEK kind, const ICFGNode* cs);
78
- /// Return MultiOpndStmt since it has more than one operands (we use operand 2 here to make the flag)
79
- SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* op1, SVFStmt::PEDGEK kind, const SVFVar* op2);
79
+ /// two store edge can have same dst and src but located in different basic
80
+ /// blocks, thus flags are needed to distinguish them
81
+ SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* dst, SVFStmt::PEDGEK kind,
82
+ const ICFGNode* cs);
83
+ /// Return MultiOpndStmt since it has more than one operands (we use operand
84
+ /// 2 here to make the flag)
85
+ SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* op1, SVFStmt::PEDGEK kind,
86
+ const SVFVar* op2);
80
87
 
81
88
  /// Map a value to a set of edges
82
89
  inline void mapValueToEdge(const SVFValue* V, SVFStmt *edge)
@@ -94,7 +101,8 @@ protected:
94
101
  }
95
102
 
96
103
  public:
97
- IRGraph(bool buildFromFile): fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0)
104
+ IRGraph(bool buildFromFile)
105
+ : fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0)
98
106
  {
99
107
  symInfo = SymbolTableInfo::SymbolInfo();
100
108
  // insert dummy value if a correct value cannot be found
@@ -237,7 +245,7 @@ template<> struct GenericGraphTraits<Inverse<SVF::SVFVar *> > : public GenericGr
237
245
 
238
246
  template<> struct GenericGraphTraits<SVF::IRGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::SVFVar,SVF::SVFStmt>* >
239
247
  {
240
- typedef SVF::SVFVar *NodeRef;
248
+ typedef SVF::SVFVar* NodeRef;
241
249
  };
242
250
 
243
251
  } // End namespace llvm
@@ -52,6 +52,8 @@ class SVFVar;
52
52
  class LocationSet
53
53
  {
54
54
  friend class SymbolTableInfo;
55
+ friend class SVFIRWriter;
56
+
55
57
  public:
56
58
  enum LSRelation
57
59
  {
@@ -62,12 +64,12 @@ public:
62
64
  typedef std::vector<VarAndGepTypePair> OffsetVarAndGepTypePairs;
63
65
 
64
66
  /// Constructor
65
- LocationSet(s32_t o = 0) : fldIdx(o)
66
- {}
67
+ LocationSet(s32_t o = 0) : fldIdx(o) {}
67
68
 
68
69
  /// Copy Constructor
69
70
  LocationSet(const LocationSet& ls)
70
- : fldIdx(ls.fldIdx), offsetVarAndGepTypePairs(ls.getOffsetVarAndGepTypePairVec())
71
+ : fldIdx(ls.fldIdx),
72
+ offsetVarAndGepTypePairs(ls.getOffsetVarAndGepTypePairVec())
71
73
  {
72
74
  }
73
75
 
@@ -75,9 +77,9 @@ public:
75
77
 
76
78
  /// Overload operators
77
79
  //@{
78
- LocationSet operator+ (const LocationSet& rhs) const;
79
- bool operator< (const LocationSet& rhs) const;
80
- inline const LocationSet& operator= (const LocationSet& rhs)
80
+ LocationSet operator+(const LocationSet& rhs) const;
81
+ bool operator<(const LocationSet& rhs) const;
82
+ inline const LocationSet& operator=(const LocationSet& rhs)
81
83
  {
82
84
  fldIdx = rhs.fldIdx;
83
85
  offsetVarAndGepTypePairs = rhs.getOffsetVarAndGepTypePairVec();
@@ -85,8 +87,8 @@ public:
85
87
  }
86
88
  inline bool operator==(const LocationSet& rhs) const
87
89
  {
88
- return this->fldIdx == rhs.fldIdx
89
- && this->offsetVarAndGepTypePairs == rhs.offsetVarAndGepTypePairs;
90
+ return this->fldIdx == rhs.fldIdx &&
91
+ this->offsetVarAndGepTypePairs == rhs.offsetVarAndGepTypePairs;
90
92
  }
91
93
  //@}
92
94
 
@@ -37,6 +37,8 @@ namespace SVF
37
37
 
38
38
  class SVFLoop
39
39
  {
40
+ friend class SVFIRWriter;
41
+
40
42
  typedef Set<const ICFGEdge *> ICFGEdgeSet;
41
43
  typedef Set<const ICFGNode *> ICFGNodeSet;
42
44
  private: