svf-tools 1.0.1023 → 1.0.1025

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.1023",
3
+ "version": "1.0.1025",
4
4
  "description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -153,21 +153,32 @@ public:
153
153
 
154
154
  // ┌── SVFVar: Classes of top-level variables (ValVar) and address-taken variables (ObjVar)
155
155
  // │ └── ValVar: Classes of top-level variable nodes
156
- ValNode, // ├──Represents a standard value variable
157
- FunValNode, // ├──Represents a Function value variable
158
- GepValNode, // ├──Represents a GEP value variable
159
- RetNode, // ├──Represents a return value node
160
- VarargNode, // ├──Represents a variadic argument node
161
- DummyValNode, // ├──Dummy node for uninitialized values
156
+ ValNode, // ├──Represents a standard value variable
157
+ FunValNode, // ├──Represents a Function value variable
158
+ GepValNode, // ├──Represents a GEP value variable
159
+ RetNode, // ├──Represents a return value node
160
+ VarargNode, // ├──Represents a variadic argument node
161
+ GlobalValNode, // ├──Represents a global variable node
162
+ ConstantDataValNode, // ├──Represents a constant data variable
163
+ BlackHoleNode, // ├──Represents a black hole node
164
+ ConstantFPValNode, // ├──Represents a constant float-point value node
165
+ ConstantIntValNode, // ├── Represents a constant integer value node
166
+ ConstantNullptrValNode, // ├── Represents a constant nullptr value node
167
+ DummyValNode, // ├──Dummy node for uninitialized values
162
168
  // │ └── ObjVar: Classes of object variable nodes
163
- ObjNode, // ├──Represents an object variable
164
- GepObjNode, // ├──Represents a GEP object variable
169
+ ObjNode, // ├──Represents an object variable
170
+ GepObjNode, // ├──Represents a GEP object variable
165
171
  // │ └── BaseObjVar: Classes of base object nodes
166
- BaseObjNode, // ├──Represents a base object node
167
- FunObjNode, // ├──Types of function object
168
- HeapObjNode, // ├──Types of heap object
169
- StackObjNode, // ├──Types of stack object
170
- DummyObjNode, // ├──Dummy node for uninitialized objects
172
+ BaseObjNode, // ├──Represents a base object node
173
+ FunObjNode, // ├──Types of function object
174
+ HeapObjNode, // ├──Types of heap object
175
+ StackObjNode, // ├──Types of stack object
176
+ GlobalObjNode, // ├──Types of global object
177
+ ConstantDataObjNode, // ├──Types of constant data object
178
+ ConstantFPObjNode, // ├──Types of constant float-point object
179
+ ConstantIntObjNode, // ├──Types of constant integer object
180
+ ConstantNullptrObjNode, // ├──Types of constant nullptr object
181
+ DummyObjNode, // ├──Dummy node for uninitialized objects
171
182
  // └────────
172
183
 
173
184
  // ┌── VFGNode: Classes of Value Flow Graph (VFG) node kinds with operations
@@ -278,7 +289,7 @@ protected:
278
289
 
279
290
  static inline bool isSVFVarKind(GNodeK n)
280
291
  {
281
- static_assert(DummyObjNode - ValNode == 12,
292
+ static_assert(DummyObjNode - ValNode == 23,
282
293
  "The number of SVFVarKinds has changed, make sure the "
283
294
  "range is correct");
284
295
 
@@ -287,15 +298,24 @@ protected:
287
298
 
288
299
  static inline bool isValVarKinds(GNodeK n)
289
300
  {
290
- static_assert(DummyValNode - ValNode == 5,
301
+ static_assert(DummyValNode - ValNode == 11,
291
302
  "The number of ValVarKinds has changed, make sure the "
292
303
  "range is correct");
293
304
  return n <= DummyValNode && n >= ValNode;
294
305
  }
295
306
 
307
+
308
+ static inline bool isConstantDataValVar(GNodeK n)
309
+ {
310
+ static_assert(ConstantNullptrValNode - ConstantDataValNode == 4,
311
+ "The number of ConstantDataValVarKinds has changed, make "
312
+ "sure the range is correct");
313
+ return n <= ConstantNullptrValNode && n >= ConstantDataValNode;
314
+ }
315
+
296
316
  static inline bool isObjVarKinds(GNodeK n)
297
317
  {
298
- static_assert(DummyObjNode - ObjNode == 6,
318
+ static_assert(DummyObjNode - ObjNode == 11,
299
319
  "The number of ObjVarKinds has changed, make sure the "
300
320
  "range is correct");
301
321
  return n <= DummyObjNode && n >= ObjNode;
@@ -303,12 +323,20 @@ protected:
303
323
 
304
324
  static inline bool isBaseObjVarKinds(GNodeK n)
305
325
  {
306
- static_assert(DummyObjNode - BaseObjNode == 4,
326
+ static_assert(DummyObjNode - BaseObjNode == 9,
307
327
  "The number of BaseObjVarKinds has changed, make sure the "
308
328
  "range is correct");
309
329
  return n <= DummyObjNode && n >= BaseObjNode;
310
330
  }
311
331
 
332
+ static inline bool isConstantDataObjVarKinds(GNodeK n)
333
+ {
334
+ static_assert(ConstantNullptrObjNode - ConstantDataObjNode == 3,
335
+ "The number of ConstantDataObjVarKinds has changed, make "
336
+ "sure the range is correct");
337
+ return n <= ConstantNullptrObjNode && n >= ConstantDataObjNode;
338
+ }
339
+
312
340
  static inline bool isVFGNodeKinds(GNodeK n)
313
341
  {
314
342
  static_assert(MInterPhi - Cmp == 24,
@@ -412,6 +412,16 @@ public:
412
412
  return SVFUtil::dyn_cast<BaseObjVar>(node);
413
413
  }
414
414
 
415
+ inline const ValVar* getBaseValVar(NodeID id) const
416
+ {
417
+ const SVFVar* node = getGNode(id);
418
+ if(const GepValVar* gepVar = SVFUtil::dyn_cast<GepValVar>(node))
419
+ return SVFUtil::dyn_cast<ValVar>(
420
+ getGNode(gepVar->getBaseNode()));
421
+ else
422
+ return SVFUtil::dyn_cast<ValVar>(node);
423
+ }
424
+
415
425
  inline const MemObj*getObject(const ObjVar* node) const
416
426
  {
417
427
  return node->getMemObj();
@@ -568,6 +578,39 @@ private:
568
578
  return addValNode(nullptr, node, i);
569
579
  }
570
580
 
581
+ inline NodeID addConstantFPValNode(const SVFValue* curInst, double dval, const NodeID i,
582
+ const ICFGNode* icfgNode)
583
+ {
584
+ SVFVar* node = new ConstantFPValVar(curInst, dval, i, icfgNode);
585
+ return addNode(node, i);
586
+ }
587
+
588
+ inline NodeID addConstantIntValNode(const SVFValue* curInst, const std::pair<s64_t, u64_t>& intValue, const NodeID i,
589
+ const ICFGNode* icfgNode)
590
+ {
591
+ SVFVar* node = new ConstantIntValVar(curInst, intValue.first, intValue.second, i, icfgNode);
592
+ return addNode(node, i);
593
+ }
594
+
595
+ inline NodeID addConstantNullPtrValNode(const SVFValue* curInst, const NodeID i, const ICFGNode* icfgNode)
596
+ {
597
+ SVFVar* node = new ConstantNullPtrValVar(curInst, i, icfgNode);
598
+ return addNode(node, i);
599
+ }
600
+
601
+ inline NodeID addGlobalValueValNode(const SVFValue* curInst, const NodeID i, const ICFGNode* icfgNode)
602
+ {
603
+ SVFVar* node = new GlobalValVar(curInst, i, icfgNode);
604
+ return addNode(node, i);
605
+ }
606
+
607
+ inline NodeID addConstantDataValNode(const SVFValue* curInst, const NodeID i, const ICFGNode* icfgNode)
608
+ {
609
+ SVFVar* node = new ConstantDataValVar(curInst, i, icfgNode);
610
+ return addNode(node, i);
611
+ }
612
+
613
+
571
614
  /// Add a memory obj node
572
615
  inline NodeID addObjNode(const SVFValue* val, NodeID i)
573
616
  {
@@ -601,6 +644,56 @@ private:
601
644
  }
602
645
 
603
646
  NodeID addFunObjNode(const CallGraphNode* callGraphNode, NodeID id);
647
+
648
+
649
+ inline NodeID addConstantFPObjNode(const SVFValue* curInst, double dval, const NodeID i)
650
+ {
651
+ const MemObj* mem = getMemObj(curInst);
652
+ NodeID base = mem->getId();
653
+ memToFieldsMap[base].set(mem->getId());
654
+ ConstantFPObjVar* node = new ConstantFPObjVar(curInst, dval, mem->getId(), mem);
655
+ return addObjNode(curInst, node, mem->getId());
656
+ }
657
+
658
+
659
+ inline NodeID addConstantIntObjNode(const SVFValue* curInst, const std::pair<s64_t, u64_t>& intValue, const NodeID i)
660
+ {
661
+ const MemObj* mem = getMemObj(curInst);
662
+ NodeID base = mem->getId();
663
+ memToFieldsMap[base].set(mem->getId());
664
+ ConstantIntObjVar* node =
665
+ new ConstantIntObjVar(curInst, intValue.first, intValue.second, mem->getId(), mem);
666
+ return addObjNode(curInst, node, mem->getId());
667
+ }
668
+
669
+
670
+ inline NodeID addConstantNullPtrObjNode(const SVFValue* curInst, const NodeID i)
671
+ {
672
+ const MemObj* mem = getMemObj(curInst);
673
+ NodeID base = mem->getId();
674
+ memToFieldsMap[base].set(mem->getId());
675
+ ConstantNullPtrObjVar* node = new ConstantNullPtrObjVar(curInst, mem->getId(), mem);
676
+ return addObjNode(mem->getValue(), node, mem->getId());
677
+ }
678
+
679
+ inline NodeID addGlobalValueObjNode(const SVFValue* curInst, const NodeID i)
680
+ {
681
+ const MemObj* mem = getMemObj(curInst);
682
+ NodeID base = mem->getId();
683
+ memToFieldsMap[base].set(mem->getId());
684
+ GlobalObjVar* node = new GlobalObjVar(curInst, mem->getId(), mem);
685
+ return addObjNode(mem->getValue(), node, mem->getId());
686
+ }
687
+
688
+ inline NodeID addConstantDataObjNode(const SVFValue* curInst, const NodeID i)
689
+ {
690
+ const MemObj* mem = getMemObj(curInst);
691
+ NodeID base = mem->getId();
692
+ memToFieldsMap[base].set(mem->getId());
693
+ ConstantDataObjVar* node = new ConstantDataObjVar(curInst, mem->getId(), mem);
694
+ return addObjNode(mem->getValue(), node, mem->getId());
695
+ }
696
+
604
697
  /// Add a unique return node for a procedure
605
698
  inline NodeID addRetNode(const CallGraphNode* callGraphNode, NodeID i)
606
699
  {