svf-lib 1.0.2479 → 1.0.2480

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
@@ -100,7 +100,7 @@ public:
100
100
  protected:
101
101
  void addCandidate(NodeID id)
102
102
  {
103
- if (pag->isValidTopLevelPtr(pag->getGNode(id)))
103
+ if (pag->isValidTopLevelPtr(pag->getSVFVar(id)))
104
104
  candidateQueries.insert(id);
105
105
  }
106
106
 
@@ -475,7 +475,7 @@ protected:
475
475
  assert(baseObj && "base object is null??");
476
476
  if(SVFUtil::isa<StackObjVar>(baseObj))
477
477
  {
478
- if(const FunObjVar* svffun = _pag->getGNode(id)->getFunction())
478
+ if(const FunObjVar* svffun = _pag->getSVFVar(id)->getFunction())
479
479
  {
480
480
  return _callGraphSCC->isInCycle(_callGraph->getCallGraphNode(svffun)->getId());
481
481
  }
@@ -497,7 +497,7 @@ protected:
497
497
  {
498
498
  NodeID funPtr = _pag->getFunPtr(cbn);
499
499
  DPIm funPtrDpm(dpm);
500
- funPtrDpm.setLocVar(getSVFG()->getDefSVFGNode(_pag->getGNode(funPtr)),funPtr);
500
+ funPtrDpm.setLocVar(getSVFG()->getDefSVFGNode(_pag->getSVFVar(funPtr)),funPtr);
501
501
  findPT(funPtrDpm);
502
502
  }
503
503
  }
@@ -510,7 +510,7 @@ protected:
510
510
  {
511
511
  NodeID funPtr = _pag->getFunPtr(*it);
512
512
  DPIm funPtrDpm(dpm);
513
- funPtrDpm.setLocVar(getSVFG()->getDefSVFGNode(_pag->getGNode(funPtr)),funPtr);
513
+ funPtrDpm.setLocVar(getSVFG()->getDefSVFGNode(_pag->getSVFVar(funPtr)),funPtr);
514
514
  findPT(funPtrDpm);
515
515
  }
516
516
  }
@@ -312,9 +312,9 @@ public:
312
312
  {
313
313
  return pag->getAllFieldsObjVars(id);
314
314
  }
315
- inline NodeID getBaseObjVar(NodeID id)
315
+ inline NodeID getBaseObjVarID(NodeID id)
316
316
  {
317
- return pag->getBaseObjVar(id);
317
+ return pag->getBaseObjVarID(id);
318
318
  }
319
319
  inline bool isSingleFieldObj(NodeID id) const
320
320
  {
@@ -312,11 +312,11 @@ public:
312
312
  ///@{
313
313
  inline bool isFIObjNode(NodeID id) const
314
314
  {
315
- return (SVFUtil::isa<BaseObjVar>(pag->getGNode(id)));
315
+ return (SVFUtil::isa<BaseObjVar>(pag->getSVFVar(id)));
316
316
  }
317
- inline NodeID getBaseObjVar(NodeID id)
317
+ inline NodeID getBaseObjVarID(NodeID id)
318
318
  {
319
- return pag->getBaseObjVar(id);
319
+ return pag->getBaseObjVarID(id);
320
320
  }
321
321
  inline NodeID getFIObjVar(NodeID id)
322
322
  {
@@ -348,7 +348,7 @@ public:
348
348
  expandedCpts = cpts;;
349
349
  for(typename CPtSet::const_iterator cit = cpts.begin(), ecit=cpts.end(); cit!=ecit; ++cit)
350
350
  {
351
- if(pag->getBaseObjVar(cit->get_id())==cit->get_id())
351
+ if(pag->getBaseObjVarID(cit->get_id())==cit->get_id())
352
352
  {
353
353
  NodeBS& fields = pag->getAllFieldsObjVars(cit->get_id());
354
354
  for(NodeBS::iterator it = fields.begin(), eit = fields.end(); it!=eit; ++it)
@@ -564,7 +564,7 @@ public:
564
564
  {
565
565
  for (OrderedNodeSet::iterator nIter = this->getAllValidPtrs().begin(); nIter != this->getAllValidPtrs().end(); ++nIter)
566
566
  {
567
- const PAGNode* node = this->getPAG()->getGNode(*nIter);
567
+ const SVFVar* node = this->getPAG()->getSVFVar(*nIter);
568
568
  if (this->getPAG()->isValidTopLevelPtr(node))
569
569
  {
570
570
  if (SVFUtil::isa<DummyObjVar>(node))
@@ -64,9 +64,9 @@ public:
64
64
  typedef Map<const FunObjVar*,SVFStmtSet> FunToPAGEdgeSetMap;
65
65
  typedef Map<const ICFGNode*,SVFStmtList> ICFGNode2SVFStmtsMap;
66
66
  typedef Map<NodeID, NodeID> NodeToNodeMap;
67
- typedef std::pair<NodeID, APOffset> NodeOffset;
67
+ typedef std::pair<NodeID, APOffset> GepOffset;
68
68
  typedef std::pair<NodeID, AccessPath> NodeAccessPath;
69
- typedef Map<NodeOffset,NodeID> NodeOffsetMap;
69
+ typedef Map<GepOffset,NodeID> OffsetToGepVarMap;
70
70
  typedef Map<NodeAccessPath,NodeID> NodeAccessPathMap;
71
71
  typedef Map<NodeID, NodeAccessPathMap> GepValueVarMap;
72
72
  typedef std::pair<const SVFType*, std::vector<AccessPath>> SVFTypeLocSetsPair;
@@ -80,7 +80,7 @@ private:
80
80
  ICFGNode2SVFStmtsMap icfgNode2PTASVFStmtsMap; ///< Map an ICFGNode to its PointerAnalysis related SVFStmts
81
81
  GepValueVarMap GepValObjMap; ///< Map a pair<base,off> to a gep value node id
82
82
  TypeLocSetsMap typeLocSetsMap; ///< Map an arg to its base SVFType* and all its field location sets
83
- NodeOffsetMap GepObjVarMap; ///< Map a pair<base,off> to a gep obj node id
83
+ OffsetToGepVarMap GepObjVarMap; ///< Map a pair<base,off> to a gep obj node id
84
84
  MemObjToFieldsMap memToFieldsMap; ///< Map a mem object id to all its fields
85
85
  SVFStmtSet globSVFStmtSet; ///< Global PAGEdges without control flow information
86
86
  PHINodeMap phiNodeMap; ///< A set of phi copy edges
@@ -126,13 +126,67 @@ public:
126
126
  pag = nullptr;
127
127
  }
128
128
  //@}
129
+ /// ObjVar/GepObjVar/BaseObjVar
130
+ //@{
131
+ inline const SVFVar* getSVFVar(NodeID id) const
132
+ {
133
+ return getGNode(id);
134
+ }
135
+ inline const ObjVar* getObjVar(NodeID id) const
136
+ {
137
+ if(const SVFVar* var = getSVFVar(id))
138
+ return SVFUtil::dyn_cast<ObjVar>(var);
139
+ else
140
+ {
141
+ assert(false && "the Node is not an ObjVar");
142
+ return nullptr;
143
+ }
144
+ }
145
+ inline const BaseObjVar* getBaseObjVar(NodeID id) const
146
+ {
147
+ if(const SVFVar* var = getSVFVar(id))
148
+ return SVFUtil::dyn_cast<BaseObjVar>(var);
149
+ else
150
+ {
151
+ assert(false && "the Node is not a BaseObjVar");
152
+ return nullptr;
153
+ }
154
+ }
155
+ inline const GepObjVar* getGepObjVar(NodeID id) const
156
+ {
157
+ if(const SVFVar* var = getSVFVar(id))
158
+ return SVFUtil::dyn_cast<GepObjVar>(var);
159
+ else
160
+ {
161
+ assert(false && "the Node is not a GepObjVar");
162
+ return nullptr;
163
+ }
164
+ }
165
+ inline bool isObjVar(NodeID id) const
166
+ {
167
+ return SVFUtil::isa<ObjVar>(getSVFVar(id));
168
+ }
169
+ inline bool isBaseObjVar(NodeID id) const
170
+ {
171
+ return SVFUtil::isa<BaseObjVar>(getSVFVar(id));
172
+ }
173
+ inline bool isGepObjVar(NodeID id) const
174
+ {
175
+ return SVFUtil::isa<GepObjVar>(getSVFVar(id));
176
+ }
177
+ /// Return the entire SVFID to SVFVar map
178
+ inline const IDToNodeMapTy& getSVFVarMap() const
179
+ {
180
+ return IDToNodeMap;
181
+ }
182
+ //@}
129
183
  /// Return memToFieldsMap
130
184
  inline MemObjToFieldsMap& getMemToFieldsMap()
131
185
  {
132
186
  return memToFieldsMap;
133
187
  }
134
188
  /// Return GepObjVarMap
135
- inline NodeOffsetMap& getGepObjNodeMap()
189
+ inline OffsetToGepVarMap& getGepObjNodeMap()
136
190
  {
137
191
  return GepObjVarMap;
138
192
  }
@@ -423,17 +477,17 @@ public:
423
477
  //@{
424
478
  inline const BaseObjVar* getBaseObject(NodeID id) const
425
479
  {
426
- const SVFVar* node = getGNode(id);
480
+ const SVFVar* node = getSVFVar(id);
427
481
  if(const GepObjVar* gepObjVar = SVFUtil::dyn_cast<GepObjVar>(node))
428
482
  return SVFUtil::dyn_cast<BaseObjVar>(
429
- getGNode(gepObjVar->getBaseNode()));
483
+ getSVFVar(gepObjVar->getBaseNode()));
430
484
  else
431
485
  return SVFUtil::dyn_cast<BaseObjVar>(node);
432
486
  }
433
487
 
434
488
  inline const ValVar* getBaseValVar(NodeID id) const
435
489
  {
436
- const SVFVar* node = getGNode(id);
490
+ const SVFVar* node = getSVFVar(id);
437
491
  if(const GepValVar* gepVar = SVFUtil::dyn_cast<GepValVar>(node))
438
492
  return gepVar->getBaseNode();
439
493
  else
@@ -453,7 +507,7 @@ public:
453
507
  }
454
508
  inline NodeID getFIObjVar(NodeID id) const
455
509
  {
456
- return getBaseObjVar(id);
510
+ return getBaseObjVarID(id);
457
511
  }
458
512
  //@}
459
513
 
@@ -477,7 +531,7 @@ public:
477
531
  /// Base and Offset methods for Value and Object node
478
532
  //@{
479
533
  /// Get a base pointer node given a field pointer
480
- inline NodeID getBaseObjVar(NodeID id) const
534
+ inline NodeID getBaseObjVarID(NodeID id) const
481
535
  {
482
536
  return getBaseObject(id)->getId();
483
537
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2479",
3
+ "version": "1.0.2480",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {