svf-lib 1.0.2452 → 1.0.2453

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 (29) hide show
  1. package/SVF-linux-x86_64/bin/ae +0 -0
  2. package/SVF-linux-x86_64/bin/cfl +0 -0
  3. package/SVF-linux-x86_64/bin/dvf +0 -0
  4. package/SVF-linux-x86_64/bin/mta +0 -0
  5. package/SVF-linux-x86_64/bin/saber +0 -0
  6. package/SVF-linux-x86_64/bin/svf-ex +0 -0
  7. package/SVF-linux-x86_64/bin/wpa +0 -0
  8. package/SVF-linux-x86_64/include/Graphs/BasicBlockG.h +18 -4
  9. package/SVF-linux-x86_64/include/Graphs/CHG.h +12 -0
  10. package/SVF-linux-x86_64/include/Graphs/CallGraph.h +14 -2
  11. package/SVF-linux-x86_64/include/Graphs/ICFG.h +24 -8
  12. package/SVF-linux-x86_64/include/Graphs/ICFGEdge.h +1 -0
  13. package/SVF-linux-x86_64/include/Graphs/ICFGNode.h +39 -6
  14. package/SVF-linux-x86_64/include/Graphs/IRGraph.h +12 -0
  15. package/SVF-linux-x86_64/include/MemoryModel/AccessPath.h +7 -1
  16. package/SVF-linux-x86_64/include/SVF-LLVM/ICFGBuilder.h +1 -1
  17. package/SVF-linux-x86_64/include/SVF-LLVM/SVFIRBuilder.h +1 -0
  18. package/SVF-linux-x86_64/include/SVFIR/ObjTypeInfo.h +5 -0
  19. package/SVF-linux-x86_64/include/SVFIR/SVFIR.h +61 -39
  20. package/SVF-linux-x86_64/include/SVFIR/SVFStatements.h +125 -10
  21. package/SVF-linux-x86_64/include/SVFIR/SVFType.h +97 -1
  22. package/SVF-linux-x86_64/include/SVFIR/SVFValue.h +1 -0
  23. package/SVF-linux-x86_64/include/SVFIR/SVFVariables.h +164 -4
  24. package/SVF-linux-x86_64/include/Util/ExtAPI.h +1 -0
  25. package/SVF-linux-x86_64/include/Util/NodeIDAllocator.h +11 -0
  26. package/SVF-linux-x86_64/include/Util/SVFLoopAndDomInfo.h +37 -0
  27. package/SVF-linux-x86_64/lib/libSvfCore.so.3.2 +0 -0
  28. package/SVF-linux-x86_64/lib/libSvfLLVM.so.3.2 +0 -0
  29. package/package.json +1 -1
@@ -52,6 +52,7 @@ class SVFVar : public GenericPAGNodeTy
52
52
  friend class IRGraph;
53
53
  friend class SVFIR;
54
54
  friend class VFG;
55
+ friend class GraphDBClient;
55
56
 
56
57
  public:
57
58
  /// Node kinds for SVFIR variables:
@@ -71,8 +72,16 @@ protected:
71
72
  SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap;
72
73
  SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap;
73
74
 
74
- /// Empty constructor for deserialization
75
- SVFVar(NodeID i, PNODEK k) : GenericPAGNodeTy(i, k) {}
75
+ inline const SVFStmt::KindToSVFStmtMapTy& getInEdgeKindToSetMap() const
76
+ {
77
+ return InEdgeKindToSetMap;
78
+ }
79
+
80
+
81
+ inline const SVFStmt::KindToSVFStmtMapTy& getOutEdgeKindToSetMap() const
82
+ {
83
+ return OutEdgeKindToSetMap;
84
+ }
76
85
 
77
86
 
78
87
  public:
@@ -247,10 +256,16 @@ public:
247
256
  */
248
257
  class ValVar: public SVFVar
249
258
  {
259
+ friend class GraphDBClient;
250
260
 
251
261
  private:
252
262
  const ICFGNode* icfgNode; // icfgnode related to valvar
263
+ protected:
253
264
 
265
+ inline void setICFGNode(const ICFGNode* icfgNode)
266
+ {
267
+ this->icfgNode = icfgNode;
268
+ }
254
269
  public:
255
270
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
256
271
  //@{
@@ -291,6 +306,9 @@ public:
291
306
  virtual const FunObjVar* getFunction() const;
292
307
 
293
308
  virtual const std::string toString() const;
309
+
310
+ std::string getValVarNodeFieldsStmt() const;
311
+
294
312
  };
295
313
 
296
314
  /*
@@ -298,6 +316,7 @@ public:
298
316
  */
299
317
  class ObjVar: public SVFVar
300
318
  {
319
+ friend class GraphDBClient;
301
320
 
302
321
  protected:
303
322
  /// Constructor
@@ -333,6 +352,9 @@ public:
333
352
  }
334
353
 
335
354
  virtual const std::string toString() const;
355
+
356
+ std::string getObjVarNodeFieldsStmt() const;
357
+
336
358
  };
337
359
 
338
360
 
@@ -344,6 +366,7 @@ public:
344
366
  */
345
367
  class ArgValVar: public ValVar
346
368
  {
369
+ friend class GraphDBClient;
347
370
 
348
371
  private:
349
372
  const FunObjVar* cgNode;
@@ -384,6 +407,11 @@ public:
384
407
  return getName() + " (argument valvar)";
385
408
  }
386
409
 
410
+ inline void addCGNodeFromDB(const FunObjVar* cgNode)
411
+ {
412
+ this->cgNode = cgNode;
413
+ }
414
+
387
415
  virtual const FunObjVar* getFunction() const;
388
416
 
389
417
  const FunObjVar* getParent() const;
@@ -410,11 +438,14 @@ public:
410
438
  */
411
439
  class GepValVar: public ValVar
412
440
  {
441
+ friend class GraphDBClient;
413
442
 
414
443
  private:
415
444
  AccessPath ap; // AccessPath
416
445
  const ValVar* base; // base node
417
446
  const SVFType* gepValType;
447
+ NodeID llvmVarID;
448
+
418
449
 
419
450
  public:
420
451
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -439,6 +470,16 @@ public:
439
470
  {
440
471
  return node->getNodeKind() == SVFVar::GepValNode;
441
472
  }
473
+
474
+ inline const AccessPath& getAccessPath() const
475
+ {
476
+ return ap;
477
+ }
478
+
479
+ inline const void setAccessPath(const AccessPath* ap)
480
+ {
481
+ this->ap = *ap;
482
+ }
442
483
  //@}
443
484
 
444
485
  /// Constructor
@@ -456,6 +497,10 @@ public:
456
497
  {
457
498
  return base;
458
499
  }
500
+ inline void setBaseNode(const ValVar* baseNode)
501
+ {
502
+ base = baseNode;
503
+ }
459
504
 
460
505
  /// Return name of a LLVM value
461
506
  inline const std::string getValueName() const
@@ -494,6 +539,18 @@ public:
494
539
  {
495
540
  return base->isConstDataOrAggData();
496
541
  }
542
+
543
+ /// Get the LLVM variable ID associated with this GepValVar
544
+ inline NodeID getLLVMVarInstID() const
545
+ {
546
+ return llvmVarID;
547
+ }
548
+
549
+ /// Set the LLVM variable ID associated with this GepValVar
550
+ inline void setLLVMVarInstID(NodeID id)
551
+ {
552
+ llvmVarID = id;
553
+ }
497
554
  };
498
555
 
499
556
  /*
@@ -502,6 +559,8 @@ public:
502
559
  class BaseObjVar : public ObjVar
503
560
  {
504
561
  friend class SVFIRBuilder;
562
+ friend class GraphDBClient;
563
+
505
564
  private:
506
565
  ObjTypeInfo* typeInfo;
507
566
 
@@ -543,12 +602,26 @@ public:
543
602
  return this;
544
603
  }
545
604
 
605
+ inline const ObjTypeInfo* getTypeInfo() const
606
+ {
607
+ return typeInfo;
608
+ }
609
+ inline ObjTypeInfo* getTypeInfo()
610
+ {
611
+ return typeInfo;
612
+ }
613
+
546
614
  /// Get the ICFGNode related to the creation of this object
547
615
  inline const ICFGNode* getICFGNode() const
548
616
  {
549
617
  return icfgNode;
550
618
  }
551
619
 
620
+ inline void setICFGNode(const ICFGNode* node)
621
+ {
622
+ icfgNode = node;
623
+ }
624
+
552
625
  /// Return name of a LLVM value
553
626
  inline const std::string getValueName() const
554
627
  {
@@ -563,6 +636,12 @@ public:
563
636
  return id;
564
637
  }
565
638
 
639
+ /// Get obj type
640
+ const SVFType* getType() const
641
+ {
642
+ return typeInfo->getType();
643
+ }
644
+
566
645
  /// Get the number of elements of this object
567
646
  u32_t getNumOfElements() const
568
647
  {
@@ -691,6 +770,8 @@ public:
691
770
  */
692
771
  class GepObjVar: public ObjVar
693
772
  {
773
+ friend class GraphDBClient;
774
+
694
775
 
695
776
  private:
696
777
  APOffset apOffset = 0;
@@ -795,6 +876,8 @@ public:
795
876
  class HeapObjVar: public BaseObjVar
796
877
  {
797
878
 
879
+ friend class GraphDBClient;
880
+
798
881
  public:
799
882
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
800
883
  //@{
@@ -851,6 +934,9 @@ public:
851
934
  class StackObjVar: public BaseObjVar
852
935
  {
853
936
 
937
+ friend class GraphDBClient;
938
+
939
+
854
940
  public:
855
941
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
856
942
  //@{
@@ -902,6 +988,27 @@ class FunObjVar : public BaseObjVar
902
988
  {
903
989
  friend class SVFIRBuilder;
904
990
  friend class LLVMModuleSet;
991
+ friend class GraphDBClient;
992
+
993
+ protected:
994
+
995
+ inline void updateExitBlock(SVFBasicBlock *bb)
996
+ {
997
+ exitBlock = bb;
998
+ }
999
+
1000
+ inline void setLoopAndDomInfo(SVFLoopAndDomInfo *ld)
1001
+ {
1002
+ loopAndDom = ld;
1003
+ }
1004
+ inline bool getIsNotRet() const
1005
+ {
1006
+ return isNotRet;
1007
+ }
1008
+ inline const std::vector<const ArgValVar*> &getArgs() const
1009
+ {
1010
+ return allArgs;
1011
+ }
905
1012
 
906
1013
  public:
907
1014
  typedef SVFLoopAndDomInfo::BBSet BBSet;
@@ -925,6 +1032,7 @@ private:
925
1032
  std::vector<const ArgValVar*> allArgs; /// all formal arguments of this function
926
1033
  const SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
927
1034
 
1035
+
928
1036
  public:
929
1037
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
930
1038
  //@{
@@ -1139,7 +1247,6 @@ public:
1139
1247
  assert (idx < allArgs.size() && "getArg() out of range!");
1140
1248
  return allArgs[idx];
1141
1249
  }
1142
-
1143
1250
  inline const SVFBasicBlock* front() const
1144
1251
  {
1145
1252
  return getEntryBlock();
@@ -1171,6 +1278,14 @@ public:
1171
1278
  class FunValVar : public ValVar
1172
1279
  {
1173
1280
 
1281
+ friend class GraphDBClient;
1282
+
1283
+ protected:
1284
+ inline void setFunction(const FunObjVar* cgn)
1285
+ {
1286
+ funObjVar = cgn;
1287
+ }
1288
+
1174
1289
  private:
1175
1290
  const FunObjVar* funObjVar;
1176
1291
 
@@ -1220,6 +1335,8 @@ public:
1220
1335
 
1221
1336
  class GlobalValVar : public ValVar
1222
1337
  {
1338
+ friend class GraphDBClient;
1339
+
1223
1340
 
1224
1341
  public:
1225
1342
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -1259,6 +1376,8 @@ public:
1259
1376
 
1260
1377
  class ConstAggValVar: public ValVar
1261
1378
  {
1379
+ friend class GraphDBClient;
1380
+
1262
1381
 
1263
1382
  public:
1264
1383
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -1309,6 +1428,8 @@ public:
1309
1428
 
1310
1429
  class ConstDataValVar : public ValVar
1311
1430
  {
1431
+ friend class GraphDBClient;
1432
+
1312
1433
 
1313
1434
  public:
1314
1435
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -1359,6 +1480,7 @@ public:
1359
1480
  class BlackHoleValVar : public ConstDataValVar
1360
1481
  {
1361
1482
 
1483
+ friend class GraphDBClient;
1362
1484
  public:
1363
1485
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
1364
1486
  //@{
@@ -1409,6 +1531,8 @@ public:
1409
1531
  class ConstFPValVar : public ConstDataValVar
1410
1532
  {
1411
1533
 
1534
+ friend class GraphDBClient;
1535
+
1412
1536
  private:
1413
1537
  double dval;
1414
1538
 
@@ -1459,6 +1583,9 @@ public:
1459
1583
  class ConstIntValVar : public ConstDataValVar
1460
1584
  {
1461
1585
 
1586
+ friend class GraphDBClient;
1587
+
1588
+
1462
1589
  private:
1463
1590
  u64_t zval;
1464
1591
  s64_t sval;
@@ -1514,6 +1641,7 @@ public:
1514
1641
 
1515
1642
  class ConstNullPtrValVar : public ConstDataValVar
1516
1643
  {
1644
+ friend class GraphDBClient;
1517
1645
 
1518
1646
  public:
1519
1647
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -1561,6 +1689,8 @@ public:
1561
1689
 
1562
1690
  class GlobalObjVar : public BaseObjVar
1563
1691
  {
1692
+ friend class GraphDBClient;
1693
+
1564
1694
 
1565
1695
  public:
1566
1696
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -1604,6 +1734,8 @@ public:
1604
1734
 
1605
1735
  class ConstAggObjVar : public BaseObjVar
1606
1736
  {
1737
+ friend class GraphDBClient;
1738
+
1607
1739
 
1608
1740
  public:
1609
1741
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -1657,6 +1789,7 @@ public:
1657
1789
 
1658
1790
  class ConstDataObjVar : public BaseObjVar
1659
1791
  {
1792
+ friend class GraphDBClient;
1660
1793
 
1661
1794
  public:
1662
1795
  //@{ Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -1709,6 +1842,9 @@ public:
1709
1842
  class ConstFPObjVar : public ConstDataObjVar
1710
1843
  {
1711
1844
 
1845
+ friend class GraphDBClient;
1846
+
1847
+
1712
1848
  private:
1713
1849
  float dval;
1714
1850
 
@@ -1766,6 +1902,10 @@ public:
1766
1902
  class ConstIntObjVar : public ConstDataObjVar
1767
1903
  {
1768
1904
 
1905
+ friend class GraphDBClient;
1906
+
1907
+
1908
+
1769
1909
  private:
1770
1910
  u64_t zval;
1771
1911
  s64_t sval;
@@ -1829,6 +1969,8 @@ public:
1829
1969
  class ConstNullPtrObjVar : public ConstDataObjVar
1830
1970
  {
1831
1971
 
1972
+ friend class GraphDBClient;
1973
+
1832
1974
  public:
1833
1975
  //@{ Methods for support type inquiry through isa, cast, and dyn_cast:
1834
1976
  static inline bool classof(const ConstNullPtrObjVar*)
@@ -1881,6 +2023,13 @@ public:
1881
2023
  */
1882
2024
  class RetValPN : public ValVar
1883
2025
  {
2026
+ friend class GraphDBClient;
2027
+
2028
+ protected:
2029
+ inline void setCallGraphNode(const FunObjVar* node)
2030
+ {
2031
+ callGraphNode = node;
2032
+ }
1884
2033
 
1885
2034
  private:
1886
2035
  const FunObjVar* callGraphNode;
@@ -1934,6 +2083,13 @@ public:
1934
2083
  class VarArgValPN : public ValVar
1935
2084
  {
1936
2085
 
2086
+ friend class GraphDBClient;
2087
+
2088
+ protected:
2089
+ inline void setCallGraphNode(const FunObjVar* node)
2090
+ {
2091
+ callGraphNode = node;
2092
+ }
1937
2093
  private:
1938
2094
  const FunObjVar* callGraphNode;
1939
2095
 
@@ -1984,6 +2140,7 @@ public:
1984
2140
  */
1985
2141
  class DummyValVar: public ValVar
1986
2142
  {
2143
+ friend class GraphDBClient;
1987
2144
 
1988
2145
  public:
1989
2146
  //@{ Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -2035,6 +2192,9 @@ public:
2035
2192
  class DummyObjVar: public BaseObjVar
2036
2193
  {
2037
2194
 
2195
+ friend class GraphDBClient;
2196
+
2197
+
2038
2198
  public:
2039
2199
  //@{ Methods for support type inquiry through isa, cast, and dyn_cast:
2040
2200
  static inline bool classof(const DummyObjVar*)
@@ -2086,4 +2246,4 @@ public:
2086
2246
 
2087
2247
  } // End namespace SVF
2088
2248
 
2089
- #endif /* INCLUDE_SVFIR_SVFVARIABLE_H_ */
2249
+ #endif /* INCLUDE_SVFIR_SVFVARIABLE_H_ */
@@ -47,6 +47,7 @@ class ExtAPI
47
47
  {
48
48
  friend class LLVMModuleSet;
49
49
  friend class SVFIRBuilder;
50
+ friend class GraphDBClient;
50
51
 
51
52
  private:
52
53
 
@@ -89,6 +89,17 @@ public:
89
89
  ++numNodes;
90
90
  }
91
91
 
92
+ inline void increaseNumOfValues()
93
+ {
94
+ ++numValues;
95
+ ++numNodes;
96
+ }
97
+
98
+ inline int getNumOfNodes()
99
+ {
100
+ return numNodes;
101
+ }
102
+
92
103
  private:
93
104
  /// Builds a node ID allocator with the strategy specified on the command line.
94
105
  NodeIDAllocator(void);
@@ -41,6 +41,7 @@ namespace SVF
41
41
  class SVFLoopAndDomInfo
42
42
  {
43
43
 
44
+ friend class GraphDBClient;
44
45
  public:
45
46
  typedef Set<const SVFBasicBlock*> BBSet;
46
47
  typedef std::vector<const SVFBasicBlock*> BBList;
@@ -55,6 +56,42 @@ private:
55
56
  Map<const SVFBasicBlock*, u32_t> bb2PdomLevel; ///< map a BasicBlock to its level in pdom tree, used in findNearestCommonPDominator
56
57
  Map<const SVFBasicBlock*, const SVFBasicBlock*> bb2PIdom; ///< map a BasicBlock to its immediate dominator in pdom tree, used in findNearestCommonPDominator
57
58
 
59
+ protected:
60
+ inline void setDomTreeMap(Map<const SVFBasicBlock*,BBSet>& dtMap)
61
+ {
62
+ dtBBsMap = dtMap;
63
+ }
64
+
65
+ inline void setPostDomTreeMap(Map<const SVFBasicBlock*,BBSet>& pdtMap)
66
+ {
67
+ pdtBBsMap = pdtMap;
68
+ }
69
+
70
+ inline void setDomFrontierMap(Map<const SVFBasicBlock*,BBSet>& dfMap)
71
+ {
72
+ dfBBsMap = dfMap;
73
+ }
74
+
75
+ inline void setBB2LoopMap(Map<const SVFBasicBlock*, LoopBBs>& bb2Loop)
76
+ {
77
+ bb2LoopMap = bb2Loop;
78
+ }
79
+
80
+ inline void setBB2PdomLevel(Map<const SVFBasicBlock*, u32_t>& bb2Pdom)
81
+ {
82
+ bb2PdomLevel = bb2Pdom;
83
+ }
84
+
85
+ inline void setBB2PIdom(Map<const SVFBasicBlock*, const SVFBasicBlock*>& bb2PIdomMap)
86
+ {
87
+ bb2PIdom = bb2PIdomMap;
88
+ }
89
+
90
+ inline const Map<const SVFBasicBlock*, LoopBBs>& getBB2LoopMap() const
91
+ {
92
+ return bb2LoopMap;
93
+ }
94
+
58
95
  public:
59
96
  SVFLoopAndDomInfo()
60
97
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2452",
3
+ "version": "1.0.2453",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {