svf-lib 1.0.2181 → 1.0.2183

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 (32) hide show
  1. package/SVF-linux/Release-build/bin/ae +0 -0
  2. package/SVF-linux/Release-build/bin/cfl +0 -0
  3. package/SVF-linux/Release-build/bin/dvf +0 -0
  4. package/SVF-linux/Release-build/bin/llvm2svf +0 -0
  5. package/SVF-linux/Release-build/bin/mta +0 -0
  6. package/SVF-linux/Release-build/bin/saber +0 -0
  7. package/SVF-linux/Release-build/bin/svf-ex +0 -0
  8. package/SVF-linux/Release-build/bin/wpa +0 -0
  9. package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +19 -19
  10. package/SVF-linux/Release-build/include/SVFIR/SVFVariables.h +12 -12
  11. package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
  12. package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
  13. package/SVF-osx/Release-build/bin/ae +0 -0
  14. package/SVF-osx/Release-build/bin/cfl +0 -0
  15. package/SVF-osx/Release-build/bin/dvf +0 -0
  16. package/SVF-osx/Release-build/bin/llvm2svf +0 -0
  17. package/SVF-osx/Release-build/bin/mta +0 -0
  18. package/SVF-osx/Release-build/bin/saber +0 -0
  19. package/SVF-osx/Release-build/bin/svf-ex +0 -0
  20. package/SVF-osx/Release-build/bin/wpa +0 -0
  21. package/SVF-osx/Release-build/include/DDA/DDAVFSolver.h +5 -7
  22. package/SVF-osx/Release-build/include/Graphs/ConsG.h +2 -2
  23. package/SVF-osx/Release-build/include/Graphs/IRGraph.h +5 -18
  24. package/SVF-osx/Release-build/include/MemoryModel/PointerAnalysis.h +7 -7
  25. package/SVF-osx/Release-build/include/SVF-LLVM/SymbolTableBuilder.h +2 -2
  26. package/SVF-osx/Release-build/include/SVFIR/SVFFileSystem.h +0 -12
  27. package/SVF-osx/Release-build/include/SVFIR/SVFIR.h +84 -106
  28. package/SVF-osx/Release-build/include/SVFIR/SVFVariables.h +239 -84
  29. package/SVF-osx/Release-build/include/SVFIR/SymbolTableInfo.h +18 -136
  30. package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
  31. package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
  32. package/package.json +1 -1
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -572,9 +572,9 @@ private:
572
572
  return addValNode(val, node, i);
573
573
  }
574
574
 
575
- NodeID addFunValNode(const CallGraphNode* callGraphNode, NodeID i, const ICFGNode* icfgNode)
575
+ NodeID addFunValNode(NodeID i, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode)
576
576
  {
577
- FunValVar* node = new FunValVar(callGraphNode, i, icfgNode);
577
+ FunValVar* node = new FunValVar(i, icfgNode, callGraphNode);
578
578
  return addValNode(nullptr, node, i);
579
579
  }
580
580
 
@@ -585,17 +585,17 @@ private:
585
585
  return addValNode(nullptr, node, i);
586
586
  }
587
587
 
588
- inline NodeID addConstantFPValNode(const SVFValue* curInst, double dval, const NodeID i,
588
+ inline NodeID addConstantFPValNode(const SVFValue* curInst, const NodeID i, double dval,
589
589
  const ICFGNode* icfgNode)
590
590
  {
591
- SVFVar* node = new ConstantFPValVar(curInst, dval, i, icfgNode);
591
+ SVFVar* node = new ConstantFPValVar(curInst, i, dval, icfgNode);
592
592
  return addNode(node, i);
593
593
  }
594
594
 
595
- inline NodeID addConstantIntValNode(const SVFValue* curInst, const std::pair<s64_t, u64_t>& intValue, const NodeID i,
595
+ inline NodeID addConstantIntValNode(const SVFValue* curInst, NodeID i, const std::pair<s64_t, u64_t>& intValue,
596
596
  const ICFGNode* icfgNode)
597
597
  {
598
- SVFVar* node = new ConstantIntValVar(curInst, intValue.first, intValue.second, i, icfgNode);
598
+ SVFVar* node = new ConstantIntValVar(curInst, i, intValue.first, intValue.second, icfgNode);
599
599
  return addNode(node, i);
600
600
  }
601
601
 
@@ -629,47 +629,47 @@ private:
629
629
  /**
630
630
  * Creates and adds a heap object node to the SVFIR
631
631
  */
632
- inline NodeID addHeapObjNode(const SVFValue* val, const SVFFunction* f, NodeID i)
632
+ inline NodeID addHeapObjNode(const SVFValue* val, NodeID i, const SVFFunction* f)
633
633
  {
634
634
  const MemObj* mem = getMemObj(val);
635
635
  assert(mem->getId() == i && "not same object id?");
636
636
  memToFieldsMap[i].set(i);
637
- HeapObjVar *node = new HeapObjVar(f, val->getType(), i, mem);
637
+ HeapObjVar *node = new HeapObjVar(i, mem, val->getType(), f);
638
638
  return addObjNode(val, node, i);
639
639
  }
640
640
 
641
641
  /**
642
642
  * Creates and adds a stack object node to the SVFIR
643
643
  */
644
- inline NodeID addStackObjNode(const SVFValue* val, const SVFFunction* f, NodeID i)
644
+ inline NodeID addStackObjNode(const SVFValue* val, NodeID i, const SVFFunction* f)
645
645
  {
646
646
  const MemObj* mem = getMemObj(val);
647
647
  assert(mem->getId() == i && "not same object id?");
648
648
  memToFieldsMap[i].set(i);
649
- StackObjVar *node = new StackObjVar(f, val->getType(), i, mem);
649
+ StackObjVar *node = new StackObjVar(i, mem, val->getType(), f);
650
650
  return addObjNode(val, node, i);
651
651
  }
652
652
 
653
- NodeID addFunObjNode(const CallGraphNode* callGraphNode, NodeID id);
653
+ NodeID addFunObjNode(NodeID id, const CallGraphNode* callGraphNode);
654
654
 
655
655
 
656
- inline NodeID addConstantFPObjNode(const SVFValue* curInst, double dval, const NodeID i)
656
+ inline NodeID addConstantFPObjNode(const SVFValue* curInst, NodeID i, double dval)
657
657
  {
658
658
  const MemObj* mem = getMemObj(curInst);
659
659
  NodeID base = mem->getId();
660
660
  memToFieldsMap[base].set(mem->getId());
661
- ConstantFPObjVar* node = new ConstantFPObjVar(curInst, dval, mem->getId(), mem);
661
+ ConstantFPObjVar* node = new ConstantFPObjVar(curInst, i, dval, mem);
662
662
  return addObjNode(curInst, node, mem->getId());
663
663
  }
664
664
 
665
665
 
666
- inline NodeID addConstantIntObjNode(const SVFValue* curInst, const std::pair<s64_t, u64_t>& intValue, const NodeID i)
666
+ inline NodeID addConstantIntObjNode(const SVFValue* curInst, NodeID i, const std::pair<s64_t, u64_t>& intValue)
667
667
  {
668
668
  const MemObj* mem = getMemObj(curInst);
669
669
  NodeID base = mem->getId();
670
670
  memToFieldsMap[base].set(mem->getId());
671
671
  ConstantIntObjVar* node =
672
- new ConstantIntObjVar(curInst, intValue.first, intValue.second, mem->getId(), mem);
672
+ new ConstantIntObjVar(curInst, i, intValue.first, intValue.second, mem);
673
673
  return addObjNode(curInst, node, mem->getId());
674
674
  }
675
675
 
@@ -702,15 +702,15 @@ private:
702
702
  }
703
703
 
704
704
  /// Add a unique return node for a procedure
705
- inline NodeID addRetNode(const CallGraphNode* callGraphNode, NodeID i)
705
+ inline NodeID addRetNode(NodeID i, const CallGraphNode* callGraphNode)
706
706
  {
707
- SVFVar *node = new RetPN(callGraphNode,i);
707
+ SVFVar *node = new RetPN(i, callGraphNode);
708
708
  return addRetNode(callGraphNode, node, i);
709
709
  }
710
710
  /// Add a unique vararg node for a procedure
711
- inline NodeID addVarargNode(const CallGraphNode* val, NodeID i)
711
+ inline NodeID addVarargNode(NodeID i, const CallGraphNode* val)
712
712
  {
713
- SVFVar *node = new VarArgPN(val,i);
713
+ SVFVar *node = new VarArgPN(i, val);
714
714
  return addNode(node,i);
715
715
  }
716
716
 
@@ -724,8 +724,8 @@ public:
724
724
  //@}
725
725
 
726
726
  /// Constructor
727
- HeapObjVar(const SVFFunction* func, const SVFType* svfType, NodeID i,
728
- const MemObj* mem, PNODEK ty = HeapObjNode);
727
+ HeapObjVar(NodeID i, const MemObj* mem, const SVFType* svfType,
728
+ const SVFFunction* fun, PNODEK ty = HeapObjNode);
729
729
 
730
730
  /// Return name of a LLVM value
731
731
  inline const std::string getValueName() const
@@ -785,8 +785,8 @@ public:
785
785
  //@}
786
786
 
787
787
  /// Constructor
788
- StackObjVar(const SVFFunction* f, const SVFType* svfType, NodeID i,
789
- const MemObj* mem, PNODEK ty = StackObjNode);
788
+ StackObjVar(NodeID i, const MemObj* mem, const SVFType* svfType,
789
+ const SVFFunction* fun, PNODEK ty = StackObjNode);
790
790
 
791
791
  /// Return name of a LLVM value
792
792
  inline const std::string getValueName() const
@@ -838,7 +838,7 @@ public:
838
838
  }
839
839
 
840
840
  /// Constructor
841
- FunValVar(const CallGraphNode* cgn, NodeID i, const ICFGNode* icn,
841
+ FunValVar(NodeID i, const ICFGNode* icn, const CallGraphNode* cgn,
842
842
  PNODEK ty = FunValNode);
843
843
 
844
844
  virtual const std::string toString() const;
@@ -886,7 +886,7 @@ public:
886
886
  //@}
887
887
 
888
888
  /// Constructor
889
- FunObjVar(const CallGraphNode* cgNode, NodeID i, const MemObj* mem,
889
+ FunObjVar(NodeID i, const MemObj* mem, const CallGraphNode* cgNode,
890
890
  PNODEK ty = FunObjNode);
891
891
 
892
892
  inline const CallGraphNode* getCallGraphNode() const
@@ -1069,7 +1069,7 @@ public:
1069
1069
  }
1070
1070
 
1071
1071
  /// Constructor
1072
- ConstantFPValVar(const SVFValue* val, double dv, NodeID i, const ICFGNode* icn,
1072
+ ConstantFPValVar(const SVFValue* val, NodeID i, double dv, const ICFGNode* icn,
1073
1073
  PNODEK ty = ConstantFPValNode)
1074
1074
  : ConstantDataValVar(val, i, icn, ty), dval(dv)
1075
1075
  {
@@ -1128,7 +1128,7 @@ public:
1128
1128
  }
1129
1129
 
1130
1130
  /// Constructor
1131
- ConstantIntValVar(const SVFValue* val, s64_t sv, u64_t zv, NodeID i, const ICFGNode* icn,
1131
+ ConstantIntValVar(const SVFValue* val, NodeID i, s64_t sv, u64_t zv, const ICFGNode* icn,
1132
1132
  PNODEK ty = ConstantIntValNode)
1133
1133
  : ConstantDataValVar(val, i, icn, ty), zval(zv), sval(sv)
1134
1134
  {
@@ -1327,7 +1327,7 @@ public:
1327
1327
  //@}
1328
1328
 
1329
1329
  /// Constructor
1330
- ConstantFPObjVar(const SVFValue* val, double dv, NodeID i, const MemObj* m, PNODEK ty = ConstantFPObjNode)
1330
+ ConstantFPObjVar(const SVFValue* val, NodeID i, double dv, const MemObj* m, PNODEK ty = ConstantFPObjNode)
1331
1331
  : ConstantDataObjVar(val, i, m, ty), dval(dv)
1332
1332
  {
1333
1333
  }
@@ -1402,7 +1402,7 @@ public:
1402
1402
  //@}
1403
1403
 
1404
1404
  /// Constructor
1405
- ConstantIntObjVar(const SVFValue* val, s64_t sv, u64_t zv, NodeID i, const MemObj* m, PNODEK ty = ConstantIntObjNode)
1405
+ ConstantIntObjVar(const SVFValue* val, NodeID i, s64_t sv, u64_t zv, const MemObj* m, PNODEK ty = ConstantIntObjNode)
1406
1406
  : ConstantDataObjVar(val, i, m, ty), zval(zv), sval(sv)
1407
1407
  {
1408
1408
  }
@@ -1505,7 +1505,7 @@ public:
1505
1505
 
1506
1506
 
1507
1507
  /// Constructor
1508
- RetPN(const CallGraphNode* node, NodeID i);
1508
+ RetPN(NodeID i, const CallGraphNode* node);
1509
1509
 
1510
1510
  inline const CallGraphNode* getCallGraphNode() const
1511
1511
  {
@@ -1559,7 +1559,7 @@ public:
1559
1559
  //@}
1560
1560
 
1561
1561
  /// Constructor
1562
- VarArgPN(const CallGraphNode* node, NodeID i) : ValVar(nullptr, i, VarargNode), callGraphNode(node) {}
1562
+ VarArgPN(NodeID i, const CallGraphNode* node) : ValVar(nullptr, i, VarargNode), callGraphNode(node) {}
1563
1563
 
1564
1564
  virtual const SVFFunction* getFunction() const;
1565
1565
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -473,8 +473,6 @@ protected:
473
473
  NodeID id = getPtrNodeID(var);
474
474
  const BaseObjVar* baseObj = _pag->getBaseObject(id);
475
475
  assert(baseObj && "base object is null??");
476
- const MemObj* obj = _pag->getObject(id);
477
- assert(obj && "object not found!!");
478
476
  if(SVFUtil::isa<StackObjVar>(baseObj))
479
477
  {
480
478
  if(const SVFFunction* svffun = _pag->getGNode(id)->getFunction())
@@ -645,14 +643,14 @@ protected:
645
643
 
646
644
  inline bool isArrayCondMemObj(const CVar& var) const
647
645
  {
648
- const MemObj* mem = _pag->getObject(getPtrNodeID(var));
649
- assert(mem && "memory object is null??");
650
- return mem->isArray();
646
+ const BaseObjVar* obj = _pag->getBaseObject(getPtrNodeID(var));
647
+ assert(obj && "base object is null??");
648
+ return obj->isArray();
651
649
  }
652
650
  inline bool isFieldInsenCondMemObj(const CVar& var) const
653
651
  {
654
- const MemObj* mem = _pag->getBaseObj(getPtrNodeID(var));
655
- return mem->isFieldInsensitive();
652
+ const BaseObjVar* baseObj = _pag->getBaseObject(getPtrNodeID(var));
653
+ return baseObj->isFieldInsensitive();
656
654
  }
657
655
  //@}
658
656
  private:
@@ -323,8 +323,8 @@ public:
323
323
  }
324
324
  inline bool isSingleFieldObj(NodeID id) const
325
325
  {
326
- const MemObj* mem = pag->getBaseObj(id);
327
- return (mem->getMaxFieldOffsetLimit() == 1);
326
+ const BaseObjVar* baseObj = pag->getBaseObject(id);
327
+ return (baseObj->getMaxFieldOffsetLimit() == 1);
328
328
  }
329
329
  /// Get a field of a memory object
330
330
  inline NodeID getGepObjVar(NodeID id, const APOffset& apOffset)
@@ -65,10 +65,11 @@ protected:
65
65
  SymbolTableInfo* symInfo;
66
66
 
67
67
  /// Add a node into the graph
68
- inline NodeID addNode(SVFVar* node, NodeID i)
68
+ inline NodeID addNode(SVFVar* node)
69
69
  {
70
- addGNode(i,node);
71
- return i;
70
+ assert(node && "cannot add a null node");
71
+ addGNode(node->getId(),node);
72
+ return node->getId();
72
73
  }
73
74
  /// Add an edge into the graph
74
75
  bool addEdge(SVFVar* src, SVFVar* dst, SVFStmt* edge);
@@ -94,12 +95,6 @@ protected:
94
95
  inserted.first->second.emplace(edge);
95
96
  }
96
97
  }
97
- /// get MemObj according to LLVM value
98
- inline const MemObj* getMemObj(const SVFValue* val) const
99
- {
100
- return symInfo->getObj(symInfo->getObjSym(val));
101
- }
102
-
103
98
  public:
104
99
  IRGraph(bool buildFromFile)
105
100
  : fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0)
@@ -174,14 +169,6 @@ public:
174
169
  {
175
170
  return symInfo->nullPtrSymID();
176
171
  }
177
- inline const MemObj* getBlackHoleObj() const
178
- {
179
- return symInfo->getBlkObj();
180
- }
181
- inline const MemObj* getConstantObj() const
182
- {
183
- return symInfo->getConstantObj();
184
- }
185
172
 
186
173
  inline u32_t getValueNodeNum() const
187
174
  {
@@ -189,7 +176,7 @@ public:
189
176
  }
190
177
  inline u32_t getObjectNodeNum() const
191
178
  {
192
- return symInfo->idToObjMap().size();
179
+ return symInfo->idToObjTypeInfoMap().size();
193
180
  }
194
181
  inline u32_t getNodeNumAfterPAGBuild() const
195
182
  {
@@ -309,9 +309,9 @@ public:
309
309
 
310
310
  inline bool isArrayMemObj(NodeID id) const
311
311
  {
312
- const MemObj* mem = pag->getObject(id);
313
- assert(mem && "memory object is null??");
314
- return mem->isArray();
312
+ const BaseObjVar* obj = pag->getBaseObject(id);
313
+ assert(obj && "base object is null??");
314
+ return obj->isArray();
315
315
  }
316
316
  //@}
317
317
 
@@ -339,13 +339,13 @@ public:
339
339
  }
340
340
  inline void setObjFieldInsensitive(NodeID id)
341
341
  {
342
- MemObj* mem = const_cast<MemObj*>(pag->getBaseObj(id));
343
- mem->setFieldInsensitive();
342
+ BaseObjVar* baseObj = const_cast<BaseObjVar*>(pag->getBaseObject(id));
343
+ baseObj->setFieldInsensitive();
344
344
  }
345
345
  inline bool isFieldInsensitive(NodeID id) const
346
346
  {
347
- const MemObj* mem = pag->getBaseObj(id);
348
- return mem->isFieldInsensitive();
347
+ const BaseObjVar* baseObj = pag->getBaseObject(id);
348
+ return baseObj->isFieldInsensitive();
349
349
  }
350
350
  ///@}
351
351
 
@@ -118,9 +118,9 @@ protected:
118
118
  ///Get a reference to StructInfo.
119
119
  StInfo* getOrAddSVFTypeInfo(const Type* T);
120
120
 
121
- MemObj* createBlkObj(SymID symId);
121
+ ObjTypeInfo* createBlkObjTypeInfo(SymID symId);
122
122
 
123
- MemObj* createConstantObj(SymID symId);
123
+ ObjTypeInfo* createConstantObjTypeInfo(SymID symId);
124
124
  };
125
125
 
126
126
  } // End namespace SVF
@@ -129,8 +129,6 @@ class SVFMetadataAsValue;
129
129
 
130
130
  class SVFLoopAndDomInfo; // Part of SVFFunction
131
131
 
132
- // Classes created upon buildSymbolTableInfo
133
- class MemObj;
134
132
 
135
133
  // Classes created upon ICFG construction
136
134
  class ICFGNode;
@@ -422,7 +420,6 @@ private:
422
420
 
423
421
  cJSON* toJson(const AccessPath& ap);
424
422
  cJSON* toJson(const SVFLoop* loop);
425
- cJSON* toJson(const MemObj* memObj);
426
423
  cJSON* toJson(const ObjTypeInfo* objTypeInfo); // Only owned by MemObj
427
424
  cJSON* toJson(const SVFLoopAndDomInfo* ldInfo); // Only owned by SVFFunction
428
425
  cJSON* toJson(const StInfo* stInfo);
@@ -528,7 +525,6 @@ private:
528
525
 
529
526
  // Other classes
530
527
  cJSON* contentToJson(const SVFLoop* loop);
531
- cJSON* contentToJson(const MemObj* memObj); // Owned by SymbolTable->objMap
532
528
  cJSON* contentToJson(const StInfo* stInfo);
533
529
  ///@}
534
530
 
@@ -899,13 +895,8 @@ class SymbolTableInfoReader
899
895
 
900
896
  private:
901
897
  const cJSON* symTabFieldJson = nullptr;
902
- ReaderIDToObjMap<MemObj> memObjMap;
903
898
 
904
899
  public:
905
- inline MemObj* getMemObjPtr(unsigned id) const
906
- {
907
- return memObjMap.getPtr(id);
908
- }
909
900
 
910
901
  template <typename MemObjCreator>
911
902
  void createObjs(const cJSON* symTabJson, MemObjCreator memObjCreator)
@@ -915,7 +906,6 @@ public:
915
906
 
916
907
  const cJSON* const allMemObj = symTabJson->child;
917
908
  CHECK_JSON_KEY(allMemObj);
918
- memObjMap.createObjs(allMemObj, memObjCreator);
919
909
 
920
910
  symTabFieldJson = allMemObj->next;
921
911
  }
@@ -1104,7 +1094,6 @@ private:
1104
1094
 
1105
1095
  void readJson(const cJSON* obj, AccessPath& ap);
1106
1096
  void readJson(const cJSON* obj, SVFLoop*& loop);
1107
- void readJson(const cJSON* obj, MemObj*& memObj);
1108
1097
  void readJson(const cJSON* obj,
1109
1098
  ObjTypeInfo*& objTypeInfo); // Only owned by MemObj
1110
1099
  void readJson(const cJSON* obj,
@@ -1257,7 +1246,6 @@ private:
1257
1246
  void fill(const cJSON*& fieldJson, TDForkPE* stmt);
1258
1247
  void fill(const cJSON*& fieldJson, TDJoinPE* stmt);
1259
1248
 
1260
- void fill(const cJSON*& fieldJson, MemObj* memObj);
1261
1249
  void fill(const cJSON*& fieldJson, StInfo* stInfo);
1262
1250
  // ICFG
1263
1251
  void virtFill(const cJSON*& fieldJson, ICFGNode* node);