svf-lib 1.0.845 → 1.0.846

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.
@@ -90,12 +90,6 @@ public:
90
90
  {
91
91
  }
92
92
 
93
- /// Initialization from FlattenedFieldInfo
94
- LocationSet(const FlattenedFieldInfo& fi)
95
- : fldIdx(fi.getFlattenFldIdx())
96
- {
97
- }
98
-
99
93
  ~LocationSet() {}
100
94
 
101
95
  /// Overload operators
@@ -434,7 +434,6 @@ public:
434
434
 
435
435
  inline const LocationSet& getLocationSet() const
436
436
  {
437
- assert(isVariantFieldGep()==false && "Can't retrieve the LocationSet if using a variable field index (pointer arithmetic) for struct field access ");
438
437
  return ls;
439
438
  }
440
439
  inline const LocationSet::OffsetValueVec& getOffsetValueVec() const
@@ -453,6 +452,7 @@ public:
453
452
  /// Field index of the gep statement if it access the field of a struct
454
453
  inline s64_t getConstantFieldIdx() const
455
454
  {
455
+ assert(isVariantFieldGep()==false && "Can't retrieve the LocationSet if using a variable field index (pointer arithmetic) for struct field access ");
456
456
  return getLocationSet().accumulateConstantFieldIdx();
457
457
  }
458
458
  /// Gep statement with a variant field index (pointer arithmetic) for struct field access
@@ -360,7 +360,7 @@ public:
360
360
  /// Flatterned element idx of an array or struct by considering stride
361
361
  const std::vector<u32_t>& getFlattenedElemIdxVec(const Type *T);
362
362
  /// Flatterned field index information of a struct ignoring any array field
363
- const std::vector<u32_t>& getFlattenedFieldIdxVec(const StructType *T);
363
+ const std::vector<u32_t>& getFlattenedFieldIdxVec(const Type *T);
364
364
 
365
365
  const std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec(const Type *T);
366
366
 
@@ -510,7 +510,7 @@ inline const BasicBlock* getFunExitBB(const Function* fun)
510
510
  const Value * stripConstantCasts(const Value *val);
511
511
 
512
512
  /// Strip off the all casts
513
- Value *stripAllCasts(Value *val) ;
513
+ const Value *stripAllCasts(const Value *val) ;
514
514
 
515
515
  /// Get the type of the heap allocation
516
516
  const Type *getTypeOfHeapAlloc(const llvm::Instruction *inst) ;
@@ -128,10 +128,7 @@ public:
128
128
  bool computeGepOffset(const User *V, LocationSet& ls);
129
129
 
130
130
  /// Get the base type and max offset
131
- const Type *getBaseTypeAndFlattenedFields(const Value *V, std::vector<LocationSet> &fields);
132
-
133
- /// Replace fields with flatten fields of T if the number of its fields is larger than msz.
134
- u32_t getFields(std::vector<LocationSet>& fields, const Type* T, u32_t msz);
131
+ const Type *getBaseTypeAndFlattenedFields(const Value *V, std::vector<LocationSet> &fields, const Value* sz);
135
132
 
136
133
  /// Handle direct call
137
134
  void handleDirectCall(CallSite cs, const SVFFunction *F);
@@ -145,7 +142,7 @@ public:
145
142
  /// Handle external call
146
143
  //@{
147
144
  virtual void handleExtCall(CallSite cs, const SVFFunction *F);
148
- void addComplexConsForExt(Value *D, Value *S,u32_t sz = 0);
145
+ void addComplexConsForExt(Value *D, Value *S, const Value* sz);
149
146
  //@}
150
147
 
151
148
  /// Our visit overrides.
@@ -284,137 +281,124 @@ public:
284
281
 
285
282
  void setCurrentBBAndValueForPAGEdge(PAGEdge* edge);
286
283
 
287
- inline PAGEdge* addBlackHoleAddrEdge(NodeID node)
284
+ inline void addBlackHoleAddrEdge(NodeID node)
288
285
  {
289
- PAGEdge *edge = pag->addBlackHoleAddrStmt(node);
290
- setCurrentBBAndValueForPAGEdge(edge);
291
- return edge;
286
+ if(PAGEdge *edge = pag->addBlackHoleAddrStmt(node))
287
+ setCurrentBBAndValueForPAGEdge(edge);
292
288
  }
293
289
 
294
290
  /// Add Address edge
295
291
  inline AddrStmt* addAddrEdge(NodeID src, NodeID dst)
296
292
  {
297
- AddrStmt *edge = pag->addAddrStmt(src, dst);
298
- setCurrentBBAndValueForPAGEdge(edge);
299
- return edge;
293
+ if(AddrStmt *edge = pag->addAddrStmt(src, dst)){
294
+ setCurrentBBAndValueForPAGEdge(edge);
295
+ return edge;
296
+ }
297
+ return nullptr;
300
298
  }
301
299
  /// Add Copy edge
302
300
  inline CopyStmt* addCopyEdge(NodeID src, NodeID dst)
303
301
  {
304
- CopyStmt *edge = pag->addCopyStmt(src, dst);
305
- setCurrentBBAndValueForPAGEdge(edge);
306
- return edge;
302
+ if(CopyStmt *edge = pag->addCopyStmt(src, dst)){
303
+ setCurrentBBAndValueForPAGEdge(edge);
304
+ return edge;
305
+ }
306
+ return nullptr;
307
307
  }
308
308
  /// Add Copy edge
309
- inline PhiStmt* addPhiStmt(NodeID res, NodeID opnd, const ICFGNode* pred)
309
+ inline void addPhiStmt(NodeID res, NodeID opnd, const ICFGNode* pred)
310
310
  {
311
- PhiStmt *edge = pag->addPhiStmt(res,opnd,pred);
312
311
  /// If we already added this phi node, then skip this adding
313
- if(edge)
312
+ if(PhiStmt *edge = pag->addPhiStmt(res,opnd,pred))
314
313
  setCurrentBBAndValueForPAGEdge(edge);
315
- return edge;
316
314
  }
317
315
  /// Add SelectStmt
318
- inline SelectStmt* addSelectStmt(NodeID res, NodeID op1, NodeID op2, NodeID cond)
316
+ inline void addSelectStmt(NodeID res, NodeID op1, NodeID op2, NodeID cond)
319
317
  {
320
- SelectStmt *edge = pag->addSelectStmt(res,op1,op2,cond);
321
- setCurrentBBAndValueForPAGEdge(edge);
322
- return edge;
318
+ if(SelectStmt *edge = pag->addSelectStmt(res,op1,op2,cond))
319
+ setCurrentBBAndValueForPAGEdge(edge);
323
320
  }
324
321
  /// Add Copy edge
325
- inline CmpStmt* addCmpEdge(NodeID op1, NodeID op2, NodeID dst, u32_t predict)
322
+ inline void addCmpEdge(NodeID op1, NodeID op2, NodeID dst, u32_t predict)
326
323
  {
327
- CmpStmt *edge = pag->addCmpStmt(op1, op2, dst, predict);
328
- setCurrentBBAndValueForPAGEdge(edge);
329
- return edge;
324
+ if(CmpStmt *edge = pag->addCmpStmt(op1, op2, dst, predict))
325
+ setCurrentBBAndValueForPAGEdge(edge);
330
326
  }
331
327
  /// Add Copy edge
332
- inline BinaryOPStmt* addBinaryOPEdge(NodeID op1, NodeID op2, NodeID dst, u32_t opcode)
328
+ inline void addBinaryOPEdge(NodeID op1, NodeID op2, NodeID dst, u32_t opcode)
333
329
  {
334
- BinaryOPStmt *edge = pag->addBinaryOPStmt(op1, op2, dst, opcode);
335
- setCurrentBBAndValueForPAGEdge(edge);
336
- return edge;
330
+ if(BinaryOPStmt *edge = pag->addBinaryOPStmt(op1, op2, dst, opcode))
331
+ setCurrentBBAndValueForPAGEdge(edge);
337
332
  }
338
333
  /// Add Unary edge
339
- inline UnaryOPStmt* addUnaryOPEdge(NodeID src, NodeID dst, u32_t opcode)
334
+ inline void addUnaryOPEdge(NodeID src, NodeID dst, u32_t opcode)
340
335
  {
341
- UnaryOPStmt *edge = pag->addUnaryOPStmt(src, dst, opcode);
342
- setCurrentBBAndValueForPAGEdge(edge);
343
- return edge;
336
+ if(UnaryOPStmt *edge = pag->addUnaryOPStmt(src, dst, opcode))
337
+ setCurrentBBAndValueForPAGEdge(edge);
344
338
  }
345
339
  /// Add Branch statement
346
- inline BranchStmt* addBranchStmt(NodeID br, NodeID cond, const BranchStmt::SuccAndCondPairVec& succs){
347
- BranchStmt *edge = pag->addBranchStmt(br, cond, succs);
348
- setCurrentBBAndValueForPAGEdge(edge);
349
- return edge;
340
+ inline void addBranchStmt(NodeID br, NodeID cond, const BranchStmt::SuccAndCondPairVec& succs){
341
+ if(BranchStmt *edge = pag->addBranchStmt(br, cond, succs))
342
+ setCurrentBBAndValueForPAGEdge(edge);
350
343
  }
351
344
  /// Add Load edge
352
- inline LoadStmt* addLoadEdge(NodeID src, NodeID dst)
345
+ inline void addLoadEdge(NodeID src, NodeID dst)
353
346
  {
354
- LoadStmt *edge = pag->addLoadStmt(src, dst);
355
- setCurrentBBAndValueForPAGEdge(edge);
356
- return edge;
347
+ if(LoadStmt *edge = pag->addLoadStmt(src, dst))
348
+ setCurrentBBAndValueForPAGEdge(edge);
357
349
  }
358
350
  /// Add Store edge
359
- inline StoreStmt* addStoreEdge(NodeID src, NodeID dst)
351
+ inline void addStoreEdge(NodeID src, NodeID dst)
360
352
  {
361
353
  IntraICFGNode* node;
362
354
  if(const Instruction* inst = SVFUtil::dyn_cast<Instruction>(curVal))
363
355
  node = pag->getICFG()->getIntraICFGNode(inst);
364
356
  else
365
357
  node = nullptr;
366
- StoreStmt *edge = pag->addStoreStmt(src, dst, node);
367
- setCurrentBBAndValueForPAGEdge(edge);
368
- return edge;
358
+ if(StoreStmt *edge = pag->addStoreStmt(src, dst, node))
359
+ setCurrentBBAndValueForPAGEdge(edge);
369
360
  }
370
361
  /// Add Call edge
371
- inline CallPE* addCallEdge(NodeID src, NodeID dst, const CallICFGNode* cs, const FunEntryICFGNode* entry)
362
+ inline void addCallEdge(NodeID src, NodeID dst, const CallICFGNode* cs, const FunEntryICFGNode* entry)
372
363
  {
373
- CallPE *edge = pag->addCallPE(src, dst, cs, entry);
374
- setCurrentBBAndValueForPAGEdge(edge);
375
- return edge;
364
+ if(CallPE *edge = pag->addCallPE(src, dst, cs, entry))
365
+ setCurrentBBAndValueForPAGEdge(edge);
376
366
  }
377
367
  /// Add Return edge
378
- inline RetPE* addRetEdge(NodeID src, NodeID dst, const CallICFGNode* cs, const FunExitICFGNode* exit)
368
+ inline void addRetEdge(NodeID src, NodeID dst, const CallICFGNode* cs, const FunExitICFGNode* exit)
379
369
  {
380
- RetPE *edge = pag->addRetPE(src, dst, cs, exit);
381
- setCurrentBBAndValueForPAGEdge(edge);
382
- return edge;
370
+ if(RetPE *edge = pag->addRetPE(src, dst, cs, exit))
371
+ setCurrentBBAndValueForPAGEdge(edge);
383
372
  }
384
373
  /// Add Gep edge
385
- inline GepStmt* addGepEdge(NodeID src, NodeID dst, const LocationSet& ls, bool constGep)
374
+ inline void addGepEdge(NodeID src, NodeID dst, const LocationSet& ls, bool constGep)
386
375
  {
387
- GepStmt *edge = pag->addGepStmt(src, dst, ls, constGep);
388
- setCurrentBBAndValueForPAGEdge(edge);
389
- return edge;
376
+ if(GepStmt *edge = pag->addGepStmt(src, dst, ls, constGep))
377
+ setCurrentBBAndValueForPAGEdge(edge);
390
378
  }
391
379
  /// Add Offset(Gep) edge
392
- inline GepStmt* addNormalGepEdge(NodeID src, NodeID dst, const LocationSet& ls)
380
+ inline void addNormalGepEdge(NodeID src, NodeID dst, const LocationSet& ls)
393
381
  {
394
- GepStmt *edge = pag->addNormalGepStmt(src, dst, ls);
395
- setCurrentBBAndValueForPAGEdge(edge);
396
- return edge;
382
+ if(GepStmt *edge = pag->addNormalGepStmt(src, dst, ls))
383
+ setCurrentBBAndValueForPAGEdge(edge);
397
384
  }
398
385
  /// Add Variant(Gep) edge
399
- inline GepStmt* addVariantGepEdge(NodeID src, NodeID dst, const LocationSet& ls)
386
+ inline void addVariantGepEdge(NodeID src, NodeID dst, const LocationSet& ls)
400
387
  {
401
- GepStmt *edge = pag->addVariantGepStmt(src, dst, ls);
402
- setCurrentBBAndValueForPAGEdge(edge);
403
- return edge;
388
+ if(GepStmt *edge = pag->addVariantGepStmt(src, dst, ls))
389
+ setCurrentBBAndValueForPAGEdge(edge);
404
390
  }
405
391
  /// Add Thread fork edge for parameter passing
406
- inline TDForkPE* addThreadForkEdge(NodeID src, NodeID dst, const CallICFGNode* cs, const FunEntryICFGNode* entry)
392
+ inline void addThreadForkEdge(NodeID src, NodeID dst, const CallICFGNode* cs, const FunEntryICFGNode* entry)
407
393
  {
408
- TDForkPE *edge = pag->addThreadForkPE(src, dst, cs, entry);
409
- setCurrentBBAndValueForPAGEdge(edge);
410
- return edge;
394
+ if(TDForkPE *edge = pag->addThreadForkPE(src, dst, cs, entry))
395
+ setCurrentBBAndValueForPAGEdge(edge);
411
396
  }
412
397
  /// Add Thread join edge for parameter passing
413
- inline TDJoinPE* addThreadJoinEdge(NodeID src, NodeID dst, const CallICFGNode* cs, const FunExitICFGNode* exit)
398
+ inline void addThreadJoinEdge(NodeID src, NodeID dst, const CallICFGNode* cs, const FunExitICFGNode* exit)
414
399
  {
415
- TDJoinPE *edge = pag->addThreadJoinPE(src, dst, cs, exit);
416
- setCurrentBBAndValueForPAGEdge(edge);
417
- return edge;
400
+ if(TDJoinPE *edge = pag->addThreadJoinPE(src, dst, cs, exit))
401
+ setCurrentBBAndValueForPAGEdge(edge);
418
402
  }
419
403
  //@}
420
404
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.845",
3
+ "version": "1.0.846",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {