svf-lib 1.0.2173 → 1.0.2174

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -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,
@@ -190,17 +190,17 @@ public:
190
190
  inline void addInstructionMap(const Instruction* inst, CallICFGNode* svfInst)
191
191
  {
192
192
  CSToCallNodeMap[inst] = svfInst;
193
- setValueAttr(inst,svfInst);
193
+ addToLLVMVal2SVFVarMap(inst, svfInst);
194
194
  }
195
195
  inline void addInstructionMap(const Instruction* inst, RetICFGNode* svfInst)
196
196
  {
197
197
  CSToRetNodeMap[inst] = svfInst;
198
- setValueAttr(inst,svfInst);
198
+ addToLLVMVal2SVFVarMap(inst, svfInst);
199
199
  }
200
200
  inline void addInstructionMap(const Instruction* inst, IntraICFGNode* svfInst)
201
201
  {
202
202
  InstToBlockNodeMap[inst] = svfInst;
203
- setValueAttr(inst,svfInst);
203
+ addToLLVMVal2SVFVarMap(inst, svfInst);
204
204
  }
205
205
 
206
206
  inline void addArgumentMap(const Argument* arg, SVFArgument* svfArg)
@@ -426,7 +426,7 @@ private:
426
426
  void initSVFBasicBlock(const Function* func);
427
427
  void initDomTree(SVFFunction* func, const Function* f);
428
428
  void setValueAttr(const Value* val, SVFValue* value);
429
- void setValueAttr(const Value* val, SVFBaseNode* svfBaseNode);
429
+ void addToLLVMVal2SVFVarMap(const Value* val, SVFBaseNode* svfBaseNode);
430
430
  void buildFunToFunMap();
431
431
  void buildGlobalDefToRepMap();
432
432
  /// Invoke llvm passes to modify module
@@ -272,7 +272,9 @@ protected:
272
272
  {
273
273
  LLVMContext& cxt = llvmModuleSet()->getContext();
274
274
  ConstantPointerNull* constNull = ConstantPointerNull::get(PointerType::getUnqual(cxt));
275
- NodeID nullPtr = pag->addValNode(llvmModuleSet()->getSVFValue(constNull),pag->getNullPtr(), nullptr);
275
+ NodeID nullPtr = pag->addConstantNullPtrValNode(llvmModuleSet()->getSVFValue(constNull),pag->getNullPtr(), nullptr);
276
+ llvmModuleSet()->addToLLVMVal2SVFVarMap(
277
+ constNull, pag->getGNode(pag->getNullPtr()));
276
278
  setCurrentLocation(constNull, nullptr);
277
279
  addBlackHoleAddrEdge(pag->getBlkPtr());
278
280
  return nullPtr;
@@ -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, s64_t sval, u64_t zval, const NodeID i,
589
+ const ICFGNode* icfgNode)
590
+ {
591
+ SVFVar* node = new ConstantIntValVar(curInst, sval, zval, 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, s64_t sval, u64_t zval, 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, sval, zval, 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
  {
@@ -400,6 +400,7 @@ class GepValVar: public ValVar
400
400
 
401
401
  private:
402
402
  AccessPath ap; // AccessPath
403
+ NodeID base; // base node id
403
404
  const SVFType* gepValType;
404
405
 
405
406
  /// Constructor to create empty GeValVar (for SVFIRReader/deserialization)
@@ -427,9 +428,9 @@ public:
427
428
  //@}
428
429
 
429
430
  /// Constructor
430
- GepValVar(const SVFValue* val, NodeID i, const AccessPath& ap,
431
+ GepValVar(NodeID baseID, const SVFValue* val, NodeID i, const AccessPath& ap,
431
432
  const SVFType* ty)
432
- : ValVar(val, i, GepValNode), ap(ap), gepValType(ty)
433
+ : ValVar(val, i, GepValNode), ap(ap), base(baseID), gepValType(ty)
433
434
  {
434
435
  }
435
436
 
@@ -439,6 +440,12 @@ public:
439
440
  return ap.getConstantStructFldIdx();
440
441
  }
441
442
 
443
+ /// Return the base object from which this GEP node came from.
444
+ inline NodeID getBaseNode(void) const
445
+ {
446
+ return base;
447
+ }
448
+
442
449
  /// Return name of a LLVM value
443
450
  inline const std::string getValueName() const
444
451
  {
@@ -820,6 +827,572 @@ public:
820
827
  virtual const std::string toString() const;
821
828
  };
822
829
 
830
+ class GlobalValVar : public ValVar
831
+ {
832
+ friend class SVFIRWriter;
833
+ friend class SVFIRReader;
834
+
835
+ public:
836
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
837
+ //@{
838
+ static inline bool classof(const GlobalValVar*)
839
+ {
840
+ return true;
841
+ }
842
+ static inline bool classof(const ValVar* node)
843
+ {
844
+ return node->getNodeKind() == GlobalValNode;
845
+ }
846
+ static inline bool classof(const SVFVar* node)
847
+ {
848
+ return node->getNodeKind() == GlobalValNode;
849
+ }
850
+ static inline bool classof(const GenericPAGNodeTy* node)
851
+ {
852
+ return node->getNodeKind() == GlobalValNode;
853
+ }
854
+ static inline bool classof(const SVFBaseNode* node)
855
+ {
856
+ return node->getNodeKind() == GlobalValNode;
857
+ }
858
+ //@}
859
+
860
+ /// Constructor
861
+ GlobalValVar(const SVFValue* val, NodeID i, const ICFGNode* icn,
862
+ PNODEK ty = GlobalValNode)
863
+ : ValVar(val, i, ty, icn)
864
+ {
865
+ }
866
+
867
+ virtual const std::string toString() const;
868
+ };
869
+
870
+ class ConstantDataValVar: public ValVar
871
+ {
872
+ friend class SVFIRWriter;
873
+ friend class SVFIRReader;
874
+
875
+ public:
876
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
877
+ //@{
878
+ static inline bool classof(const ConstantDataValVar*)
879
+ {
880
+ return true;
881
+ }
882
+ static inline bool classof(const ValVar* node)
883
+ {
884
+ return isConstantDataValVar(node->getNodeKind());
885
+ }
886
+ static inline bool classof(const SVFVar* node)
887
+ {
888
+ return isConstantDataValVar(node->getNodeKind());
889
+ }
890
+ static inline bool classof(const GenericPAGNodeTy* node)
891
+ {
892
+ return isConstantDataValVar(node->getNodeKind());
893
+ }
894
+ static inline bool classof(const SVFBaseNode* node)
895
+ {
896
+ return isConstantDataValVar(node->getNodeKind());
897
+ }
898
+ //@}
899
+
900
+ /// Constructor
901
+ ConstantDataValVar(const SVFValue* val, NodeID i, const ICFGNode* icn,
902
+ PNODEK ty = ConstantDataValNode)
903
+ : ValVar(val, i, ty, icn)
904
+ {
905
+
906
+ }
907
+
908
+ virtual const std::string toString() const;
909
+ };
910
+
911
+ class BlackHoleVar: public ConstantDataValVar
912
+ {
913
+ friend class SVFIRWriter;
914
+ friend class SVFIRReader;
915
+
916
+ public:
917
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
918
+ //@{
919
+ static inline bool classof(const BlackHoleVar*)
920
+ {
921
+ return true;
922
+ }
923
+ static inline bool classof(const ConstantDataValVar* node)
924
+ {
925
+ return node->getNodeKind() == BlackHoleNode;
926
+ }
927
+ static inline bool classof(const ValVar* node)
928
+ {
929
+ return node->getNodeKind() == BlackHoleNode;
930
+ }
931
+ static inline bool classof(const SVFVar* node)
932
+ {
933
+ return node->getNodeKind() == BlackHoleNode;
934
+ }
935
+ static inline bool classof(const GenericPAGNodeTy* node)
936
+ {
937
+ return node->getNodeKind() == BlackHoleNode;
938
+ }
939
+ static inline bool classof(const SVFBaseNode* node)
940
+ {
941
+ return node->getNodeKind() == BlackHoleNode;
942
+ }
943
+ //@}
944
+
945
+ /// Constructor
946
+ BlackHoleVar(NodeID i, PNODEK ty = BlackHoleNode)
947
+ : ConstantDataValVar(nullptr, i, nullptr, ty)
948
+ {
949
+
950
+ }
951
+
952
+ virtual const std::string toString() const
953
+ {
954
+ return "BlackHoleVar";
955
+ }
956
+ };
957
+
958
+ class ConstantFPValVar: public ConstantDataValVar
959
+ {
960
+ friend class SVFIRWriter;
961
+ friend class SVFIRReader;
962
+ private:
963
+ double dval;
964
+
965
+ public:
966
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
967
+ //@{
968
+ static inline bool classof(const ConstantFPValVar*)
969
+ {
970
+ return true;
971
+ }
972
+ static inline bool classof(const ConstantDataValVar* node)
973
+ {
974
+ return node->getNodeKind() == ConstantFPValNode;
975
+ }
976
+ static inline bool classof(const ValVar* node)
977
+ {
978
+ return node->getNodeKind() == ConstantFPValNode;
979
+ }
980
+ static inline bool classof(const SVFVar* node)
981
+ {
982
+ return node->getNodeKind() == ConstantFPValNode;
983
+ }
984
+ static inline bool classof(const GenericPAGNodeTy* node)
985
+ {
986
+ return node->getNodeKind() == ConstantFPValNode;
987
+ }
988
+ static inline bool classof(const SVFBaseNode* node)
989
+ {
990
+ return node->getNodeKind() == ConstantFPValNode;
991
+ }
992
+ //@}
993
+
994
+ inline double getFPValue() const
995
+ {
996
+ return dval;
997
+ }
998
+
999
+ /// Constructor
1000
+ ConstantFPValVar(const SVFValue* val, double dv, NodeID i, const ICFGNode* icn,
1001
+ PNODEK ty = ConstantFPValNode)
1002
+ : ConstantDataValVar(val, i, icn, ty), dval(dv)
1003
+ {
1004
+
1005
+ }
1006
+
1007
+ virtual const std::string toString() const;
1008
+ };
1009
+
1010
+ class ConstantIntValVar: public ConstantDataValVar
1011
+ {
1012
+ friend class SVFIRWriter;
1013
+ friend class SVFIRReader;
1014
+ private:
1015
+ u64_t zval;
1016
+ s64_t sval;
1017
+
1018
+ public:
1019
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
1020
+ //@{
1021
+ static inline bool classof(const ConstantIntValVar*)
1022
+ {
1023
+ return true;
1024
+ }
1025
+ static inline bool classof(const ConstantDataValVar* node)
1026
+ {
1027
+ return node->getNodeKind() == ConstantIntValNode;
1028
+ }
1029
+ static inline bool classof(const ValVar* node)
1030
+ {
1031
+ return node->getNodeKind() == ConstantIntValNode;
1032
+ }
1033
+ static inline bool classof(const SVFVar* node)
1034
+ {
1035
+ return node->getNodeKind() == ConstantIntValNode;
1036
+ }
1037
+ static inline bool classof(const GenericPAGNodeTy* node)
1038
+ {
1039
+ return node->getNodeKind() == ConstantIntValNode;
1040
+ }
1041
+ static inline bool classof(const SVFBaseNode* node)
1042
+ {
1043
+ return node->getNodeKind() == ConstantIntValNode;
1044
+ }
1045
+ //@}
1046
+
1047
+ s64_t getSExtValue() const
1048
+ {
1049
+ return sval;
1050
+ }
1051
+
1052
+
1053
+ u64_t getZExtValue() const
1054
+ {
1055
+ return zval;
1056
+ }
1057
+
1058
+ /// Constructor
1059
+ ConstantIntValVar(const SVFValue* val, s64_t sv, u64_t zv, NodeID i, const ICFGNode* icn,
1060
+ PNODEK ty = ConstantIntValNode)
1061
+ : ConstantDataValVar(val, i, icn, ty), zval(zv), sval(sv)
1062
+ {
1063
+
1064
+ }
1065
+ virtual const std::string toString() const;
1066
+ };
1067
+
1068
+ class ConstantNullPtrValVar: public ConstantDataValVar
1069
+ {
1070
+ friend class SVFIRWriter;
1071
+ friend class SVFIRReader;
1072
+
1073
+ public:
1074
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
1075
+ //@{
1076
+ static inline bool classof(const ConstantNullPtrValVar*)
1077
+ {
1078
+ return true;
1079
+ }
1080
+ static inline bool classof(const ConstantDataValVar* node)
1081
+ {
1082
+ return node->getNodeKind() == ConstantNullptrValNode;
1083
+ }
1084
+ static inline bool classof(const ValVar* node)
1085
+ {
1086
+ return node->getNodeKind() == ConstantNullptrValNode;
1087
+ }
1088
+ static inline bool classof(const SVFVar* node)
1089
+ {
1090
+ return node->getNodeKind() == ConstantNullptrValNode;
1091
+ }
1092
+ static inline bool classof(const GenericPAGNodeTy* node)
1093
+ {
1094
+ return node->getNodeKind() == ConstantNullptrValNode;
1095
+ }
1096
+ static inline bool classof(const SVFBaseNode* node)
1097
+ {
1098
+ return node->getNodeKind() == ConstantNullptrValNode;
1099
+ }
1100
+ //@}
1101
+
1102
+ /// Constructor
1103
+ ConstantNullPtrValVar(const SVFValue* val, NodeID i, const ICFGNode* icn,
1104
+ PNODEK ty = ConstantNullptrValNode)
1105
+ : ConstantDataValVar(val, i, icn, ty)
1106
+ {
1107
+
1108
+ }
1109
+
1110
+ virtual const std::string toString() const;
1111
+ };
1112
+
1113
+ class GlobalObjVar : public BaseObjVar
1114
+ {
1115
+ friend class SVFIRWriter;
1116
+ friend class SVFIRReader;
1117
+
1118
+ private:
1119
+ /// Constructor to create empty ObjVar (for SVFIRReader/deserialization)
1120
+ GlobalObjVar(NodeID i, PNODEK ty = GlobalObjNode) : BaseObjVar(i, ty) {}
1121
+
1122
+ public:
1123
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
1124
+ //@{
1125
+ static inline bool classof(const GlobalObjVar*)
1126
+ {
1127
+ return true;
1128
+ }
1129
+ static inline bool classof(const BaseObjVar* node)
1130
+ {
1131
+ return node->getNodeKind() == GlobalObjNode;
1132
+ }
1133
+ static inline bool classof(const ObjVar* node)
1134
+ {
1135
+ return node->getNodeKind() == GlobalObjNode;
1136
+ }
1137
+ static inline bool classof(const SVFVar* node)
1138
+ {
1139
+ return node->getNodeKind() == GlobalObjNode;
1140
+ }
1141
+ static inline bool classof(const GenericPAGNodeTy* node)
1142
+ {
1143
+ return node->getNodeKind() == GlobalObjNode;
1144
+ }
1145
+ static inline bool classof(const SVFBaseNode* node)
1146
+ {
1147
+ return node->getNodeKind() == GlobalObjNode;
1148
+ }
1149
+ //@}
1150
+
1151
+ /// Constructor
1152
+ GlobalObjVar(const SVFValue* val, NodeID i, const MemObj* mem,
1153
+ PNODEK ty = GlobalObjNode): BaseObjVar(val, i,mem,ty)
1154
+ {
1155
+
1156
+ }
1157
+
1158
+
1159
+ virtual const std::string toString() const;
1160
+ };
1161
+
1162
+ class ConstantDataObjVar: public BaseObjVar
1163
+ {
1164
+ friend class SVFIRWriter;
1165
+ friend class SVFIRReader;
1166
+
1167
+ protected:
1168
+ /// Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
1169
+ ConstantDataObjVar(NodeID i) : BaseObjVar(i, ConstantDataObjNode) {}
1170
+
1171
+ public:
1172
+ //@{ Methods for support type inquiry through isa, cast, and dyn_cast:
1173
+ static inline bool classof(const ConstantDataObjVar*)
1174
+ {
1175
+ return true;
1176
+ }
1177
+ static inline bool classof(const BaseObjVar* node)
1178
+ {
1179
+ return isConstantDataObjVarKinds(node->getNodeKind());
1180
+ }
1181
+ static inline bool classof(const SVFVar* node)
1182
+ {
1183
+ return isConstantDataObjVarKinds(node->getNodeKind());
1184
+ }
1185
+ static inline bool classof(const ObjVar* node)
1186
+ {
1187
+ return isConstantDataObjVarKinds(node->getNodeKind());
1188
+ }
1189
+ static inline bool classof(const GenericPAGNodeTy* node)
1190
+ {
1191
+ return isConstantDataObjVarKinds(node->getNodeKind());
1192
+ }
1193
+
1194
+ static inline bool classof(const SVFBaseNode* node)
1195
+ {
1196
+ return isConstantDataObjVarKinds(node->getNodeKind());
1197
+ }
1198
+ //@}
1199
+
1200
+ /// Constructor
1201
+ ConstantDataObjVar(const SVFValue* val, NodeID i, const MemObj* m, PNODEK ty = ConstantDataObjNode)
1202
+ : BaseObjVar(val, i, m, ty)
1203
+ {
1204
+ }
1205
+
1206
+ virtual const std::string toString() const;
1207
+ };
1208
+
1209
+ class ConstantFPObjVar: public ConstantDataObjVar
1210
+ {
1211
+ friend class SVFIRWriter;
1212
+ friend class SVFIRReader;
1213
+
1214
+ private:
1215
+ /// Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
1216
+ ConstantFPObjVar(NodeID i) : ConstantDataObjVar(i) {}
1217
+
1218
+ private:
1219
+ float dval;
1220
+
1221
+ public:
1222
+ //@{ Methods for support type inquiry through isa, cast, and dyn_cast:
1223
+ static inline bool classof(const ConstantFPObjVar*)
1224
+ {
1225
+ return true;
1226
+ }
1227
+ static inline bool classof(const ConstantDataObjVar* node)
1228
+ {
1229
+ return node->getNodeKind() == SVFVar::ConstantFPObjNode;
1230
+ }
1231
+ static inline bool classof(const BaseObjVar* node)
1232
+ {
1233
+ return node->getNodeKind() == SVFVar::ConstantFPObjNode;
1234
+ }
1235
+
1236
+ static inline bool classof(const SVFVar* node)
1237
+ {
1238
+ return node->getNodeKind() == SVFVar::ConstantFPObjNode;
1239
+ }
1240
+
1241
+ static inline bool classof(const ObjVar* node)
1242
+ {
1243
+ return node->getNodeKind() == SVFVar::ConstantFPObjNode;
1244
+ }
1245
+
1246
+ static inline bool classof(const GenericPAGNodeTy* node)
1247
+ {
1248
+ return node->getNodeKind() == SVFVar::ConstantFPObjNode;
1249
+ }
1250
+
1251
+ static inline bool classof(const SVFBaseNode* node)
1252
+ {
1253
+ return node->getNodeKind() == SVFVar::ConstantFPObjNode;
1254
+ }
1255
+ //@}
1256
+
1257
+ /// Constructor
1258
+ ConstantFPObjVar(const SVFValue* val, double dv, NodeID i, const MemObj* m, PNODEK ty = ConstantFPObjNode)
1259
+ : ConstantDataObjVar(val, i, m, ty), dval(dv)
1260
+ {
1261
+ }
1262
+
1263
+ inline double getFPValue() const
1264
+ {
1265
+ return dval;
1266
+ }
1267
+
1268
+
1269
+ virtual const std::string toString() const;
1270
+ };
1271
+
1272
+ class ConstantIntObjVar: public ConstantDataObjVar
1273
+ {
1274
+ friend class SVFIRWriter;
1275
+ friend class SVFIRReader;
1276
+
1277
+ private:
1278
+ /// Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
1279
+ ConstantIntObjVar(NodeID i) : ConstantDataObjVar(i) {}
1280
+
1281
+ private:
1282
+ u64_t zval;
1283
+ s64_t sval;
1284
+
1285
+ public:
1286
+ //@{ Methods for support type inquiry through isa, cast, and dyn_cast:
1287
+ static inline bool classof(const ConstantIntObjVar*)
1288
+ {
1289
+ return true;
1290
+ }
1291
+
1292
+ static inline bool classof(const ConstantDataObjVar* node)
1293
+ {
1294
+ return node->getNodeKind() == SVFVar::ConstantIntObjNode;
1295
+ }
1296
+
1297
+ static inline bool classof(const BaseObjVar* node)
1298
+ {
1299
+ return node->getNodeKind() == SVFVar::ConstantIntObjNode;
1300
+ }
1301
+
1302
+ static inline bool classof(const SVFVar* node)
1303
+ {
1304
+ return node->getNodeKind() == SVFVar::ConstantIntObjNode;
1305
+ }
1306
+ static inline bool classof(const ObjVar* node)
1307
+ {
1308
+ return node->getNodeKind() == SVFVar::ConstantIntObjNode;
1309
+ }
1310
+ static inline bool classof(const GenericPAGNodeTy* node)
1311
+ {
1312
+ return node->getNodeKind() == SVFVar::ConstantIntObjNode;
1313
+ }
1314
+
1315
+ static inline bool classof(const SVFBaseNode* node)
1316
+ {
1317
+ return node->getNodeKind() == SVFVar::ConstantIntObjNode;
1318
+ }
1319
+
1320
+ s64_t getSExtValue() const
1321
+ {
1322
+ return sval;
1323
+ }
1324
+
1325
+
1326
+ u64_t getZExtValue() const
1327
+ {
1328
+ return zval;
1329
+ }
1330
+ //@}
1331
+
1332
+ /// Constructor
1333
+ ConstantIntObjVar(const SVFValue* val, s64_t sv, u64_t zv, NodeID i, const MemObj* m, PNODEK ty = ConstantIntObjNode)
1334
+ : ConstantDataObjVar(val, i, m, ty), zval(zv), sval(sv)
1335
+ {
1336
+ }
1337
+
1338
+
1339
+ virtual const std::string toString() const;
1340
+ };
1341
+
1342
+ class ConstantNullPtrObjVar: public ConstantDataObjVar
1343
+ {
1344
+ friend class SVFIRWriter;
1345
+ friend class SVFIRReader;
1346
+
1347
+ private:
1348
+ /// Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
1349
+ ConstantNullPtrObjVar(NodeID i) : ConstantDataObjVar(i) {}
1350
+
1351
+ public:
1352
+ //@{ Methods for support type inquiry through isa, cast, and dyn_cast:
1353
+ static inline bool classof(const ConstantNullPtrObjVar*)
1354
+ {
1355
+ return true;
1356
+ }
1357
+
1358
+ static inline bool classof(const ConstantDataObjVar* node)
1359
+ {
1360
+ return node->getNodeKind() == SVFVar::ConstantNullptrObjNode;
1361
+ }
1362
+
1363
+ static inline bool classof(const BaseObjVar* node)
1364
+ {
1365
+ return node->getNodeKind() == SVFVar::ConstantNullptrObjNode;
1366
+ }
1367
+
1368
+ static inline bool classof(const SVFVar* node)
1369
+ {
1370
+ return node->getNodeKind() == SVFVar::ConstantNullptrObjNode;
1371
+ }
1372
+ static inline bool classof(const ObjVar* node)
1373
+ {
1374
+ return node->getNodeKind() == SVFVar::ConstantNullptrObjNode;
1375
+ }
1376
+ static inline bool classof(const GenericPAGNodeTy* node)
1377
+ {
1378
+ return node->getNodeKind() == SVFVar::ConstantNullptrObjNode;
1379
+ }
1380
+
1381
+ static inline bool classof(const SVFBaseNode* node)
1382
+ {
1383
+ return node->getNodeKind() == SVFVar::ConstantNullptrObjNode;
1384
+ }
1385
+ //@}
1386
+
1387
+ /// Constructor
1388
+ ConstantNullPtrObjVar(const SVFValue* val, NodeID i, const MemObj* m, PNODEK ty = ConstantNullptrObjNode)
1389
+ : ConstantDataObjVar(val, i, m, ty)
1390
+ {
1391
+ }
1392
+
1393
+
1394
+ virtual const std::string toString() const;
1395
+ };
823
1396
  /*
824
1397
  * Unique Return node of a procedure
825
1398
  */
@@ -986,6 +1559,10 @@ public:
986
1559
  {
987
1560
  return true;
988
1561
  }
1562
+ static inline bool classof(const BaseObjVar* node)
1563
+ {
1564
+ return node->getNodeKind() == SVFVar::DummyObjNode;
1565
+ }
989
1566
  static inline bool classof(const SVFVar* node)
990
1567
  {
991
1568
  return node->getNodeKind() == SVFVar::DummyObjNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2173",
3
+ "version": "1.0.2174",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {