svf-lib 1.0.2130 → 1.0.2131

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -189,6 +189,11 @@ public:
189
189
 
190
190
  }
191
191
 
192
+ inline const std::string &getName() const
193
+ {
194
+ return fun->getName();
195
+ }
196
+
192
197
  /// Get function of this call node
193
198
  inline const SVFFunction* getFunction() const
194
199
  {
@@ -254,8 +259,6 @@ public:
254
259
  };
255
260
 
256
261
  private:
257
- CGEK kind;
258
-
259
262
  /// Indirect call map
260
263
  CallEdgeMap indirectCallMap;
261
264
 
@@ -270,6 +273,7 @@ protected:
270
273
 
271
274
  NodeID callGraphNodeNum;
272
275
  u32_t numOfResolvedIndCallEdge;
276
+ CGEK kind;
273
277
 
274
278
  /// Clean up memory
275
279
  void destroy();
@@ -278,7 +282,9 @@ public:
278
282
  /// Constructor
279
283
  CallGraph(CGEK k = NormCallGraph);
280
284
 
281
- /// Add callgraph Node
285
+ /// Copy constructor
286
+ CallGraph(const CallGraph& other);
287
+
282
288
  void addCallGraphNode(const SVFFunction* fun);
283
289
 
284
290
  /// Destructor
@@ -172,7 +172,10 @@ public:
172
172
  typedef Map<const CallICFGNode*, ParForEdgeSet> CallInstToParForEdgesMap;
173
173
 
174
174
  /// Constructor
175
- ThreadCallGraph();
175
+ ThreadCallGraph(const CallGraph& cg);
176
+
177
+ ThreadCallGraph(ThreadCallGraph& cg) = delete;
178
+
176
179
  /// Destructor
177
180
  virtual ~ThreadCallGraph()
178
181
  {
@@ -105,6 +105,7 @@ private:
105
105
  InstToBlockNodeMapTy InstToBlockNodeMap; ///< map a basic block to its ICFGNode
106
106
  FunToFunEntryNodeMapTy FunToFunEntryNodeMap; ///< map a function to its FunExitICFGNode
107
107
  FunToFunExitNodeMapTy FunToFunExitNodeMap; ///< map a function to its FunEntryICFGNode
108
+ CallGraph* callgraph;
108
109
 
109
110
  /// Constructor
110
111
  LLVMModuleSet();
@@ -98,6 +98,7 @@ private:
98
98
  ICFG* icfg; // ICFG
99
99
  CommonCHGraph* chgraph; // class hierarchy graph
100
100
  CallSiteSet callSiteSet; /// all the callsites of a program
101
+ CallGraph* callGraph; /// call graph
101
102
 
102
103
  static std::unique_ptr<SVFIR> pag; ///< Singleton pattern here to enable instance of SVFIR can only be created once.
103
104
 
@@ -182,6 +183,18 @@ public:
182
183
  assert(chgraph && "empty ICFG! Build SVF IR first!");
183
184
  return chgraph;
184
185
  }
186
+
187
+ /// Set/Get CG
188
+ inline void setCallGraph(CallGraph* c)
189
+ {
190
+ callGraph = c;
191
+ }
192
+ inline CallGraph* getCallGraph()
193
+ {
194
+ assert(callGraph && "empty CallGraph! Build SVF IR first!");
195
+ return callGraph;
196
+ }
197
+
185
198
  /// Get/set methods to get SVFStmts based on their kinds and ICFGNodes
186
199
  //@{
187
200
  /// Get edges set according to its kind
@@ -130,23 +130,6 @@ public:
130
130
 
131
131
  /// Iterators
132
132
  ///@{
133
- iterator begin()
134
- {
135
- return FunctionSet.begin();
136
- }
137
- const_iterator begin() const
138
- {
139
- return FunctionSet.begin();
140
- }
141
- iterator end()
142
- {
143
- return FunctionSet.end();
144
- }
145
- const_iterator end() const
146
- {
147
- return FunctionSet.end();
148
- }
149
-
150
133
  global_iterator global_begin()
151
134
  {
152
135
  return GlobalSet.begin();
@@ -38,34 +38,18 @@ namespace SVF
38
38
  {
39
39
 
40
40
  class ICFG;
41
+ class SVFModule;
41
42
 
42
43
  class CallGraphBuilder
43
44
  {
44
-
45
- protected:
46
- CallGraph* callgraph;
47
- ICFG* icfg;
48
45
  public:
49
- CallGraphBuilder(CallGraph* cg, ICFG* i): callgraph(cg),icfg(i)
50
- {
51
- }
52
-
53
- /// Build normal callgraph
54
- CallGraph* buildCallGraph(SVFModule* svfModule);
55
-
56
- };
46
+ CallGraphBuilder()=default;
57
47
 
58
- class ThreadCallGraphBuilder : public CallGraphBuilder
59
- {
60
-
61
- public:
62
- ThreadCallGraphBuilder(ThreadCallGraph* cg, ICFG* i): CallGraphBuilder(cg,i)
63
- {
64
- }
48
+ /// Buidl SVFIR callgraoh
49
+ CallGraph* buildSVFIRCallGraph(SVFModule* svfModule);
65
50
 
66
51
  /// Build thread-aware callgraph
67
- CallGraph* buildThreadCallGraph(SVFModule* svfModule);
68
-
52
+ ThreadCallGraph* buildThreadCallGraph();
69
53
  };
70
54
 
71
55
  } // End namespace SVF
@@ -327,29 +327,11 @@ inline bool isProgEntryFunction(const SVFFunction* fun)
327
327
  return fun && fun->getName() == "main";
328
328
  }
329
329
 
330
- /// Get program entry function from module.
331
- inline const SVFFunction* getProgFunction(SVFModule* svfModule, const std::string& funName)
332
- {
333
- for (SVFModule::const_iterator it = svfModule->begin(), eit = svfModule->end(); it != eit; ++it)
334
- {
335
- const SVFFunction *fun = *it;
336
- if (fun->getName()==funName)
337
- return fun;
338
- }
339
- return nullptr;
340
- }
330
+ /// Get program entry function from function name.
331
+ const SVFFunction* getProgFunction(const std::string& funName);
341
332
 
342
- /// Get program entry function from module.
343
- inline const SVFFunction* getProgEntryFunction(SVFModule* svfModule)
344
- {
345
- for (SVFModule::const_iterator it = svfModule->begin(), eit = svfModule->end(); it != eit; ++it)
346
- {
347
- const SVFFunction *fun = *it;
348
- if (isProgEntryFunction(fun))
349
- return (fun);
350
- }
351
- return nullptr;
352
- }
333
+ /// Get program entry function.
334
+ const SVFFunction* getProgEntryFunction();
353
335
 
354
336
  /// Return true if this is a program exit function call
355
337
  //@{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2130",
3
+ "version": "1.0.2131",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {