svf-tools 1.0.1037 → 1.0.1038
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 +1 -1
- package/svf/include/SVFIR/SVFIR.h +2 -2
- package/svf/include/SVFIR/SVFValue.h +5 -3
- package/svf/include/SVFIR/SVFVariables.h +2 -3
- package/svf/lib/SVFIR/SVFValue.cpp +1 -3
- package/svf/lib/SVFIR/SVFVariables.cpp +2 -2
- package/svf-llvm/lib/LLVMModule.cpp +6 -1
- package/svf-llvm/lib/SVFIRBuilder.cpp +15 -2
- package/svf-llvm/lib/SVFIRExtAPI.cpp +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1038",
|
|
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": {
|
|
@@ -553,10 +553,10 @@ private:
|
|
|
553
553
|
return addValNode(node);
|
|
554
554
|
}
|
|
555
555
|
|
|
556
|
-
NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode, const SVFType* type
|
|
556
|
+
NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode, const SVFType* type)
|
|
557
557
|
{
|
|
558
558
|
ArgValVar* node =
|
|
559
|
-
new ArgValVar(i, argNo, icfgNode, callGraphNode, type
|
|
559
|
+
new ArgValVar(i, argNo, icfgNode, callGraphNode, type);
|
|
560
560
|
return addValNode(node);
|
|
561
561
|
}
|
|
562
562
|
|
|
@@ -292,6 +292,8 @@ public:
|
|
|
292
292
|
//@}
|
|
293
293
|
};
|
|
294
294
|
|
|
295
|
+
class ArgValVar;
|
|
296
|
+
|
|
295
297
|
class SVFFunction : public SVFValue
|
|
296
298
|
{
|
|
297
299
|
friend class LLVMModuleSet;
|
|
@@ -316,7 +318,7 @@ private:
|
|
|
316
318
|
const SVFFunctionType* funcType; /// FunctionType, which is different from the type (PointerType) of this SVFFunction
|
|
317
319
|
SVFLoopAndDomInfo* loopAndDom; /// the loop and dominate information
|
|
318
320
|
const SVFFunction* realDefFun; /// the definition of a function across multiple modules
|
|
319
|
-
std::vector<const
|
|
321
|
+
std::vector<const ArgValVar*> allArgs; /// all formal arguments of this function
|
|
320
322
|
SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
|
|
321
323
|
const CallGraphNode *callGraphNode; /// call graph node for this function
|
|
322
324
|
BasicBlockGraph* bbGraph; /// the basic block graph of this function
|
|
@@ -327,7 +329,7 @@ protected:
|
|
|
327
329
|
callGraphNode = cgn;
|
|
328
330
|
}
|
|
329
331
|
|
|
330
|
-
inline void addArgument(
|
|
332
|
+
inline void addArgument(const ArgValVar* arg)
|
|
331
333
|
{
|
|
332
334
|
allArgs.push_back(arg);
|
|
333
335
|
}
|
|
@@ -417,7 +419,7 @@ public:
|
|
|
417
419
|
}
|
|
418
420
|
|
|
419
421
|
u32_t arg_size() const;
|
|
420
|
-
const
|
|
422
|
+
const ArgValVar* getArg(u32_t idx) const;
|
|
421
423
|
bool isVarArg() const;
|
|
422
424
|
|
|
423
425
|
inline bool hasBasicBlock() const
|
|
@@ -368,7 +368,6 @@ class ArgValVar: public ValVar
|
|
|
368
368
|
private:
|
|
369
369
|
const CallGraphNode* cgNode;
|
|
370
370
|
u32_t argNo;
|
|
371
|
-
bool uncalled;
|
|
372
371
|
|
|
373
372
|
protected:
|
|
374
373
|
/// Constructor to create function argument (for SVFIRReader/deserialization)
|
|
@@ -401,7 +400,7 @@ public:
|
|
|
401
400
|
|
|
402
401
|
/// Constructor
|
|
403
402
|
ArgValVar(NodeID i, u32_t argNo, const ICFGNode* icn, const CallGraphNode* callGraphNode,
|
|
404
|
-
const SVFType* svfType
|
|
403
|
+
const SVFType* svfType);
|
|
405
404
|
|
|
406
405
|
/// Return name of a LLVM value
|
|
407
406
|
inline const std::string getValueName() const
|
|
@@ -422,7 +421,7 @@ public:
|
|
|
422
421
|
|
|
423
422
|
inline bool isArgOfUncalledFunction() const
|
|
424
423
|
{
|
|
425
|
-
return
|
|
424
|
+
return getFunction()->isUncalledFunction();
|
|
426
425
|
}
|
|
427
426
|
|
|
428
427
|
virtual bool isPointer() const;
|
|
@@ -160,8 +160,6 @@ SVFFunction::SVFFunction(const SVFType* ty, const SVFFunctionType* ft,
|
|
|
160
160
|
|
|
161
161
|
SVFFunction::~SVFFunction()
|
|
162
162
|
{
|
|
163
|
-
for(const SVFArgument* arg : allArgs)
|
|
164
|
-
delete arg;
|
|
165
163
|
delete loopAndDom;
|
|
166
164
|
delete bbGraph;
|
|
167
165
|
}
|
|
@@ -171,7 +169,7 @@ u32_t SVFFunction::arg_size() const
|
|
|
171
169
|
return allArgs.size();
|
|
172
170
|
}
|
|
173
171
|
|
|
174
|
-
const
|
|
172
|
+
const ArgValVar* SVFFunction::getArg(u32_t idx) const
|
|
175
173
|
{
|
|
176
174
|
assert (idx < allArgs.size() && "getArg() out of range!");
|
|
177
175
|
return allArgs[idx];
|
|
@@ -102,9 +102,9 @@ const std::string ObjVar::toString() const
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
ArgValVar::ArgValVar(NodeID i, u32_t argNo, const ICFGNode* icn,
|
|
105
|
-
const SVF::CallGraphNode* callGraphNode, const SVFType* svfType
|
|
105
|
+
const SVF::CallGraphNode* callGraphNode, const SVFType* svfType)
|
|
106
106
|
: ValVar(i, svfType, icn, ArgValNode),
|
|
107
|
-
cgNode(callGraphNode), argNo(argNo)
|
|
107
|
+
cgNode(callGraphNode), argNo(argNo)
|
|
108
108
|
{
|
|
109
109
|
|
|
110
110
|
}
|
|
@@ -90,6 +90,12 @@ LLVMModuleSet::~LLVMModuleSet()
|
|
|
90
90
|
delete item.second;
|
|
91
91
|
item.second = nullptr;
|
|
92
92
|
}
|
|
93
|
+
|
|
94
|
+
for (auto& item: LLVMArgument2SVFArgument)
|
|
95
|
+
{
|
|
96
|
+
delete item.second;
|
|
97
|
+
item.second = nullptr;
|
|
98
|
+
}
|
|
93
99
|
delete typeInference;
|
|
94
100
|
typeInference = nullptr;
|
|
95
101
|
}
|
|
@@ -294,7 +300,6 @@ void LLVMModuleSet::createSVFFunction(const Function* func)
|
|
|
294
300
|
if (!arg.hasName())
|
|
295
301
|
svfarg->setName(std::to_string(arg.getArgNo()));
|
|
296
302
|
|
|
297
|
-
svfFunc->addArgument(svfarg);
|
|
298
303
|
addArgumentMap(&arg, svfarg);
|
|
299
304
|
}
|
|
300
305
|
|
|
@@ -228,8 +228,9 @@ void SVFIRBuilder::initialiseNodes()
|
|
|
228
228
|
{
|
|
229
229
|
pag->addArgValNode(
|
|
230
230
|
iter->second, argval->getArgNo(), icfgNode,
|
|
231
|
-
llvmModuleSet()->getCallGraphNode(argval->getParent()),iter->first->getType()
|
|
232
|
-
|
|
231
|
+
llvmModuleSet()->getCallGraphNode(argval->getParent()),iter->first->getType());
|
|
232
|
+
if (!argval->hasName())
|
|
233
|
+
pag->getGNode(iter->second)->setName("arg_" + std::to_string(argval->getArgNo()));
|
|
233
234
|
}
|
|
234
235
|
else if (auto fpValue = SVFUtil::dyn_cast<ConstantFP>(llvmValue))
|
|
235
236
|
{
|
|
@@ -403,6 +404,18 @@ void SVFIRBuilder::initialiseNodes()
|
|
|
403
404
|
assert(pag->getTotalNodeNum() >= pag->getTotalSymNum()
|
|
404
405
|
&& "not all node have been initialized!!!");
|
|
405
406
|
|
|
407
|
+
/// add argvalvar for svffunctions
|
|
408
|
+
for (auto& fun: svfModule->getFunctionSet())
|
|
409
|
+
{
|
|
410
|
+
const Function* llvmFun = SVFUtil::cast<Function>(llvmModuleSet()->getLLVMValue(fun));
|
|
411
|
+
for (const Argument& arg : llvmFun->args())
|
|
412
|
+
{
|
|
413
|
+
const_cast<SVFFunction *>(fun)->addArgument(
|
|
414
|
+
SVFUtil::cast<ArgValVar>(
|
|
415
|
+
pag->getGNode(llvmModuleSet()->getValueNode(llvmModuleSet()->getSVFArgument(&arg)))));
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
406
419
|
}
|
|
407
420
|
|
|
408
421
|
/*
|
|
@@ -272,12 +272,12 @@ void SVFIRBuilder::handleExtCall(const CallBase* cs, const SVFFunction* svfCalle
|
|
|
272
272
|
assert((forkedFun->arg_size() <= 2) && "Size of formal parameter of start routine should be one");
|
|
273
273
|
if (forkedFun->arg_size() <= 2 && forkedFun->arg_size() >= 1)
|
|
274
274
|
{
|
|
275
|
-
const
|
|
275
|
+
const ArgValVar* formalParm = forkedFun->getArg(0);
|
|
276
276
|
/// Connect actual parameter to formal parameter of the start routine
|
|
277
277
|
if (actualParm->isPointer() && formalParm->getType()->isPointerTy())
|
|
278
278
|
{
|
|
279
279
|
FunEntryICFGNode *entry = pag->getICFG()->getFunEntryICFGNode(forkedFun);
|
|
280
|
-
addThreadForkEdge(actualParm->getId(),
|
|
280
|
+
addThreadForkEdge(actualParm->getId(), formalParm->getId(), callICFGNode, entry);
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
}
|