svf-tools 1.0.993 → 1.0.995

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 (59) hide show
  1. package/package.json +1 -1
  2. package/svf/include/Graphs/CDG.h +18 -1
  3. package/svf/include/Graphs/CFLGraph.h +19 -1
  4. package/svf/include/Graphs/CHG.h +19 -1
  5. package/svf/include/Graphs/CallGraph.h +19 -1
  6. package/svf/include/Graphs/ConsGNode.h +19 -1
  7. package/svf/include/Graphs/GenericGraph.h +243 -17
  8. package/svf/include/Graphs/ICFG.h +0 -96
  9. package/svf/include/Graphs/ICFGNode.h +55 -22
  10. package/svf/include/Graphs/SVFG.h +2 -2
  11. package/svf/include/Graphs/SVFGNode.h +5 -17
  12. package/svf/include/Graphs/SVFGOPT.h +2 -1
  13. package/svf/include/Graphs/ThreadCallGraph.h +5 -4
  14. package/svf/include/Graphs/VFG.h +2 -2
  15. package/svf/include/Graphs/VFGNode.h +99 -26
  16. package/svf/include/MTA/TCT.h +19 -1
  17. package/svf/include/MemoryModel/PointerAnalysis.h +1 -1
  18. package/svf/include/MemoryModel/PointerAnalysisImpl.h +4 -0
  19. package/svf/include/SABER/SaberCondAllocator.h +2 -2
  20. package/svf/include/SVFIR/SVFFileSystem.h +1 -1
  21. package/svf/include/SVFIR/SVFIR.h +2 -2
  22. package/svf/include/SVFIR/SVFVariables.h +68 -38
  23. package/svf/include/SVFIR/SymbolTableInfo.h +11 -1
  24. package/svf/include/Util/SVFUtil.h +1 -1
  25. package/svf/include/Util/ThreadAPI.h +8 -2
  26. package/svf/include/WPA/Andersen.h +26 -13
  27. package/svf/include/WPA/Steensgaard.h +10 -20
  28. package/svf/include/WPA/TypeAnalysis.h +10 -3
  29. package/svf/lib/AE/Svfexe/AEDetector.cpp +4 -2
  30. package/svf/lib/AE/Svfexe/AbsExtAPI.cpp +10 -12
  31. package/svf/lib/AE/Svfexe/AbstractInterpretation.cpp +2 -0
  32. package/svf/lib/DDA/ContextDDA.cpp +12 -8
  33. package/svf/lib/Graphs/ICFG.cpp +9 -93
  34. package/svf/lib/Graphs/SVFG.cpp +1 -1
  35. package/svf/lib/Graphs/ThreadCallGraph.cpp +10 -2
  36. package/svf/lib/Graphs/VFG.cpp +2 -4
  37. package/svf/lib/MSSA/MemRegion.cpp +2 -2
  38. package/svf/lib/MemoryModel/PointerAnalysisImpl.cpp +37 -0
  39. package/svf/lib/SABER/LeakChecker.cpp +1 -2
  40. package/svf/lib/SABER/SaberCondAllocator.cpp +13 -16
  41. package/svf/lib/SABER/SaberSVFGBuilder.cpp +2 -2
  42. package/svf/lib/SVFIR/SVFFileSystem.cpp +0 -6
  43. package/svf/lib/SVFIR/SVFVariables.cpp +3 -0
  44. package/svf/lib/SVFIR/SymbolTableInfo.cpp +3 -2
  45. package/svf/lib/Util/ThreadAPI.cpp +15 -5
  46. package/svf/lib/WPA/Andersen.cpp +205 -151
  47. package/svf/lib/WPA/Steensgaard.cpp +1 -163
  48. package/svf-llvm/include/SVF-LLVM/DCHG.h +1 -1
  49. package/svf-llvm/include/SVF-LLVM/ICFGBuilder.h +93 -23
  50. package/svf-llvm/include/SVF-LLVM/LLVMModule.h +84 -0
  51. package/svf-llvm/include/SVF-LLVM/LLVMUtil.h +15 -0
  52. package/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +19 -12
  53. package/svf-llvm/lib/ICFGBuilder.cpp +125 -54
  54. package/svf-llvm/lib/LLVMLoopAnalysis.cpp +6 -11
  55. package/svf-llvm/lib/LLVMModule.cpp +54 -0
  56. package/svf-llvm/lib/LLVMUtil.cpp +15 -0
  57. package/svf-llvm/lib/SVFIRBuilder.cpp +92 -76
  58. package/svf-llvm/lib/SVFIRExtAPI.cpp +5 -5
  59. package/svf-llvm/lib/SymbolTableBuilder.cpp +4 -4
@@ -57,17 +57,6 @@ class ICFGNode : public GenericICFGNodeTy
57
57
  friend class SVFIRReader;
58
58
 
59
59
  public:
60
- /// 22 kinds of ICFG node
61
- /// Gep represents offset edge for field sensitivity
62
- enum ICFGNodeK
63
- {
64
- IntraBlock,
65
- FunEntryBlock,
66
- FunExitBlock,
67
- FunCallBlock,
68
- FunRetBlock,
69
- GlobalBlock
70
- };
71
60
 
72
61
  typedef ICFGEdge::ICFGEdgeSetTy::iterator iterator;
73
62
  typedef ICFGEdge::ICFGEdgeSetTy::const_iterator const_iterator;
@@ -75,10 +64,11 @@ public:
75
64
  typedef Set<const RetPE *> RetPESet;
76
65
  typedef std::list<const VFGNode*> VFGNodeList;
77
66
  typedef std::list<const SVFStmt*> SVFStmtList;
67
+ typedef GNodeK ICFGNodeK;
78
68
 
79
69
  public:
80
70
  /// Constructor
81
- ICFGNode(NodeID i, ICFGNodeK k) : GenericICFGNodeTy(i, k), fun(nullptr), bb(nullptr)
71
+ ICFGNode(NodeID i, GNodeK k) : GenericICFGNodeTy(i, k), fun(nullptr), bb(nullptr)
82
72
  {
83
73
  }
84
74
 
@@ -136,6 +126,22 @@ public:
136
126
 
137
127
  void dump() const;
138
128
 
129
+
130
+ static inline bool classof(const ICFGNode *)
131
+ {
132
+ return true;
133
+ }
134
+
135
+ static inline bool classof(const GenericICFGNodeTy* node)
136
+ {
137
+ return isICFGNodeKinds(node->getNodeKind());
138
+ }
139
+
140
+ static inline bool classof(const SVFBaseNode* node)
141
+ {
142
+ return isICFGNodeKinds(node->getNodeKind());
143
+ }
144
+
139
145
  protected:
140
146
  const SVFFunction* fun;
141
147
  const SVFBasicBlock* bb;
@@ -248,26 +254,28 @@ public:
248
254
  return true;
249
255
  }
250
256
 
251
- static inline bool classof(const ICFGNode *node)
257
+ static inline bool classof(const ICFGNode* node)
252
258
  {
253
- return node->getNodeKind() == FunEntryBlock
254
- || node->getNodeKind() == FunExitBlock
255
- || node->getNodeKind() == FunCallBlock
256
- || node->getNodeKind() == FunRetBlock;
259
+ return isInterICFGNodeKind(node->getNodeKind());
257
260
  }
258
261
 
259
- static inline bool classof(const GenericICFGNodeTy *node)
262
+ static inline bool classof(const GenericICFGNodeTy* node)
260
263
  {
261
- return node->getNodeKind() == FunEntryBlock
262
- || node->getNodeKind() == FunExitBlock
263
- || node->getNodeKind() == FunCallBlock
264
- || node->getNodeKind() == FunRetBlock;
264
+ return isInterICFGNodeKind(node->getNodeKind());
265
265
  }
266
+
267
+ static inline bool classof(const SVFBaseNode* node)
268
+ {
269
+ return isInterICFGNodeKind(node->getNodeKind());
270
+ }
271
+
266
272
  //@}
267
273
  virtual const std::string getSourceLoc() const = 0;
268
274
  };
269
275
 
270
276
 
277
+
278
+
271
279
  /*!
272
280
  * Function entry ICFGNode containing a set of FormalParmVFGNodes of a function
273
281
  */
@@ -326,6 +334,11 @@ public:
326
334
  {
327
335
  return node->getNodeKind() == FunEntryBlock;
328
336
  }
337
+
338
+ static inline bool classof(const SVFBaseNode*node)
339
+ {
340
+ return node->getNodeKind() == FunEntryBlock;
341
+ }
329
342
  //@}
330
343
 
331
344
  const virtual std::string toString() const;
@@ -392,6 +405,11 @@ public:
392
405
  {
393
406
  return node->getNodeKind() == FunExitBlock;
394
407
  }
408
+
409
+ static inline bool classof(const SVFBaseNode*node)
410
+ {
411
+ return node->getNodeKind() == FunExitBlock;
412
+ }
395
413
  //@}
396
414
 
397
415
  virtual const std::string toString() const;
@@ -482,6 +500,12 @@ public:
482
500
  {
483
501
  return SVFUtil::cast<SVFCallInst>(cs)->getArgOperand(ArgNo);
484
502
  }
503
+
504
+ const SVFVar* getArgumentVar(u32_t ArgNo) const
505
+ {
506
+ return getActualParms()[ArgNo];
507
+ }
508
+
485
509
  const SVFType* getType() const
486
510
  {
487
511
  return SVFUtil::cast<SVFCallInst>(cs)->getType();
@@ -556,6 +580,11 @@ public:
556
580
  {
557
581
  return node->getNodeKind() == FunCallBlock;
558
582
  }
583
+
584
+ static inline bool classof(const SVFBaseNode*node)
585
+ {
586
+ return node->getNodeKind() == FunCallBlock;
587
+ }
559
588
  //@}
560
589
 
561
590
  virtual const std::string toString() const;
@@ -637,6 +666,10 @@ public:
637
666
  {
638
667
  return node->getNodeKind() == FunRetBlock;
639
668
  }
669
+ static inline bool classof(const SVFBaseNode*node)
670
+ {
671
+ return node->getNodeKind() == FunRetBlock;
672
+ }
640
673
  //@}
641
674
 
642
675
  virtual const std::string toString() const;
@@ -420,7 +420,7 @@ protected:
420
420
  inline void addActualINSVFGNode(const CallICFGNode* callsite, const MRVer* ver, const NodeID nodeId)
421
421
  {
422
422
  ActualINSVFGNode* sNode = new ActualINSVFGNode(nodeId, callsite, ver);
423
- addSVFGNode(sNode,pag->getICFG()->getCallICFGNode(callsite->getCallSite()));
423
+ addSVFGNode(sNode, const_cast<CallICFGNode*>(callsite));
424
424
  callSiteToActualINMap[callsite].set(sNode->getId());
425
425
  }
426
426
 
@@ -428,7 +428,7 @@ protected:
428
428
  inline void addActualOUTSVFGNode(const CallICFGNode* callsite, const MRVer* resVer, const NodeID nodeId)
429
429
  {
430
430
  ActualOUTSVFGNode* sNode = new ActualOUTSVFGNode(nodeId, callsite, resVer);
431
- addSVFGNode(sNode, pag->getICFG()->getRetICFGNode(callsite->getCallSite()));
431
+ addSVFGNode(sNode,const_cast<RetICFGNode*>(callsite->getRetICFGNode()));
432
432
  setDef(resVer,sNode);
433
433
  callSiteToActualOUTMap[callsite].set(sNode->getId());
434
434
  }
@@ -64,23 +64,11 @@ public:
64
64
  }
65
65
  static inline bool classof(const VFGNode *node)
66
66
  {
67
- return node->getNodeKind() == FPIN ||
68
- node->getNodeKind() == FPOUT ||
69
- node->getNodeKind() == APIN ||
70
- node->getNodeKind() == APOUT ||
71
- node->getNodeKind() == MPhi ||
72
- node->getNodeKind() == MIntraPhi ||
73
- node->getNodeKind() == MInterPhi;
67
+ return isMRSVFGNodeKinds(node->getNodeKind());
74
68
  }
75
69
  static inline bool classof(const GenericVFGNodeTy *node)
76
70
  {
77
- return node->getNodeKind() == FPIN ||
78
- node->getNodeKind() == FPOUT ||
79
- node->getNodeKind() == APIN ||
80
- node->getNodeKind() == APOUT ||
81
- node->getNodeKind() == MPhi ||
82
- node->getNodeKind() == MIntraPhi ||
83
- node->getNodeKind() == MInterPhi;
71
+ return isMRSVFGNodeKinds(node->getNodeKind());
84
72
  }
85
73
  //@}
86
74
 
@@ -328,15 +316,15 @@ public:
328
316
  }
329
317
  static inline bool classof(const MRSVFGNode *node)
330
318
  {
331
- return (node->getNodeKind() == MPhi || node->getNodeKind() == MIntraPhi || node->getNodeKind() == MInterPhi);
319
+ return isMSSAPHISVFGNodeKinds(node->getNodeKind());
332
320
  }
333
321
  static inline bool classof(const VFGNode *node)
334
322
  {
335
- return (node->getNodeKind() == MPhi || node->getNodeKind() == MIntraPhi || node->getNodeKind() == MInterPhi);
323
+ return isMSSAPHISVFGNodeKinds(node->getNodeKind());
336
324
  }
337
325
  static inline bool classof(const GenericVFGNodeTy *node)
338
326
  {
339
- return (node->getNodeKind() == MPhi || node->getNodeKind() == MIntraPhi || node->getNodeKind() == MInterPhi);
327
+ return isMSSAPHISVFGNodeKinds(node->getNodeKind());
340
328
  }
341
329
  //@}
342
330
 
@@ -252,7 +252,8 @@ private:
252
252
  inline InterPHISVFGNode* addInterPHIForAR(const ActualRetSVFGNode* ar)
253
253
  {
254
254
  InterPHISVFGNode* sNode = new InterPHISVFGNode(totalVFGNode++,ar);
255
- addSVFGNode(sNode, pag->getICFG()->getRetICFGNode(ar->getCallSite()->getCallSite()));
255
+ addSVFGNode(sNode, const_cast<RetICFGNode*>(
256
+ ar->getCallSite()->getRetICFGNode()));
256
257
  resetDef(ar->getRev(),sNode);
257
258
  return sNode;
258
259
  }
@@ -31,13 +31,13 @@
31
31
  #define RCG_H_
32
32
 
33
33
  #include "Graphs/CallGraph.h"
34
- #include "MemoryModel/PointerAnalysisImpl.h"
35
34
 
36
35
  namespace SVF
37
36
  {
38
37
 
39
38
  class SVFModule;
40
39
  class ThreadAPI;
40
+ class PointerAnalysis;
41
41
  /*!
42
42
  * PTA thread fork edge from fork site to the entry of a start routine function
43
43
  */
@@ -201,7 +201,8 @@ public:
201
201
  /// whether this call instruction has a valid call graph edge
202
202
  inline bool hasThreadForkEdge(const CallICFGNode* cs) const
203
203
  {
204
- return callinstToThreadForkEdgesMap.find(cs) != callinstToThreadForkEdgesMap.end();
204
+ return callinstToThreadForkEdgesMap.find(cs) !=
205
+ callinstToThreadForkEdgesMap.end();
205
206
  }
206
207
  inline ForkEdgeSet::const_iterator getForkEdgeBegin(const CallICFGNode* cs) const
207
208
  {
@@ -345,8 +346,8 @@ public:
345
346
 
346
347
  /// Add direct/indirect thread fork edges
347
348
  //@{
348
- void addDirectForkEdge(const CallICFGNode* cs);
349
- void addIndirectForkEdge(const CallICFGNode* cs, const SVFFunction* callee);
349
+ bool addDirectForkEdge(const CallICFGNode* cs);
350
+ bool addIndirectForkEdge(const CallICFGNode* cs, const SVFFunction* callee);
350
351
  //@}
351
352
 
352
353
  /// Add thread join edges
@@ -530,7 +530,7 @@ protected:
530
530
  inline void addActualParmVFGNode(const PAGNode* aparm, const CallICFGNode* cs)
531
531
  {
532
532
  ActualParmVFGNode* sNode = new ActualParmVFGNode(totalVFGNode++,aparm,cs);
533
- addVFGNode(sNode, pag->getICFG()->getCallICFGNode(cs->getCallSite()));
533
+ addVFGNode(sNode, const_cast<CallICFGNode*>(cs));
534
534
  PAGNodeToActualParmMap[std::make_pair(aparm->getId(),cs)] = sNode;
535
535
  /// do not set def here, this node is not a variable definition
536
536
  }
@@ -571,7 +571,7 @@ protected:
571
571
  inline void addActualRetVFGNode(const PAGNode* ret,const CallICFGNode* cs)
572
572
  {
573
573
  ActualRetVFGNode* sNode = new ActualRetVFGNode(totalVFGNode++,ret,cs);
574
- addVFGNode(sNode, pag->getICFG()->getRetICFGNode(cs->getCallSite()));
574
+ addVFGNode(sNode, const_cast<RetICFGNode*>(cs->getRetICFGNode()));
575
575
  setDef(ret,sNode);
576
576
  PAGNodeToActualRetMap[ret] = sNode;
577
577
  }
@@ -49,12 +49,7 @@ class VFGNode : public GenericVFGNodeTy
49
49
  public:
50
50
  /// 25 kinds of ICFG node
51
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
- APIN, APOUT, FPIN, FPOUT, NPtr, DummyVProp
57
- };
52
+ typedef GNodeK VFGNodeK;
58
53
 
59
54
  typedef VFGEdge::VFGEdgeSetTy::iterator iterator;
60
55
  typedef VFGEdge::VFGEdgeSetTy::const_iterator const_iterator;
@@ -106,6 +101,22 @@ public:
106
101
 
107
102
  virtual const std::string toString() const;
108
103
 
104
+ static inline bool classof(const VFGNode *)
105
+ {
106
+ return true;
107
+ }
108
+
109
+ static inline bool classof(const GenericVFGNodeTy * node)
110
+ {
111
+ return isVFGNodeKinds(node->getNodeKind());
112
+ }
113
+
114
+
115
+ static inline bool classof(const SVFBaseNode* node)
116
+ {
117
+ return isVFGNodeKinds(node->getNodeKind());
118
+ }
119
+
109
120
  protected:
110
121
  const ICFGNode* icfgNode;
111
122
  };
@@ -167,19 +178,15 @@ public:
167
178
  }
168
179
  static inline bool classof(const VFGNode *node)
169
180
  {
170
- return node->getNodeKind() == Addr
171
- || node->getNodeKind() == Copy
172
- || node->getNodeKind() == Gep
173
- || node->getNodeKind() == Store
174
- || node->getNodeKind() == Load;
181
+ return isStmtVFGNodeKinds(node->getNodeKind());
175
182
  }
176
183
  static inline bool classof(const GenericVFGNodeTy *node)
177
184
  {
178
- return node->getNodeKind() == Addr
179
- || node->getNodeKind() == Copy
180
- || node->getNodeKind() == Gep
181
- || node->getNodeKind() == Store
182
- || node->getNodeKind() == Load;
185
+ return isStmtVFGNodeKinds(node->getNodeKind());
186
+ }
187
+ static inline bool classof(const SVFBaseNode*node)
188
+ {
189
+ return isStmtVFGNodeKinds(node->getNodeKind());
183
190
  }
184
191
  //@}
185
192
 
@@ -221,6 +228,10 @@ public:
221
228
  {
222
229
  return node->getNodeKind() == Load;
223
230
  }
231
+ static inline bool classof(const SVFBaseNode*node)
232
+ {
233
+ return node->getNodeKind() == Load;
234
+ }
224
235
  //@}
225
236
 
226
237
  const NodeBS getDefSVFVars() const override;
@@ -262,6 +273,10 @@ public:
262
273
  {
263
274
  return node->getNodeKind() == Store;
264
275
  }
276
+ static inline bool classof(const SVFBaseNode*node)
277
+ {
278
+ return node->getNodeKind() == Store;
279
+ }
265
280
  //@}
266
281
 
267
282
  const NodeBS getDefSVFVars() const override;
@@ -303,6 +318,10 @@ public:
303
318
  {
304
319
  return node->getNodeKind() == Copy;
305
320
  }
321
+ static inline bool classof(const SVFBaseNode*node)
322
+ {
323
+ return node->getNodeKind() == Copy;
324
+ }
306
325
  //@}
307
326
 
308
327
  const NodeBS getDefSVFVars() const override;
@@ -345,6 +364,10 @@ public:
345
364
  {
346
365
  return node->getNodeKind() == Cmp;
347
366
  }
367
+ static inline bool classof(const SVFBaseNode*node)
368
+ {
369
+ return node->getNodeKind() == Cmp;
370
+ }
348
371
  //@}
349
372
  /// Operands at a BinaryNode
350
373
  //@{
@@ -416,6 +439,10 @@ public:
416
439
  {
417
440
  return node->getNodeKind() == BinaryOp;
418
441
  }
442
+ static inline bool classof(const SVFBaseNode*node)
443
+ {
444
+ return node->getNodeKind() == BinaryOp;
445
+ }
419
446
  //@}
420
447
  /// Operands at a BinaryNode
421
448
  //@{
@@ -486,6 +513,10 @@ public:
486
513
  {
487
514
  return node->getNodeKind() == UnaryOp;
488
515
  }
516
+ static inline bool classof(const SVFBaseNode*node)
517
+ {
518
+ return node->getNodeKind() == UnaryOp;
519
+ }
489
520
  //@}
490
521
  /// Operands at a UnaryNode
491
522
  //@{
@@ -554,6 +585,10 @@ public:
554
585
  {
555
586
  return node->getNodeKind() == Branch;
556
587
  }
588
+ static inline bool classof(const SVFBaseNode*node)
589
+ {
590
+ return node->getNodeKind() == Branch;
591
+ }
557
592
  //@}
558
593
 
559
594
  /// Return the branch statement
@@ -616,6 +651,10 @@ public:
616
651
  {
617
652
  return node->getNodeKind() == Gep;
618
653
  }
654
+ static inline bool classof(const SVFBaseNode*node)
655
+ {
656
+ return node->getNodeKind() == Gep;
657
+ }
619
658
  //@}
620
659
 
621
660
  const NodeBS getDefSVFVars() const override;
@@ -683,11 +722,15 @@ public:
683
722
  }
684
723
  static inline bool classof(const VFGNode *node)
685
724
  {
686
- return (node->getNodeKind() == TPhi || node->getNodeKind() == TIntraPhi || node->getNodeKind() == TInterPhi);
725
+ return isPHIVFGNodeKinds(node->getNodeKind());
687
726
  }
688
727
  static inline bool classof(const GenericVFGNodeTy *node)
689
728
  {
690
- return (node->getNodeKind() == TPhi || node->getNodeKind() == TIntraPhi || node->getNodeKind() == TInterPhi);
729
+ return isPHIVFGNodeKinds(node->getNodeKind());
730
+ }
731
+ static inline bool classof(const SVFBaseNode*node)
732
+ {
733
+ return isPHIVFGNodeKinds(node->getNodeKind());
691
734
  }
692
735
  //@}
693
736
 
@@ -745,6 +788,10 @@ public:
745
788
  {
746
789
  return node->getNodeKind() == TIntraPhi;
747
790
  }
791
+ static inline bool classof(const SVFBaseNode*node)
792
+ {
793
+ return node->getNodeKind() == TIntraPhi;
794
+ }
748
795
  //@}
749
796
 
750
797
  const std::string toString() const override;
@@ -782,6 +829,10 @@ public:
782
829
  {
783
830
  return node->getNodeKind() == Addr;
784
831
  }
832
+ static inline bool classof(const SVFBaseNode*node)
833
+ {
834
+ return node->getNodeKind() == Addr;
835
+ }
785
836
  //@}
786
837
 
787
838
  const NodeBS getDefSVFVars() const override;
@@ -816,17 +867,15 @@ public:
816
867
  }
817
868
  static inline bool classof(const VFGNode *node)
818
869
  {
819
- return node->getNodeKind() == FRet
820
- || node->getNodeKind() == ARet
821
- || node->getNodeKind() == AParm
822
- || node->getNodeKind() == FParm;
870
+ return isArgumentVFGNodeKinds(node->getNodeKind());
823
871
  }
824
872
  static inline bool classof(const GenericVFGNodeTy *node)
825
873
  {
826
- return node->getNodeKind() == FRet
827
- || node->getNodeKind() == ARet
828
- || node->getNodeKind() == AParm
829
- || node->getNodeKind() == FParm;
874
+ return isArgumentVFGNodeKinds(node->getNodeKind());
875
+ }
876
+ static inline bool classof(const SVFBaseNode*node)
877
+ {
878
+ return isArgumentVFGNodeKinds(node->getNodeKind());
830
879
  }
831
880
  //@}
832
881
 
@@ -878,6 +927,10 @@ public:
878
927
  {
879
928
  return node->getNodeKind() == AParm;
880
929
  }
930
+ static inline bool classof(const SVFBaseNode*node)
931
+ {
932
+ return node->getNodeKind() == AParm;
933
+ }
881
934
  //@}
882
935
 
883
936
  const NodeBS getDefSVFVars() const override;
@@ -948,6 +1001,10 @@ public:
948
1001
  {
949
1002
  return node->getNodeKind() == FParm;
950
1003
  }
1004
+ static inline bool classof(const SVFBaseNode*node)
1005
+ {
1006
+ return node->getNodeKind() == FParm;
1007
+ }
951
1008
  //@}
952
1009
 
953
1010
  const NodeBS getDefSVFVars() const override;
@@ -1006,6 +1063,10 @@ public:
1006
1063
  {
1007
1064
  return node->getNodeKind() == ARet;
1008
1065
  }
1066
+ static inline bool classof(const SVFBaseNode*node)
1067
+ {
1068
+ return node->getNodeKind() == ARet;
1069
+ }
1009
1070
  //@}
1010
1071
 
1011
1072
  const NodeBS getDefSVFVars() const override;
@@ -1072,6 +1133,10 @@ public:
1072
1133
  {
1073
1134
  return node->getNodeKind() == FRet;
1074
1135
  }
1136
+ static inline bool classof(const SVFBaseNode*node)
1137
+ {
1138
+ return node->getNodeKind() == FRet;
1139
+ }
1075
1140
  //@}
1076
1141
 
1077
1142
  const NodeBS getDefSVFVars() const override;
@@ -1131,6 +1196,10 @@ public:
1131
1196
  {
1132
1197
  return node->getNodeKind() == TInterPhi;
1133
1198
  }
1199
+ static inline bool classof(const SVFBaseNode*node)
1200
+ {
1201
+ return node->getNodeKind() == TInterPhi;
1202
+ }
1134
1203
  //@}
1135
1204
 
1136
1205
  const std::string toString() const override;
@@ -1179,6 +1248,10 @@ public:
1179
1248
  {
1180
1249
  return node->getNodeKind() == NPtr;
1181
1250
  }
1251
+ static inline bool classof(const SVFBaseNode*node)
1252
+ {
1253
+ return node->getNodeKind() == NPtr;
1254
+ }
1182
1255
  //@}
1183
1256
 
1184
1257
  const NodeBS getDefSVFVars() const override;
@@ -88,7 +88,7 @@ class TCTNode: public GenericTCTNodeTy
88
88
  public:
89
89
  /// Constructor
90
90
  TCTNode(NodeID i, const CxtThread& cctx) :
91
- GenericTCTNodeTy(i, 0), ctx(cctx), multiforked(false)
91
+ GenericTCTNodeTy(i, TCTNodeKd), ctx(cctx), multiforked(false)
92
92
  {
93
93
  }
94
94
 
@@ -123,6 +123,24 @@ public:
123
123
  }
124
124
  //@}
125
125
 
126
+ ///Methods for support type inquiry through isa, cast, and dyn_cast:
127
+ //@{
128
+ static inline bool classof(const TCTNode *)
129
+ {
130
+ return true;
131
+ }
132
+
133
+ static inline bool classof(const GenericTCTNodeTy *node)
134
+ {
135
+ return node->getNodeKind() == TCTNodeKd;
136
+ }
137
+ static inline bool classof(const SVFBaseNode*node)
138
+ {
139
+ return node->getNodeKind() == TCTNodeKd;
140
+ }
141
+ //@}
142
+
143
+
126
144
  private:
127
145
  const CxtThread ctx;
128
146
  bool multiforked;
@@ -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/ThreadCallGraph.h"
38
38
  #include "Graphs/SCC.h"
39
39
  #include "MemoryModel/AbstractPointsToDS.h"
40
40
  #include "MemoryModel/ConditionalPT.h"
@@ -199,6 +199,10 @@ protected:
199
199
  /// On the fly call graph construction
200
200
  virtual void onTheFlyCallGraphSolve(const CallSiteToFunPtrMap& callsites, CallEdgeMap& newEdges);
201
201
 
202
+ /// On the fly thread call graph construction respecting forksite
203
+ virtual void onTheFlyThreadCallGraphSolve(const CallSiteToFunPtrMap& callsites,
204
+ CallEdgeMap& newForkEdges);
205
+
202
206
  /// Normalize points-to information for field-sensitive analysis,
203
207
  /// i.e., replace fieldObj with baseObj if it is field-insensitive
204
208
  virtual void normalizePointsTo();
@@ -282,9 +282,9 @@ private:
282
282
  /// Return true if the predicate of this compare instruction is not equal
283
283
  bool isNECmp(const CmpStmt* cmp) const;
284
284
  /// Return true if this is a test null expression
285
- bool isTestNullExpr(const SVFValue* test) const;
285
+ bool isTestNullExpr(const ICFGNode* test) const;
286
286
  /// Return true if this is a test not null expression
287
- bool isTestNotNullExpr(const SVFValue* test) const;
287
+ bool isTestNotNullExpr(const ICFGNode* test) const;
288
288
  /// Return true if two values on the predicate are what we want
289
289
  bool isTestContainsNullAndTheValue(const CmpStmt* cmp) const;
290
290
  //@}
@@ -1064,7 +1064,7 @@ public:
1064
1064
  }
1065
1065
 
1066
1066
  private:
1067
- using GNodeK = GenericNode<int, GenericEdge<void>>::GNodeK;
1067
+ using GNodeK = s32_t;
1068
1068
  using GEdgeFlag = GenericEdge<void>::GEdgeFlag;
1069
1069
  using GEdgeKind = GenericEdge<void>::GEdgeKind;
1070
1070
  static ICFGNode* createICFGNode(NodeID id, GNodeK type);
@@ -531,9 +531,9 @@ private:
531
531
  /// add node into SVFIR
532
532
  //@{
533
533
  /// Add a value (pointer) node
534
- inline NodeID addValNode(const SVFValue* val, NodeID i)
534
+ inline NodeID addValNode(const SVFValue* val, NodeID i, const SVFBaseNode* gNode)
535
535
  {
536
- SVFVar *node = new ValVar(val,i);
536
+ SVFVar *node = new ValVar(val,i, ValVar::ValNode, gNode);
537
537
  return addValNode(val, node, i);
538
538
  }
539
539
  /// Add a memory obj node