svf-tools 1.0.992 → 1.0.993

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.992",
3
+ "version": "1.0.993",
4
4
  "description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -42,7 +42,7 @@ typedef GenericEdge<CDGNode> GenericCDGEdgeTy;
42
42
  class CDGEdge : public GenericCDGEdgeTy
43
43
  {
44
44
  public:
45
- typedef std::pair<const SVFValue *, s32_t> BranchCondition;
45
+ typedef std::pair<const SVFVar *, s32_t> BranchCondition;
46
46
 
47
47
  /// Constructor
48
48
  CDGEdge(CDGNode *s, CDGNode *d) : GenericCDGEdgeTy(s, d, 0)
@@ -73,7 +73,7 @@ public:
73
73
  return brConditions;
74
74
  }
75
75
 
76
- void insertBranchCondition(const SVFValue *pNode, s32_t branchID)
76
+ void insertBranchCondition(const SVFVar *pNode, s32_t branchID)
77
77
  {
78
78
  brConditions.insert(std::make_pair(pNode, branchID));
79
79
  }
@@ -288,7 +288,7 @@ public:
288
288
  }
289
289
 
290
290
  /// Add CDG edges from nodeid pair
291
- void addCDGEdgeFromSrcDst(const ICFGNode *src, const ICFGNode *dst, const SVFValue *pNode, s32_t branchID);
291
+ void addCDGEdgeFromSrcDst(const ICFGNode *src, const ICFGNode *dst, const SVFVar *pNode, s32_t branchID);
292
292
 
293
293
  };
294
294
  } // end namespace SVF
@@ -32,7 +32,7 @@ using namespace SVF;
32
32
 
33
33
  CDG *CDG::controlDg = nullptr;
34
34
 
35
- void CDG::addCDGEdgeFromSrcDst(const ICFGNode *src, const ICFGNode *dst, const SVFValue *pNode, s32_t branchID)
35
+ void CDG::addCDGEdgeFromSrcDst(const ICFGNode *src, const ICFGNode *dst, const SVFVar *pNode, s32_t branchID)
36
36
  {
37
37
  if (!hasCDGNode(src->getId()))
38
38
  {
@@ -88,15 +88,14 @@ s64_t CDGBuilder::getBBSuccessorBranchID(const SVFBasicBlock *BB, const SVFBasic
88
88
  ICFG *icfg = PAG::getPAG()->getICFG();
89
89
  assert(!BB->getICFGNodeList().empty() && "empty bb?");
90
90
  const ICFGNode *pred = BB->back();
91
- const ICFGEdge *edge = nullptr;
92
- for (const auto &node: Succ->getICFGNodeList())
91
+ if (const CallICFGNode* callNode = dyn_cast<CallICFGNode>(pred))
93
92
  {
94
- if (const ICFGEdge *e = icfg->getICFGEdge(pred, node, ICFGEdge::ICFGEdgeK::IntraCF))
95
- {
96
- edge = e;
97
- break;
98
- }
93
+ // not a branch statement:
94
+ // invoke void %3(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %2)
95
+ // to label %invoke.cont1 unwind label %lpad
96
+ pred = callNode->getRetICFGNode();
99
97
  }
98
+ const ICFGEdge *edge = icfg->getICFGEdge(pred, Succ->front(), ICFGEdge::ICFGEdgeK::IntraCF);
100
99
  if (const IntraCFGEdge *intraEdge = SVFUtil::dyn_cast<IntraCFGEdge>(edge))
101
100
  {
102
101
  if(intraEdge->getCondition())
@@ -190,9 +189,15 @@ void CDGBuilder::buildICFGNodeControlMap()
190
189
  for (const auto &it2: it.second)
191
190
  {
192
191
  const SVFBasicBlock *controllingBB = it2.first;
193
- // const ICFGNode *controlNode = _bbToNode[it.first].first;
194
- // if(!controlNode) continue;
195
192
  const ICFGNode *controlNode = it.first->getICFGNodeList().back();
193
+ if (const CallICFGNode* callNode =
194
+ SVFUtil::dyn_cast<CallICFGNode>(controlNode))
195
+ {
196
+ // not a branch statement:
197
+ // invoke void %3(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %2)
198
+ // to label %invoke.cont1 unwind label %lpad
199
+ controlNode = callNode->getRetICFGNode();
200
+ }
196
201
  if (!controlNode) continue;
197
202
  // controlNode control at pos
198
203
  for (const auto &controllee: controllingBB->getICFGNodeList())
@@ -201,9 +206,30 @@ void CDGBuilder::buildICFGNodeControlMap()
201
206
  _nodeDependentOnMap[controllee][controlNode].insert(it2.second.begin(), it2.second.end());
202
207
  for (s32_t pos: it2.second)
203
208
  {
204
- _controlDG->addCDGEdgeFromSrcDst(controlNode, controllee,
205
- SVFUtil::dyn_cast<IntraICFGNode>(controlNode)->getInst(),
206
- pos);
209
+ if (const IntraICFGNode* intraNode =
210
+ dyn_cast<IntraICFGNode>(controlNode))
211
+ {
212
+ assert(intraNode->getSVFStmts().size() == 1 &&
213
+ "not a branch stmt?");
214
+ const SVFVar* condition =
215
+ SVFUtil::cast<BranchStmt>(
216
+ intraNode->getSVFStmts().front())
217
+ ->getCondition();
218
+ _controlDG->addCDGEdgeFromSrcDst(controlNode, controllee,
219
+ condition,
220
+ pos);
221
+ }
222
+ else
223
+ {
224
+ // not a branch statement:
225
+ // invoke void %3(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %2)
226
+ // to label %invoke.cont1 unwind label %lpad
227
+ SVFIR* pag = PAG::getPAG();
228
+ _controlDG->addCDGEdgeFromSrcDst(
229
+ controlNode, controllee,
230
+ pag->getGNode(pag->getNullPtr()), pos);
231
+ }
232
+
207
233
  }
208
234
  }
209
235
  }