svf-lib 1.0.2178 → 1.0.2180

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/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/Graphs/GenericGraph.h +3 -2
  10. package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +7 -0
  11. package/SVF-linux/Release-build/include/SVFIR/SVFVariables.h +77 -5
  12. package/SVF-linux/Release-build/include/Util/SVFUtil.h +2 -0
  13. package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
  14. package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
  15. package/SVF-osx/Release-build/bin/ae +0 -0
  16. package/SVF-osx/Release-build/bin/cfl +0 -0
  17. package/SVF-osx/Release-build/bin/dvf +0 -0
  18. package/SVF-osx/Release-build/bin/llvm2svf +0 -0
  19. package/SVF-osx/Release-build/bin/mta +0 -0
  20. package/SVF-osx/Release-build/bin/saber +0 -0
  21. package/SVF-osx/Release-build/bin/svf-ex +0 -0
  22. package/SVF-osx/Release-build/bin/wpa +0 -0
  23. package/SVF-osx/Release-build/include/Graphs/GenericGraph.h +3 -2
  24. package/SVF-osx/Release-build/include/SVFIR/SVFIR.h +7 -0
  25. package/SVF-osx/Release-build/include/SVFIR/SVFVariables.h +77 -5
  26. package/SVF-osx/Release-build/include/Util/SVFUtil.h +2 -0
  27. package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
  28. package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
  29. package/package.json +1 -1
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -154,6 +154,7 @@ public:
154
154
  // ┌── SVFVar: Classes of top-level variables (ValVar) and address-taken variables (ObjVar)
155
155
  // │ └── ValVar: Classes of top-level variable nodes
156
156
  ValNode, // ├──Represents a standard value variable
157
+ ArgNode, // ├──Represents an argument value variable
157
158
  FunValNode, // ├──Represents a Function value variable
158
159
  GepValNode, // ├──Represents a GEP value variable
159
160
  RetNode, // ├──Represents a return value node
@@ -289,7 +290,7 @@ protected:
289
290
 
290
291
  static inline bool isSVFVarKind(GNodeK n)
291
292
  {
292
- static_assert(DummyObjNode - ValNode == 23,
293
+ static_assert(DummyObjNode - ValNode == 24,
293
294
  "The number of SVFVarKinds has changed, make sure the "
294
295
  "range is correct");
295
296
 
@@ -298,7 +299,7 @@ protected:
298
299
 
299
300
  static inline bool isValVarKinds(GNodeK n)
300
301
  {
301
- static_assert(DummyValNode - ValNode == 11,
302
+ static_assert(DummyValNode - ValNode == 12,
302
303
  "The number of ValVarKinds has changed, make sure the "
303
304
  "range is correct");
304
305
  return n <= DummyValNode && n >= ValNode;
@@ -578,6 +578,13 @@ private:
578
578
  return addValNode(nullptr, node, i);
579
579
  }
580
580
 
581
+ NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode, bool isUncalled = false)
582
+ {
583
+ ArgValVar* node =
584
+ new ArgValVar(i, argNo, icfgNode, callGraphNode, isUncalled);
585
+ return addValNode(nullptr, node, i);
586
+ }
587
+
581
588
  inline NodeID addConstantFPValNode(const SVFValue* curInst, double dval, const NodeID i,
582
589
  const ICFGNode* icfgNode)
583
590
  {
@@ -133,11 +133,6 @@ public:
133
133
  {
134
134
  return inst->getParent()->getParent();
135
135
  }
136
- // For function arguments, return their parent function
137
- else if (auto arg = SVFUtil::dyn_cast<SVFArgument>(value))
138
- {
139
- return arg->getParent();
140
- }
141
136
  }
142
137
 
143
138
  // Return nullptr for globals/constants with no parent function
@@ -388,6 +383,83 @@ public:
388
383
  };
389
384
 
390
385
 
386
+ /**
387
+ * @brief Class representing a function argument variable in the SVFIR
388
+ *
389
+ * This class models function argument in the program analysis. It extends ValVar
390
+ * to specifically handle function argument.
391
+ */
392
+ class ArgValVar: public ValVar
393
+ {
394
+ friend class SVFIRWriter;
395
+ friend class SVFIRReader;
396
+
397
+ private:
398
+ const CallGraphNode* cgNode;
399
+ u32_t argNo;
400
+ bool uncalled;
401
+
402
+ protected:
403
+ /// Constructor to create function argument (for SVFIRReader/deserialization)
404
+ ArgValVar(NodeID i, PNODEK ty = ArgNode) : ValVar(i, ty) {}
405
+
406
+ public:
407
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
408
+ //@{
409
+ static inline bool classof(const ArgValVar*)
410
+ {
411
+ return true;
412
+ }
413
+ static inline bool classof(const ValVar* node)
414
+ {
415
+ return node->getNodeKind() == ArgNode;
416
+ }
417
+ static inline bool classof(const SVFVar* node)
418
+ {
419
+ return node->getNodeKind() == ArgNode;
420
+ }
421
+ static inline bool classof(const GenericPAGNodeTy* node)
422
+ {
423
+ return node->getNodeKind() == ArgNode;
424
+ }
425
+ static inline bool classof(const SVFBaseNode* node)
426
+ {
427
+ return node->getNodeKind() == ArgNode;
428
+ }
429
+ //@}
430
+
431
+ /// Constructor
432
+ ArgValVar(NodeID i, u32_t argNo, const ICFGNode* icn, const CallGraphNode* callGraphNode,
433
+ bool isUncalled = false, PNODEK ty = ArgNode);
434
+
435
+ /// Return name of a LLVM value
436
+ inline const std::string getValueName() const
437
+ {
438
+ if (value)
439
+ return value->getName() + " (argument valvar)";
440
+ return " (argument valvar)";
441
+ }
442
+
443
+ virtual const SVFFunction* getFunction() const;
444
+
445
+ const SVFFunction* getParent() const;
446
+
447
+ /// Return the index of this formal argument in its containing function.
448
+ /// For example in "void foo(int a, float b)" a is 0 and b is 1.
449
+ inline u32_t getArgNo() const
450
+ {
451
+ return argNo;
452
+ }
453
+
454
+ inline bool isArgOfUncalledFunction() const
455
+ {
456
+ return uncalled;
457
+ }
458
+
459
+ virtual const std::string toString() const;
460
+ };
461
+
462
+
391
463
  /*
392
464
  * Gep Value (Pointer) variable, this variable can be dynamic generated for field sensitive analysis
393
465
  * e.g. memcpy, temp gep value variable needs to be created
@@ -351,6 +351,8 @@ inline bool isArgOfUncalledFunction(const SVFValue* svfval)
351
351
  return false;
352
352
  }
353
353
 
354
+ bool isArgOfUncalledFunction(const SVFVar* svfvar);
355
+
354
356
  const ObjVar* getObjVarOfValVar(const ValVar* valVar);
355
357
 
356
358
  /// Return thread fork function
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -154,6 +154,7 @@ public:
154
154
  // ┌── SVFVar: Classes of top-level variables (ValVar) and address-taken variables (ObjVar)
155
155
  // │ └── ValVar: Classes of top-level variable nodes
156
156
  ValNode, // ├──Represents a standard value variable
157
+ ArgNode, // ├──Represents an argument value variable
157
158
  FunValNode, // ├──Represents a Function value variable
158
159
  GepValNode, // ├──Represents a GEP value variable
159
160
  RetNode, // ├──Represents a return value node
@@ -289,7 +290,7 @@ protected:
289
290
 
290
291
  static inline bool isSVFVarKind(GNodeK n)
291
292
  {
292
- static_assert(DummyObjNode - ValNode == 23,
293
+ static_assert(DummyObjNode - ValNode == 24,
293
294
  "The number of SVFVarKinds has changed, make sure the "
294
295
  "range is correct");
295
296
 
@@ -298,7 +299,7 @@ protected:
298
299
 
299
300
  static inline bool isValVarKinds(GNodeK n)
300
301
  {
301
- static_assert(DummyValNode - ValNode == 11,
302
+ static_assert(DummyValNode - ValNode == 12,
302
303
  "The number of ValVarKinds has changed, make sure the "
303
304
  "range is correct");
304
305
  return n <= DummyValNode && n >= ValNode;
@@ -578,6 +578,13 @@ private:
578
578
  return addValNode(nullptr, node, i);
579
579
  }
580
580
 
581
+ NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode, bool isUncalled = false)
582
+ {
583
+ ArgValVar* node =
584
+ new ArgValVar(i, argNo, icfgNode, callGraphNode, isUncalled);
585
+ return addValNode(nullptr, node, i);
586
+ }
587
+
581
588
  inline NodeID addConstantFPValNode(const SVFValue* curInst, double dval, const NodeID i,
582
589
  const ICFGNode* icfgNode)
583
590
  {
@@ -133,11 +133,6 @@ public:
133
133
  {
134
134
  return inst->getParent()->getParent();
135
135
  }
136
- // For function arguments, return their parent function
137
- else if (auto arg = SVFUtil::dyn_cast<SVFArgument>(value))
138
- {
139
- return arg->getParent();
140
- }
141
136
  }
142
137
 
143
138
  // Return nullptr for globals/constants with no parent function
@@ -388,6 +383,83 @@ public:
388
383
  };
389
384
 
390
385
 
386
+ /**
387
+ * @brief Class representing a function argument variable in the SVFIR
388
+ *
389
+ * This class models function argument in the program analysis. It extends ValVar
390
+ * to specifically handle function argument.
391
+ */
392
+ class ArgValVar: public ValVar
393
+ {
394
+ friend class SVFIRWriter;
395
+ friend class SVFIRReader;
396
+
397
+ private:
398
+ const CallGraphNode* cgNode;
399
+ u32_t argNo;
400
+ bool uncalled;
401
+
402
+ protected:
403
+ /// Constructor to create function argument (for SVFIRReader/deserialization)
404
+ ArgValVar(NodeID i, PNODEK ty = ArgNode) : ValVar(i, ty) {}
405
+
406
+ public:
407
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
408
+ //@{
409
+ static inline bool classof(const ArgValVar*)
410
+ {
411
+ return true;
412
+ }
413
+ static inline bool classof(const ValVar* node)
414
+ {
415
+ return node->getNodeKind() == ArgNode;
416
+ }
417
+ static inline bool classof(const SVFVar* node)
418
+ {
419
+ return node->getNodeKind() == ArgNode;
420
+ }
421
+ static inline bool classof(const GenericPAGNodeTy* node)
422
+ {
423
+ return node->getNodeKind() == ArgNode;
424
+ }
425
+ static inline bool classof(const SVFBaseNode* node)
426
+ {
427
+ return node->getNodeKind() == ArgNode;
428
+ }
429
+ //@}
430
+
431
+ /// Constructor
432
+ ArgValVar(NodeID i, u32_t argNo, const ICFGNode* icn, const CallGraphNode* callGraphNode,
433
+ bool isUncalled = false, PNODEK ty = ArgNode);
434
+
435
+ /// Return name of a LLVM value
436
+ inline const std::string getValueName() const
437
+ {
438
+ if (value)
439
+ return value->getName() + " (argument valvar)";
440
+ return " (argument valvar)";
441
+ }
442
+
443
+ virtual const SVFFunction* getFunction() const;
444
+
445
+ const SVFFunction* getParent() const;
446
+
447
+ /// Return the index of this formal argument in its containing function.
448
+ /// For example in "void foo(int a, float b)" a is 0 and b is 1.
449
+ inline u32_t getArgNo() const
450
+ {
451
+ return argNo;
452
+ }
453
+
454
+ inline bool isArgOfUncalledFunction() const
455
+ {
456
+ return uncalled;
457
+ }
458
+
459
+ virtual const std::string toString() const;
460
+ };
461
+
462
+
391
463
  /*
392
464
  * Gep Value (Pointer) variable, this variable can be dynamic generated for field sensitive analysis
393
465
  * e.g. memcpy, temp gep value variable needs to be created
@@ -351,6 +351,8 @@ inline bool isArgOfUncalledFunction(const SVFValue* svfval)
351
351
  return false;
352
352
  }
353
353
 
354
+ bool isArgOfUncalledFunction(const SVFVar* svfvar);
355
+
354
356
  const ObjVar* getObjVarOfValVar(const ValVar* valVar);
355
357
 
356
358
  /// Return thread fork function
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2178",
3
+ "version": "1.0.2180",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {