svf-tools 1.0.976 → 1.0.977

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 (49) hide show
  1. package/package.json +1 -1
  2. package/svf/include/AE/Svfexe/AbstractInterpretation.h +1 -1
  3. package/svf/include/DDA/ContextDDA.h +2 -2
  4. package/svf/include/DDA/DDAVFSolver.h +5 -5
  5. package/svf/include/DDA/FlowDDA.h +1 -1
  6. package/svf/include/Graphs/ICFG.h +2 -2
  7. package/svf/include/Graphs/{CallGraph.h → PTACallGraph.h} +41 -41
  8. package/svf/include/Graphs/ThreadCallGraph.h +24 -24
  9. package/svf/include/Graphs/VFG.h +4 -4
  10. package/svf/include/MSSA/MemRegion.h +4 -4
  11. package/svf/include/MTA/LockAnalysis.h +1 -1
  12. package/svf/include/MTA/MHP.h +2 -2
  13. package/svf/include/MTA/PCG.h +3 -3
  14. package/svf/include/MTA/TCT.h +7 -7
  15. package/svf/include/MemoryModel/PointerAnalysis.h +13 -13
  16. package/svf/include/SABER/SaberSVFGBuilder.h +1 -1
  17. package/svf/include/SABER/SrcSnkDDA.h +7 -7
  18. package/svf/include/Util/CallGraphBuilder.h +5 -5
  19. package/svf/lib/AE/Svfexe/AbstractInterpretation.cpp +1 -1
  20. package/svf/lib/CFL/CFLSVFGBuilder.cpp +1 -1
  21. package/svf/lib/DDA/ContextDDA.cpp +9 -9
  22. package/svf/lib/DDA/DDAClient.cpp +3 -3
  23. package/svf/lib/DDA/DDAPass.cpp +4 -4
  24. package/svf/lib/DDA/FlowDDA.cpp +2 -2
  25. package/svf/lib/Graphs/ICFG.cpp +6 -6
  26. package/svf/lib/Graphs/{CallGraph.cpp → PTACallGraph.cpp} +66 -66
  27. package/svf/lib/Graphs/SVFG.cpp +7 -7
  28. package/svf/lib/Graphs/SVFGReadWrite.cpp +6 -6
  29. package/svf/lib/Graphs/SVFGStat.cpp +1 -1
  30. package/svf/lib/Graphs/ThreadCallGraph.cpp +17 -17
  31. package/svf/lib/Graphs/VFG.cpp +1 -1
  32. package/svf/lib/MSSA/MemRegion.cpp +7 -7
  33. package/svf/lib/MTA/LockAnalysis.cpp +18 -18
  34. package/svf/lib/MTA/MHP.cpp +19 -19
  35. package/svf/lib/MTA/MTA.cpp +1 -1
  36. package/svf/lib/MTA/PCG.cpp +12 -12
  37. package/svf/lib/MTA/TCT.cpp +23 -23
  38. package/svf/lib/MemoryModel/PointerAnalysis.cpp +12 -12
  39. package/svf/lib/SABER/LeakChecker.cpp +4 -4
  40. package/svf/lib/SABER/SaberSVFGBuilder.cpp +4 -4
  41. package/svf/lib/SABER/SrcSnkDDA.cpp +1 -1
  42. package/svf/lib/Util/CallGraphBuilder.cpp +2 -2
  43. package/svf/lib/Util/PTAStat.cpp +7 -7
  44. package/svf/lib/WPA/VersionedFlowSensitive.cpp +2 -2
  45. package/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +1 -1
  46. package/svf-llvm/lib/SVFIRBuilder.cpp +5 -5
  47. package/svf-llvm/tools/AE/ae.cpp +1 -1
  48. package/svf-llvm/tools/Example/svf-ex.cpp +1 -1
  49. package/svf-llvm/tools/MTA/LockResultValidator.cpp +2 -2
@@ -34,7 +34,7 @@
34
34
  #include <signal.h>
35
35
 
36
36
  #include "Graphs/CHG.h"
37
- #include "Graphs/CallGraph.h"
37
+ #include "Graphs/PTACallGraph.h"
38
38
  #include "Graphs/SCC.h"
39
39
  #include "MemoryModel/AbstractPointsToDS.h"
40
40
  #include "MemoryModel/ConditionalPT.h"
@@ -103,7 +103,7 @@ public:
103
103
  typedef SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap;
104
104
  typedef Set<const SVFFunction*> FunctionSet;
105
105
  typedef OrderedMap<const CallICFGNode*, FunctionSet> CallEdgeMap;
106
- typedef SCCDetection<CallGraph*> CallGraphSCC;
106
+ typedef SCCDetection<PTACallGraph*> CallGraphSCC;
107
107
  typedef Set<const SVFGlobalValue*> VTableSet;
108
108
  typedef Set<const SVFFunction*> VFunSet;
109
109
  //@}
@@ -148,7 +148,7 @@ protected:
148
148
  /// Statistics
149
149
  PTAStat* stat;
150
150
  /// Call graph used for pointer analysis
151
- CallGraph* callgraph;
151
+ PTACallGraph* ptaCallGraph;
152
152
  /// SCC for CallGraph
153
153
  CallGraphSCC* callGraphSCC;
154
154
  /// Interprocedural control-flow graph
@@ -165,12 +165,12 @@ public:
165
165
  /// Return number of resolved indirect call edges
166
166
  inline u32_t getNumOfResolvedIndCallEdge() const
167
167
  {
168
- return getCallGraph()->getNumOfResolvedIndCallEdge();
168
+ return getPTACallGraph()->getNumOfResolvedIndCallEdge();
169
169
  }
170
170
  /// Return call graph
171
- inline CallGraph* getCallGraph() const
171
+ inline PTACallGraph* getPTACallGraph() const
172
172
  {
173
- return callgraph;
173
+ return ptaCallGraph;
174
174
  }
175
175
  /// Return call graph SCC
176
176
  inline CallGraphSCC* getCallGraphSCC() const
@@ -367,15 +367,15 @@ public:
367
367
  //@{
368
368
  inline CallEdgeMap& getIndCallMap()
369
369
  {
370
- return getCallGraph()->getIndCallMap();
370
+ return getPTACallGraph()->getIndCallMap();
371
371
  }
372
372
  inline bool hasIndCSCallees(const CallICFGNode* cs) const
373
373
  {
374
- return getCallGraph()->hasIndCSCallees(cs);
374
+ return getPTACallGraph()->hasIndCSCallees(cs);
375
375
  }
376
376
  inline const FunctionSet& getIndCSCallees(const CallICFGNode* cs) const
377
377
  {
378
- return getCallGraph()->getIndCSCallees(cs);
378
+ return getPTACallGraph()->getIndCSCallees(cs);
379
379
  }
380
380
  //@}
381
381
 
@@ -388,7 +388,7 @@ public:
388
388
  inline void callGraphSCCDetection()
389
389
  {
390
390
  if(callGraphSCC==nullptr)
391
- callGraphSCC = new CallGraphSCC(callgraph);
391
+ callGraphSCC = new CallGraphSCC(ptaCallGraph);
392
392
 
393
393
  callGraphSCC->find();
394
394
  }
@@ -400,13 +400,13 @@ public:
400
400
  /// Return TRUE if this edge is inside a CallGraph SCC, i.e., src node and dst node are in the same SCC on the SVFG.
401
401
  inline bool inSameCallGraphSCC(const SVFFunction* fun1,const SVFFunction* fun2)
402
402
  {
403
- const CallGraphNode* src = callgraph->getCallGraphNode(fun1);
404
- const CallGraphNode* dst = callgraph->getCallGraphNode(fun2);
403
+ const PTACallGraphNode* src = ptaCallGraph->getCallGraphNode(fun1);
404
+ const PTACallGraphNode* dst = ptaCallGraph->getCallGraphNode(fun2);
405
405
  return (getCallGraphSCCRepNode(src->getId()) == getCallGraphSCCRepNode(dst->getId()));
406
406
  }
407
407
  inline bool isInRecursion(const SVFFunction* fun) const
408
408
  {
409
- return callGraphSCC->isInCycle(callgraph->getCallGraphNode(fun)->getId());
409
+ return callGraphSCC->isInCycle(ptaCallGraph->getCallGraphNode(fun)->getId());
410
410
  }
411
411
  /// Whether a local variable is in function recursions
412
412
  bool isLocalVarInRecursiveFun(NodeID id) const;
@@ -89,7 +89,7 @@ protected:
89
89
 
90
90
  /// Add actual parameter SVFGNode for 1st argument of a deallocation like external function
91
91
  /// In order to path sensitive leak detection
92
- virtual void AddExtActualParmSVFGNodes(CallGraph* callgraph);
92
+ virtual void AddExtActualParmSVFGNodes(PTACallGraph* callgraph);
93
93
 
94
94
  /// Collect memory pointed global pointers,
95
95
  /// note that this collection is recursively performed, for example gp-->obj-->obj'
@@ -76,13 +76,13 @@ private:
76
76
  protected:
77
77
  SaberSVFGBuilder memSSA;
78
78
  SVFG* svfg;
79
- CallGraph* callgraph;
79
+ PTACallGraph* ptaCallGraph;
80
80
  SVFBugReport report; /// Bug Reporter
81
81
 
82
82
  public:
83
83
 
84
84
  /// Constructor
85
- SrcSnkDDA() : _curSlice(nullptr), svfg(nullptr), callgraph(nullptr)
85
+ SrcSnkDDA() : _curSlice(nullptr), svfg(nullptr), ptaCallGraph(nullptr)
86
86
  {
87
87
  saberCondAllocator = std::make_unique<SaberCondAllocator>();
88
88
  }
@@ -95,9 +95,9 @@ public:
95
95
  _curSlice = nullptr;
96
96
 
97
97
  /// the following shared by multiple checkers, thus can not be released.
98
- //if (callgraph != nullptr)
99
- // delete callgraph;
100
- //callgraph = nullptr;
98
+ //if (ptaCallGraph != nullptr)
99
+ // delete ptaCallGraph;
100
+ //ptaCallGraph = nullptr;
101
101
 
102
102
  //if(pathCondAllocator)
103
103
  // delete pathCondAllocator;
@@ -129,9 +129,9 @@ public:
129
129
  }
130
130
 
131
131
  /// Get Callgraph
132
- inline CallGraph* getCallgraph() const
132
+ inline PTACallGraph* getCallgraph() const
133
133
  {
134
- return callgraph;
134
+ return ptaCallGraph;
135
135
  }
136
136
 
137
137
  /// Whether this svfg node may access global variable
@@ -31,7 +31,7 @@
31
31
  #ifndef INCLUDE_SVF_FE_CALLGRAPHBUILDER_H_
32
32
  #define INCLUDE_SVF_FE_CALLGRAPHBUILDER_H_
33
33
 
34
- #include "Graphs/CallGraph.h"
34
+ #include "Graphs/PTACallGraph.h"
35
35
  #include "Graphs/ThreadCallGraph.h"
36
36
 
37
37
  namespace SVF
@@ -43,15 +43,15 @@ class CallGraphBuilder
43
43
  {
44
44
 
45
45
  protected:
46
- CallGraph* callgraph;
46
+ PTACallGraph* callgraph;
47
47
  ICFG* icfg;
48
48
  public:
49
- CallGraphBuilder(CallGraph* cg, ICFG* i): callgraph(cg),icfg(i)
49
+ CallGraphBuilder(PTACallGraph* cg, ICFG* i): callgraph(cg),icfg(i)
50
50
  {
51
51
  }
52
52
 
53
53
  /// Build normal callgraph
54
- CallGraph* buildCallGraph(SVFModule* svfModule);
54
+ PTACallGraph* buildCallGraph(SVFModule* svfModule);
55
55
 
56
56
  };
57
57
 
@@ -64,7 +64,7 @@ public:
64
64
  }
65
65
 
66
66
  /// Build thread-aware callgraph
67
- CallGraph* buildThreadCallGraph(SVFModule* svfModule);
67
+ PTACallGraph* buildThreadCallGraph(SVFModule* svfModule);
68
68
 
69
69
  };
70
70
 
@@ -131,7 +131,7 @@ void AbstractInterpretation::initWTO()
131
131
  // Detect if the call graph has cycles by finding its strongly connected components (SCC)
132
132
  Andersen::CallGraphSCC* callGraphScc = ander->getCallGraphSCC();
133
133
  callGraphScc->find();
134
- auto callGraph = ander->getCallGraph();
134
+ auto callGraph = ander->getPTACallGraph();
135
135
 
136
136
  // Iterate through the call graph
137
137
  for (auto it = callGraph->begin(); it != callGraph->end(); it++)
@@ -50,7 +50,7 @@ void CFLSVFGBuilder::buildSVFG()
50
50
 
51
51
  DBOUT(DGENERAL, outs() << pasMsg("\tAdd Sink SVFG Nodes\n"));
52
52
 
53
- AddExtActualParmSVFGNodes(pta->getCallGraph());
53
+ AddExtActualParmSVFGNodes(pta->getPTACallGraph());
54
54
 
55
55
  if(pta->printStat())
56
56
  svfg->performStat();
@@ -63,7 +63,7 @@ void ContextDDA::initialize()
63
63
  {
64
64
  CondPTAImpl<ContextCond>::initialize();
65
65
  buildSVFG(pag);
66
- setCallGraph(getCallGraph());
66
+ setCallGraph(getPTACallGraph());
67
67
  setCallGraphSCC(getCallGraphSCC());
68
68
  stat = setDDAStat(new DDAStat(this));
69
69
  flowDDA->initialize();
@@ -219,9 +219,9 @@ CallSiteID ContextDDA::getCSIDAtCall(CxtLocDPItem&, const SVFGEdge* edge)
219
219
  const CallICFGNode* cbn = getSVFG()->getCallSite(svfg_csId);
220
220
  const SVFFunction* callee = edge->getDstNode()->getFun();
221
221
 
222
- if(getCallGraph()->hasCallSiteID(cbn,callee))
222
+ if(getPTACallGraph()->hasCallSiteID(cbn,callee))
223
223
  {
224
- return getCallGraph()->getCallSiteID(cbn,callee);
224
+ return getPTACallGraph()->getCallSiteID(cbn,callee);
225
225
  }
226
226
 
227
227
  return 0;
@@ -243,9 +243,9 @@ CallSiteID ContextDDA::getCSIDAtRet(CxtLocDPItem&, const SVFGEdge* edge)
243
243
  const CallICFGNode* cbn = getSVFG()->getCallSite(svfg_csId);
244
244
  const SVFFunction* callee = edge->getSrcNode()->getFun();
245
245
 
246
- if(getCallGraph()->hasCallSiteID(cbn,callee))
246
+ if(getPTACallGraph()->hasCallSiteID(cbn,callee))
247
247
  {
248
- return getCallGraph()->getCallSiteID(cbn,callee);
248
+ return getPTACallGraph()->getCallSiteID(cbn,callee);
249
249
  }
250
250
 
251
251
  return 0;
@@ -265,8 +265,8 @@ bool ContextDDA::handleBKCondition(CxtLocDPItem& dpm, const SVFGEdge* edge)
265
265
 
266
266
  if(isEdgeInRecursion(csId))
267
267
  {
268
- DBOUT(DDDA,outs() << "\t\t call edge " << getCallGraph()->getCallerOfCallSite(csId)->getName() <<
269
- "=>" << getCallGraph()->getCalleeOfCallSite(csId)->getName() << "in recursion \n");
268
+ DBOUT(DDDA,outs() << "\t\t call edge " << getPTACallGraph()->getCallerOfCallSite(csId)->getName() <<
269
+ "=>" << getPTACallGraph()->getCalleeOfCallSite(csId)->getName() << "in recursion \n");
270
270
  popRecursiveCallSites(dpm);
271
271
  }
272
272
  else
@@ -293,8 +293,8 @@ bool ContextDDA::handleBKCondition(CxtLocDPItem& dpm, const SVFGEdge* edge)
293
293
 
294
294
  if(isEdgeInRecursion(csId))
295
295
  {
296
- DBOUT(DDDA,outs() << "\t\t return edge " << getCallGraph()->getCalleeOfCallSite(csId)->getName() <<
297
- "=>" << getCallGraph()->getCallerOfCallSite(csId)->getName() << "in recursion \n");
296
+ DBOUT(DDDA,outs() << "\t\t return edge " << getPTACallGraph()->getCalleeOfCallSite(csId)->getName() <<
297
+ "=>" << getPTACallGraph()->getCallerOfCallSite(csId)->getName() << "in recursion \n");
298
298
  popRecursiveCallSites(dpm);
299
299
  }
300
300
  else
@@ -115,7 +115,7 @@ void FunptrDDAClient::performStat(PointerAnalysis* pta)
115
115
  const PointsTo& ddaPts = pta->getPts(vtptr);
116
116
  const PointsTo& anderPts = ander->getPts(vtptr);
117
117
 
118
- CallGraph* callgraph = ander->getCallGraph();
118
+ PTACallGraph* callgraph = ander->getPTACallGraph();
119
119
  const CallICFGNode* cbn = nIter->second;
120
120
 
121
121
  if(!callgraph->hasIndCSCallees(cbn))
@@ -124,7 +124,7 @@ void FunptrDDAClient::performStat(PointerAnalysis* pta)
124
124
  continue;
125
125
  }
126
126
 
127
- const CallGraph::FunctionSet& callees = callgraph->getIndCSCallees(cbn);
127
+ const PTACallGraph::FunctionSet& callees = callgraph->getIndCSCallees(cbn);
128
128
  totalCallsites++;
129
129
  if(callees.size() == 0)
130
130
  zeroTargetCallsites++;
@@ -162,7 +162,7 @@ void FunptrDDAClient::performStat(PointerAnalysis* pta)
162
162
  outs() << "=================================================\n";
163
163
  outs() << "Total virtual callsites: " << vtableToCallSiteMap.size() << "\n";
164
164
  outs() << "Total analyzed virtual callsites: " << totalCallsites << "\n";
165
- outs() << "Indirect call map size: " << ander->getCallGraph()->getIndCallMap().size() << "\n";
165
+ outs() << "Indirect call map size: " << ander->getPTACallGraph()->getIndCallMap().size() << "\n";
166
166
  outs() << "Precise callsites: " << morePreciseCallsites << "\n";
167
167
  outs() << "Zero target callsites: " << zeroTargetCallsites << "\n";
168
168
  outs() << "One target callsites: " << oneTargetCallsites << "\n";
@@ -239,8 +239,8 @@ void DDAPass::collectCxtInsenEdgeForVFCycle(PointerAnalysis* pta, const SVFG* sv
239
239
 
240
240
  if(srcFun && dstFun)
241
241
  {
242
- NodeID src = pta->getCallGraph()->getCallGraphNode(srcFun)->getId();
243
- NodeID dst = pta->getCallGraph()->getCallGraphNode(dstFun)->getId();
242
+ NodeID src = pta->getPTACallGraph()->getCallGraphNode(srcFun)->getId();
243
+ NodeID dst = pta->getPTACallGraph()->getCallGraphNode(dstFun)->getId();
244
244
  insensitvefunPairs.insert(std::make_pair(src,dst));
245
245
  insensitvefunPairs.insert(std::make_pair(dst,src));
246
246
  }
@@ -266,8 +266,8 @@ void DDAPass::collectCxtInsenEdgeForVFCycle(PointerAnalysis* pta, const SVFG* sv
266
266
 
267
267
  if(srcFun && dstFun)
268
268
  {
269
- NodeID src = pta->getCallGraph()->getCallGraphNode(srcFun)->getId();
270
- NodeID dst = pta->getCallGraph()->getCallGraphNode(dstFun)->getId();
269
+ NodeID src = pta->getPTACallGraph()->getCallGraphNode(srcFun)->getId();
270
+ NodeID dst = pta->getPTACallGraph()->getCallGraphNode(dstFun)->getId();
271
271
  if(insensitvefunPairs.find(std::make_pair(src,dst))!=insensitvefunPairs.end())
272
272
  insensitveEdges.insert(edge);
273
273
  else if(insensitvefunPairs.find(std::make_pair(dst,src))!=insensitvefunPairs.end())
@@ -85,9 +85,9 @@ bool FlowDDA::testIndCallReachability(LocDPItem&, const SVFFunction* callee, Cal
85
85
 
86
86
  if(getPAG()->isIndirectCallSites(cbn))
87
87
  {
88
- if(getCallGraph()->hasIndCSCallees(cbn))
88
+ if(getPTACallGraph()->hasIndCSCallees(cbn))
89
89
  {
90
- const FunctionSet& funset = getCallGraph()->getIndCSCallees(cbn);
90
+ const FunctionSet& funset = getPTACallGraph()->getIndCSCallees(cbn);
91
91
  if(funset.find(callee)!=funset.end())
92
92
  return true;
93
93
  }
@@ -31,7 +31,7 @@
31
31
  #include "SVFIR/SVFModule.h"
32
32
  #include "Graphs/ICFG.h"
33
33
  #include "SVFIR/SVFIR.h"
34
- #include "Graphs/CallGraph.h"
34
+ #include "Graphs/PTACallGraph.h"
35
35
 
36
36
  using namespace SVF;
37
37
  using namespace SVFUtil;
@@ -460,17 +460,17 @@ void ICFG::view()
460
460
  /*!
461
461
  * Update ICFG for indirect calls
462
462
  */
463
- void ICFG::updateCallGraph(CallGraph* callgraph)
463
+ void ICFG::updateCallGraph(PTACallGraph* callgraph)
464
464
  {
465
- CallGraph::CallEdgeMap::const_iterator iter = callgraph->getIndCallMap().begin();
466
- CallGraph::CallEdgeMap::const_iterator eiter = callgraph->getIndCallMap().end();
465
+ PTACallGraph::CallEdgeMap::const_iterator iter = callgraph->getIndCallMap().begin();
466
+ PTACallGraph::CallEdgeMap::const_iterator eiter = callgraph->getIndCallMap().end();
467
467
  for (; iter != eiter; iter++)
468
468
  {
469
469
  const CallICFGNode* callBlock = iter->first;
470
470
  const SVFInstruction* cs = callBlock->getCallSite();
471
471
  assert(callBlock->isIndirectCall() && "this is not an indirect call?");
472
- const CallGraph::FunctionSet & functions = iter->second;
473
- for (CallGraph::FunctionSet::const_iterator func_iter = functions.begin(); func_iter != functions.end(); func_iter++)
472
+ const PTACallGraph::FunctionSet & functions = iter->second;
473
+ for (PTACallGraph::FunctionSet::const_iterator func_iter = functions.begin(); func_iter != functions.end(); func_iter++)
474
474
  {
475
475
  const SVFFunction* callee = *func_iter;
476
476
  CallICFGNode* callBlockNode = getCallICFGNode(cs);