svf-lib 1.0.1765 → 1.0.1767

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.
@@ -71,7 +71,7 @@ public:
71
71
  AccessPath(const AccessPath& ap)
72
72
  : fldIdx(ap.fldIdx),
73
73
  idxOperandPairs(ap.getIdxOperandPairVec()),
74
- gepPointeeType(ap.getGepPointeeType())
74
+ gepPointeeType(ap.gepSrcPointeeType())
75
75
  {
76
76
  }
77
77
 
@@ -109,7 +109,7 @@ public:
109
109
  {
110
110
  return idxOperandPairs;
111
111
  }
112
- inline const SVFType* getGepPointeeType() const
112
+ inline const SVFType* gepSrcPointeeType() const
113
113
  {
114
114
  return gepPointeeType;
115
115
  }
@@ -177,6 +177,7 @@ typedef llvm::VAStartInst VAStartInst;
177
177
  typedef llvm::BinaryOperator BinaryOperator;
178
178
  typedef llvm::UnaryOperator UnaryOperator;
179
179
  typedef llvm::UndefValue UndefValue;
180
+ typedef llvm::GEPOperator GEPOperator;
180
181
 
181
182
  // Related to Switch Case
182
183
  typedef std::pair<const BasicBlock*, const ConstantInt*> SuccBBAndCondValPair;
@@ -126,6 +126,10 @@ static inline Type* getPtrElementType(const PointerType* pty)
126
126
  #endif
127
127
  }
128
128
 
129
+ /// Infer type based on llvm value, this is for the migration to opaque pointer
130
+ /// please refer to: https://llvm.org/docs/OpaquePointers.html#migration-instructions
131
+ Type *getPointeeType(const Value *value);
132
+
129
133
  /// Get the reference type of heap/static object from an allocation site.
130
134
  //@{
131
135
  inline const PointerType *getRefTypeOfHeapAllocOrStatic(const CallBase* cs)
@@ -139,6 +143,7 @@ inline const PointerType *getRefTypeOfHeapAllocOrStatic(const CallBase* cs)
139
143
  int argPos = SVFUtil::getHeapAllocHoldingArgPosition(svfcs);
140
144
  const Value* arg = cs->getArgOperand(argPos);
141
145
  if (const PointerType *argType = SVFUtil::dyn_cast<PointerType>(arg->getType()))
146
+ // TODO: getPtrElementType need type inference
142
147
  refType = SVFUtil::dyn_cast<PointerType>(getPtrElementType(argType));
143
148
  }
144
149
  // Case 2: heap object held by return value.
@@ -389,6 +394,7 @@ inline u32_t SVFType2ByteSize(const SVFType* type)
389
394
  const llvm::Type* llvm_rhs = LLVMModuleSet::getLLVMModuleSet()->getLLVMType(type);
390
395
  const llvm::PointerType* llvm_rhs_ptr = SVFUtil::dyn_cast<PointerType>(llvm_rhs);
391
396
  assert(llvm_rhs_ptr && "not a pointer type?");
397
+ // TODO: getPtrElementType need type inference
392
398
  const Type *ptrElementType = getPtrElementType(llvm_rhs_ptr);
393
399
  u32_t llvm_rhs_size = LLVMUtil::getTypeSizeInBytes(ptrElementType);
394
400
  u32_t llvm_elem_size = -1;
@@ -67,7 +67,7 @@ public:
67
67
  AccessPath(const AccessPath& ap)
68
68
  : fldIdx(ap.fldIdx),
69
69
  idxOperandPairs(ap.getIdxOperandPairVec()),
70
- gepPointeeType(ap.getGepPointeeType())
70
+ gepPointeeType(ap.gepSrcPointeeType())
71
71
  {
72
72
  }
73
73
 
@@ -105,7 +105,7 @@ public:
105
105
  {
106
106
  return idxOperandPairs;
107
107
  }
108
- inline const SVFType* getGepPointeeType() const
108
+ inline const SVFType* gepSrcPointeeType() const
109
109
  {
110
110
  return gepPointeeType;
111
111
  }
@@ -177,6 +177,7 @@ typedef llvm::VAStartInst VAStartInst;
177
177
  typedef llvm::BinaryOperator BinaryOperator;
178
178
  typedef llvm::UnaryOperator UnaryOperator;
179
179
  typedef llvm::UndefValue UndefValue;
180
+ typedef llvm::GEPOperator GEPOperator;
180
181
 
181
182
  // Related to Switch Case
182
183
  typedef std::pair<const BasicBlock*, const ConstantInt*> SuccBBAndCondValPair;
@@ -126,6 +126,10 @@ static inline Type* getPtrElementType(const PointerType* pty)
126
126
  #endif
127
127
  }
128
128
 
129
+ /// Infer type based on llvm value, this is for the migration to opaque pointer
130
+ /// please refer to: https://llvm.org/docs/OpaquePointers.html#migration-instructions
131
+ Type *getPointeeType(const Value *value);
132
+
129
133
  /// Get the reference type of heap/static object from an allocation site.
130
134
  //@{
131
135
  inline const PointerType *getRefTypeOfHeapAllocOrStatic(const CallBase* cs)
@@ -139,6 +143,7 @@ inline const PointerType *getRefTypeOfHeapAllocOrStatic(const CallBase* cs)
139
143
  int argPos = SVFUtil::getHeapAllocHoldingArgPosition(svfcs);
140
144
  const Value* arg = cs->getArgOperand(argPos);
141
145
  if (const PointerType *argType = SVFUtil::dyn_cast<PointerType>(arg->getType()))
146
+ // TODO: getPtrElementType need type inference
142
147
  refType = SVFUtil::dyn_cast<PointerType>(getPtrElementType(argType));
143
148
  }
144
149
  // Case 2: heap object held by return value.
@@ -389,6 +394,7 @@ inline u32_t SVFType2ByteSize(const SVFType* type)
389
394
  const llvm::Type* llvm_rhs = LLVMModuleSet::getLLVMModuleSet()->getLLVMType(type);
390
395
  const llvm::PointerType* llvm_rhs_ptr = SVFUtil::dyn_cast<PointerType>(llvm_rhs);
391
396
  assert(llvm_rhs_ptr && "not a pointer type?");
397
+ // TODO: getPtrElementType need type inference
392
398
  const Type *ptrElementType = getPtrElementType(llvm_rhs_ptr);
393
399
  u32_t llvm_rhs_size = LLVMUtil::getTypeSizeInBytes(ptrElementType);
394
400
  u32_t llvm_elem_size = -1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1765",
3
+ "version": "1.0.1767",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {