svf-tools 1.0.1003 → 1.0.1004
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.
|
|
3
|
+
"version": "1.0.1004",
|
|
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": {
|
|
@@ -143,7 +143,7 @@ protected:
|
|
|
143
143
|
/// Add intraprocedural and interprocedural control-flow edges.
|
|
144
144
|
//@{
|
|
145
145
|
ICFGEdge* addIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode);
|
|
146
|
-
ICFGEdge* addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode,
|
|
146
|
+
ICFGEdge* addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode, s64_t branchCondVal);
|
|
147
147
|
ICFGEdge* addCallEdge(ICFGNode* srcNode, ICFGNode* dstNode);
|
|
148
148
|
ICFGEdge* addRetEdge(ICFGNode* srcNode, ICFGNode* dstNode);
|
|
149
149
|
//@}
|
|
@@ -114,6 +114,8 @@ class IntraCFGEdge : public ICFGEdge
|
|
|
114
114
|
{
|
|
115
115
|
friend class SVFIRWriter;
|
|
116
116
|
friend class SVFIRReader;
|
|
117
|
+
friend class ICFG;
|
|
118
|
+
friend class SVFIRBuilder;
|
|
117
119
|
|
|
118
120
|
public:
|
|
119
121
|
/// Constructor
|
|
@@ -137,7 +139,7 @@ public:
|
|
|
137
139
|
}
|
|
138
140
|
//@}
|
|
139
141
|
|
|
140
|
-
const
|
|
142
|
+
const SVFVar* getCondition() const
|
|
141
143
|
{
|
|
142
144
|
return conditionVar;
|
|
143
145
|
}
|
|
@@ -148,12 +150,6 @@ public:
|
|
|
148
150
|
return branchCondVal;
|
|
149
151
|
}
|
|
150
152
|
|
|
151
|
-
void setBranchCondition(const SVFValue* c, s64_t bVal)
|
|
152
|
-
{
|
|
153
|
-
conditionVar = c;
|
|
154
|
-
branchCondVal = bVal;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
153
|
virtual const std::string toString() const;
|
|
158
154
|
|
|
159
155
|
private:
|
|
@@ -166,8 +162,18 @@ private:
|
|
|
166
162
|
/// Inst3: label 1;
|
|
167
163
|
/// for edge between Inst1 and Inst 2, the first element is %cmp and
|
|
168
164
|
/// the second element is 0
|
|
169
|
-
const
|
|
165
|
+
const SVFVar* conditionVar;
|
|
170
166
|
s64_t branchCondVal;
|
|
167
|
+
|
|
168
|
+
inline void setConditionVar(const SVFVar* c)
|
|
169
|
+
{
|
|
170
|
+
conditionVar = c;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
inline void setBranchCondVal(s64_t bVal)
|
|
174
|
+
{
|
|
175
|
+
branchCondVal = bVal;
|
|
176
|
+
}
|
|
171
177
|
};
|
|
172
178
|
|
|
173
179
|
/*!
|
|
@@ -452,9 +452,7 @@ bool AbstractInterpretation::isSwitchBranchFeasible(const SVFVar* var, s64_t suc
|
|
|
452
452
|
bool AbstractInterpretation::isBranchFeasible(const IntraCFGEdge* intraEdge,
|
|
453
453
|
AbstractState& as)
|
|
454
454
|
{
|
|
455
|
-
const
|
|
456
|
-
NodeID cmpID = svfir->getValueNode(cond);
|
|
457
|
-
SVFVar *cmpVar = svfir->getGNode(cmpID);
|
|
455
|
+
const SVFVar *cmpVar = intraEdge->getCondition();
|
|
458
456
|
if (cmpVar->getInEdges().empty())
|
|
459
457
|
{
|
|
460
458
|
return isSwitchBranchFeasible(cmpVar,
|
package/svf/lib/Graphs/ICFG.cpp
CHANGED
|
@@ -341,7 +341,7 @@ ICFGEdge* ICFG::addIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode)
|
|
|
341
341
|
/*!
|
|
342
342
|
* Add conditional intraprocedural edges between two nodes
|
|
343
343
|
*/
|
|
344
|
-
ICFGEdge* ICFG::addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode,
|
|
344
|
+
ICFGEdge* ICFG::addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode, s64_t branchCondVal)
|
|
345
345
|
{
|
|
346
346
|
|
|
347
347
|
checkIntraEdgeParents(srcNode, dstNode);
|
|
@@ -354,7 +354,7 @@ ICFGEdge* ICFG::addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode, co
|
|
|
354
354
|
else
|
|
355
355
|
{
|
|
356
356
|
IntraCFGEdge* intraEdge = new IntraCFGEdge(srcNode,dstNode);
|
|
357
|
-
intraEdge->
|
|
357
|
+
intraEdge->setBranchCondVal(branchCondVal);
|
|
358
358
|
return (addICFGEdge(intraEdge) ? intraEdge : nullptr);
|
|
359
359
|
}
|
|
360
360
|
}
|
|
@@ -157,7 +157,7 @@ void ICFGBuilder::processFunBody(WorkList& worklist)
|
|
|
157
157
|
}
|
|
158
158
|
InstVec nextInsts;
|
|
159
159
|
LLVMUtil::getNextInsts(inst, nextInsts);
|
|
160
|
-
|
|
160
|
+
s64_t branchID = 0;
|
|
161
161
|
for (InstVec::const_iterator nit = nextInsts.begin(), enit =
|
|
162
162
|
nextInsts.end(); nit != enit; ++nit)
|
|
163
163
|
{
|
|
@@ -185,7 +185,7 @@ void ICFGBuilder::processFunBody(WorkList& worklist)
|
|
|
185
185
|
{
|
|
186
186
|
assert(branchID <= 1 && "if/else has more than two branches?");
|
|
187
187
|
if(br->isConditional())
|
|
188
|
-
icfg->addConditionalIntraEdge(srcNode, dstNode,
|
|
188
|
+
icfg->addConditionalIntraEdge(srcNode, dstNode, 1 - branchID);
|
|
189
189
|
else
|
|
190
190
|
icfg->addIntraEdge(srcNode, dstNode);
|
|
191
191
|
}
|
|
@@ -197,7 +197,7 @@ void ICFGBuilder::processFunBody(WorkList& worklist)
|
|
|
197
197
|
s64_t val = -1;
|
|
198
198
|
if (condVal && condVal->getBitWidth() <= 64)
|
|
199
199
|
val = condVal->getSExtValue();
|
|
200
|
-
icfg->addConditionalIntraEdge(srcNode, dstNode,
|
|
200
|
+
icfg->addConditionalIntraEdge(srcNode, dstNode,val);
|
|
201
201
|
}
|
|
202
202
|
else
|
|
203
203
|
icfg->addIntraEdge(srcNode, dstNode);
|
|
@@ -975,6 +975,17 @@ void SVFIRBuilder::visitBranchInst(BranchInst &inst)
|
|
|
975
975
|
branchID++;
|
|
976
976
|
}
|
|
977
977
|
addBranchStmt(brinst, cond, successors);
|
|
978
|
+
/// set conditional svf var
|
|
979
|
+
if (inst.isConditional())
|
|
980
|
+
{
|
|
981
|
+
for (auto& edge : llvmModuleSet()->getICFGNode(&inst)->getOutEdges())
|
|
982
|
+
{
|
|
983
|
+
if (IntraCFGEdge* intraEdge = SVFUtil::dyn_cast<IntraCFGEdge>(edge))
|
|
984
|
+
{
|
|
985
|
+
intraEdge->setConditionVar(pag->getGNode(cond));
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}
|
|
978
989
|
}
|
|
979
990
|
|
|
980
991
|
|
|
@@ -1043,6 +1054,14 @@ void SVFIRBuilder::visitSwitchInst(SwitchInst &inst)
|
|
|
1043
1054
|
successors.push_back(std::make_pair(icfgNode, val));
|
|
1044
1055
|
}
|
|
1045
1056
|
addBranchStmt(brinst, cond, successors);
|
|
1057
|
+
/// set conditional svf var
|
|
1058
|
+
for (auto& edge : llvmModuleSet()->getICFGNode(&inst)->getOutEdges())
|
|
1059
|
+
{
|
|
1060
|
+
if (IntraCFGEdge* intraEdge = SVFUtil::dyn_cast<IntraCFGEdge>(edge))
|
|
1061
|
+
{
|
|
1062
|
+
intraEdge->setConditionVar(pag->getGNode(cond));
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1046
1065
|
}
|
|
1047
1066
|
|
|
1048
1067
|
|