svf-lib 1.0.2183 → 1.0.2185

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 (33) 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/DDA/DDAVFSolver.h +5 -7
  10. package/SVF-linux/Release-build/include/Graphs/ConsG.h +2 -2
  11. package/SVF-linux/Release-build/include/Graphs/IRGraph.h +5 -18
  12. package/SVF-linux/Release-build/include/MemoryModel/PointerAnalysis.h +7 -7
  13. package/SVF-linux/Release-build/include/SVF-LLVM/SymbolTableBuilder.h +2 -2
  14. package/SVF-linux/Release-build/include/SVFIR/SVFFileSystem.h +0 -12
  15. package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +84 -106
  16. package/SVF-linux/Release-build/include/SVFIR/SVFVariables.h +239 -84
  17. package/SVF-linux/Release-build/include/SVFIR/SymbolTableInfo.h +18 -136
  18. package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
  19. package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
  20. package/SVF-osx/Release-build/bin/ae +0 -0
  21. package/SVF-osx/Release-build/bin/cfl +0 -0
  22. package/SVF-osx/Release-build/bin/dvf +0 -0
  23. package/SVF-osx/Release-build/bin/llvm2svf +0 -0
  24. package/SVF-osx/Release-build/bin/mta +0 -0
  25. package/SVF-osx/Release-build/bin/saber +0 -0
  26. package/SVF-osx/Release-build/bin/svf-ex +0 -0
  27. package/SVF-osx/Release-build/bin/wpa +0 -0
  28. package/SVF-osx/Release-build/include/SVF-LLVM/LLVMModule.h +4 -4
  29. package/SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h +1 -1
  30. package/SVF-osx/Release-build/include/SVFIR/SVFVariables.h +6 -7
  31. package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
  32. package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
  33. package/package.json +1 -1
@@ -37,9 +37,9 @@
37
37
  namespace SVF
38
38
  {
39
39
 
40
- class MemObj;
41
40
  class ObjTypeInfo;
42
41
  class StInfo;
42
+ class BaseObjVar;
43
43
 
44
44
  /*!
45
45
  * Symbol table of the memory model for analysis
@@ -70,8 +70,9 @@ public:
70
70
  /// llvm value to sym id map
71
71
  /// local (%) and global (@) identifiers are pointer types which have a value node id.
72
72
  typedef OrderedMap<const SVFValue*, SymID> ValueToIDMapTy;
73
- /// sym id to memory object map
74
- typedef OrderedMap<SymID, MemObj*> IDToMemMapTy;
73
+ /// sym id to obj type info map
74
+ typedef OrderedMap<SymID, ObjTypeInfo*> IDToTypeInfoMapTy;
75
+
75
76
  /// function to sym id map
76
77
  typedef OrderedMap<const SVFFunction*, SymID> FunToIDMapTy;
77
78
  /// struct type to struct info map
@@ -83,7 +84,7 @@ private:
83
84
  ValueToIDMapTy objSymMap; ///< map a obj reference to its sym id
84
85
  FunToIDMapTy returnSymMap; ///< return map
85
86
  FunToIDMapTy varargSymMap; ///< vararg map
86
- IDToMemMapTy objMap; ///< map a memory sym id to its obj
87
+ IDToTypeInfoMapTy objTypeInfoMap; ///< map a memory sym id to its obj
87
88
 
88
89
  // Singleton pattern here to enable instance of SymbolTableInfo can only be created once.
89
90
  static SymbolTableInfo* symInfo;
@@ -171,15 +172,6 @@ public:
171
172
  return (isBlkObj(id) || isConstantObj(id));
172
173
  }
173
174
 
174
- inline MemObj* getBlkObj() const
175
- {
176
- return getObj(blackholeSymID());
177
- }
178
- inline MemObj* getConstantObj() const
179
- {
180
- return getObj(constantSymID());
181
- }
182
-
183
175
  inline SymID blkPtrSymID() const
184
176
  {
185
177
  return BlkPtr;
@@ -200,10 +192,6 @@ public:
200
192
  return BlackHole;
201
193
  }
202
194
 
203
- /// Can only be invoked by SVFIR::addDummyNode() when creating SVFIR from file.
204
- const MemObj* createDummyObj(SymID symId, const SVFType* type);
205
- // @}
206
-
207
195
  /// Get different kinds of syms
208
196
  //@{
209
197
  SymID getValSym(const SVFValue* val);
@@ -220,10 +208,10 @@ public:
220
208
  return iter->second;
221
209
  }
222
210
 
223
- inline MemObj* getObj(SymID id) const
211
+ inline ObjTypeInfo* getObjTypeInfo(SymID id) const
224
212
  {
225
- IDToMemMapTy::const_iterator iter = objMap.find(id);
226
- assert(iter!=objMap.end() && "obj not found");
213
+ IDToTypeInfoMapTy::const_iterator iter = objTypeInfoMap.find(id);
214
+ assert(iter!=objTypeInfoMap.end() && "obj type info not found");
227
215
  return iter->second;
228
216
  }
229
217
 
@@ -267,14 +255,14 @@ public:
267
255
  return objSymMap;
268
256
  }
269
257
 
270
- inline IDToMemMapTy& idToObjMap()
258
+ inline IDToTypeInfoMapTy& idToObjTypeInfoMap()
271
259
  {
272
- return objMap;
260
+ return objTypeInfoMap;
273
261
  }
274
262
 
275
- inline const IDToMemMapTy& idToObjMap() const
263
+ inline const IDToTypeInfoMapTy& idToObjTypeInfoMap() const
276
264
  {
277
- return objMap;
265
+ return objTypeInfoMap;
278
266
  }
279
267
 
280
268
  inline FunToIDMapTy& retSyms()
@@ -311,6 +299,11 @@ public:
311
299
  return svfTypes.find(T) != svfTypes.end();
312
300
  }
313
301
 
302
+ /// Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
303
+ ObjTypeInfo* createObjTypeInfo(const SVFType* type);
304
+
305
+ const ObjTypeInfo* createDummyObjTypeInfo(SymID symId, const SVFType* type);
306
+
314
307
  ///Get a reference to the components of struct_info.
315
308
  /// Number of flattened elements of an array or struct
316
309
  u32_t getNumOfFlattenElements(const SVFType* T);
@@ -333,8 +326,7 @@ public:
333
326
  virtual void dump();
334
327
 
335
328
  /// Given an offset from a Gep Instruction, return it modulus offset by considering memory layout
336
- virtual APOffset getModulusOffset(const MemObj* obj,
337
- const APOffset& apOffset);
329
+ virtual APOffset getModulusOffset(const BaseObjVar* baseObj, const APOffset& apOffset);
338
330
 
339
331
  ///The struct type with the most fields
340
332
  const SVFType* maxStruct;
@@ -359,9 +351,6 @@ protected:
359
351
  /// Return the flattened field type for struct type only
360
352
  const std::vector<const SVFType*>& getFlattenFieldTypes(const SVFStructType *T);
361
353
 
362
- /// Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
363
- ObjTypeInfo* createObjTypeInfo(const SVFType* type);
364
-
365
354
  /// (owned) All SVF Types
366
355
  /// Every type T is mapped to StInfo
367
356
  /// which contains size (fsize) , offset(foffset)
@@ -375,113 +364,6 @@ protected:
375
364
 
376
365
  class SVFBaseNode;
377
366
 
378
- /*!
379
- * Memory object symbols or MemObj (address-taken variables in LLVM-based languages)
380
- */
381
- class MemObj
382
- {
383
- friend class SVFIRWriter;
384
- friend class SVFIRReader;
385
- friend class SVFIRBuilder;
386
-
387
- private:
388
- /// Type information of this object
389
- ObjTypeInfo* typeInfo;
390
- /// The unique value of this symbol/variable
391
- const SVFValue* refVal;
392
- /// The unique id to represent this symbol
393
- SymID symId;
394
-
395
- const SVFBaseNode* gNode;
396
-
397
- public:
398
- /// Constructor
399
- MemObj(SymID id, ObjTypeInfo* ti, const SVFValue* val = nullptr, const SVFBaseNode* node = nullptr);
400
-
401
- /// Destructor
402
- virtual ~MemObj()
403
- {
404
- destroy();
405
- }
406
-
407
- virtual const std::string toString() const;
408
-
409
- /// Get the reference value to this object
410
- inline const SVFValue* getValue() const
411
- {
412
- return refVal;
413
- }
414
-
415
- /// Get the reference value to this object
416
- inline const SVFBaseNode* getGNode() const
417
- {
418
- return gNode;
419
- }
420
-
421
- /// Get the memory object id
422
- inline SymID getId() const
423
- {
424
- return symId;
425
- }
426
-
427
- /// Get obj type
428
- const SVFType* getType() const;
429
-
430
- /// Get the number of elements of this object
431
- u32_t getNumOfElements() const;
432
-
433
- /// Set the number of elements of this object
434
- void setNumOfElements(u32_t num);
435
-
436
- /// Get max field offset limit
437
- u32_t getMaxFieldOffsetLimit() const;
438
-
439
- /// Return true if its field limit is 0
440
- bool isFieldInsensitive() const;
441
-
442
- /// Set the memory object to be field insensitive
443
- void setFieldInsensitive();
444
-
445
- /// Set the memory object to be field sensitive (up to max field limit)
446
- void setFieldSensitive();
447
-
448
- /// Whether it is a black hole object
449
- bool isBlackHoleObj() const;
450
-
451
- /// Get the byte size of this object
452
- u32_t getByteSizeOfObj() const;
453
-
454
- /// Check if byte size is a const value
455
- bool isConstantByteSize() const;
456
-
457
-
458
- /// object attributes methods
459
- //@{
460
- bool isFunction() const;
461
- bool isGlobalObj() const;
462
- bool isStaticObj() const;
463
- bool isStack() const;
464
- bool isHeap() const;
465
- bool isStruct() const;
466
- bool isArray() const;
467
- bool isVarStruct() const;
468
- bool isVarArray() const;
469
- bool isConstantStruct() const;
470
- bool isConstantArray() const;
471
- bool isConstDataOrConstGlobal() const;
472
- bool isConstDataOrAggData() const;
473
- //@}
474
-
475
- /// Operator overloading
476
- inline bool operator==(const MemObj& mem) const
477
- {
478
- return getValue() == mem.getValue();
479
- }
480
-
481
- /// Clean up memory
482
- void destroy();
483
- };
484
-
485
367
  /*!
486
368
  * Type Info of an abstract memory object
487
369
  */
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -190,17 +190,17 @@ public:
190
190
  inline void addInstructionMap(const Instruction* inst, CallICFGNode* svfInst)
191
191
  {
192
192
  CSToCallNodeMap[inst] = svfInst;
193
- addToLLVMVal2SVFVarMap(inst, svfInst);
193
+ addToSVFVar2LLVMValueMap(inst, svfInst);
194
194
  }
195
195
  inline void addInstructionMap(const Instruction* inst, RetICFGNode* svfInst)
196
196
  {
197
197
  CSToRetNodeMap[inst] = svfInst;
198
- addToLLVMVal2SVFVarMap(inst, svfInst);
198
+ addToSVFVar2LLVMValueMap(inst, svfInst);
199
199
  }
200
200
  inline void addInstructionMap(const Instruction* inst, IntraICFGNode* svfInst)
201
201
  {
202
202
  InstToBlockNodeMap[inst] = svfInst;
203
- addToLLVMVal2SVFVarMap(inst, svfInst);
203
+ addToSVFVar2LLVMValueMap(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 addToLLVMVal2SVFVarMap(const Value* val, SVFBaseNode* svfBaseNode);
429
+ void addToSVFVar2LLVMValueMap(const Value* val, SVFBaseNode* svfBaseNode);
430
430
  void buildFunToFunMap();
431
431
  void buildGlobalDefToRepMap();
432
432
  /// Invoke llvm passes to modify module
@@ -273,7 +273,7 @@ protected:
273
273
  LLVMContext& cxt = llvmModuleSet()->getContext();
274
274
  ConstantPointerNull* constNull = ConstantPointerNull::get(PointerType::getUnqual(cxt));
275
275
  NodeID nullPtr = pag->addConstantNullPtrValNode(llvmModuleSet()->getSVFValue(constNull),pag->getNullPtr(), nullptr);
276
- llvmModuleSet()->addToLLVMVal2SVFVarMap(
276
+ llvmModuleSet()->addToSVFVar2LLVMValueMap(
277
277
  constNull, pag->getGNode(pag->getNullPtr()));
278
278
  setCurrentLocation(constNull, nullptr);
279
279
  addBlackHoleAddrEdge(pag->getBlkPtr());
@@ -529,8 +529,7 @@ public:
529
529
  };
530
530
 
531
531
  /*
532
- * Field-insensitive Gep Obj variable, this is dynamic generated for field sensitive analysis
533
- * Each field-insensitive gep obj node represents all fields of a MemObj (base)
532
+ * Base memory object variable (address-taken variables in LLVM-based languages)
534
533
  */
535
534
  class BaseObjVar : public ObjVar
536
535
  {
@@ -540,7 +539,7 @@ class BaseObjVar : public ObjVar
540
539
  private:
541
540
  ObjTypeInfo* typeInfo;
542
541
 
543
- const SVFBaseNode* gNode;
542
+ const ICFGNode* icfgNode; /// ICFGNode related to the creation of this object
544
543
 
545
544
  protected:
546
545
  /// Constructor to create empty ObjVar (for SVFIRReader/deserialization)
@@ -571,7 +570,7 @@ public:
571
570
  }
572
571
  //@}
573
572
 
574
- /// Constructorx
573
+ /// Constructor
575
574
  BaseObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, PNODEK ty = BaseObjNode)
576
575
  : ObjVar(val, i, ty), typeInfo(ti)
577
576
  {
@@ -582,10 +581,10 @@ public:
582
581
  return this;
583
582
  }
584
583
 
585
- /// Get the reference value to this object
586
- inline const SVFBaseNode* getGNode() const
584
+ /// Get the ICFGNode related to the creation of this object
585
+ inline const ICFGNode* getICFGNode() const
587
586
  {
588
- return gNode;
587
+ return icfgNode;
589
588
  }
590
589
 
591
590
  /// Return name of a LLVM value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2183",
3
+ "version": "1.0.2185",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {