svf-tools 1.0.1052 → 1.0.1053
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/lib/SVFIR/SVFVariables.cpp +5 -5
- package/svf-llvm/include/SVF-LLVM/LLVMModule.h +3 -3
- package/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +2 -2
- package/svf-llvm/include/SVF-LLVM/SVFLLVMValue.h +0 -42
- package/svf-llvm/lib/LLVMModule.cpp +1 -3
- package/svf-llvm/lib/SVFIRBuilder.cpp +10 -8
- package/svf-llvm/lib/SVFIRExtAPI.cpp +1 -1
- package/svf-llvm/lib/SVFLLVMValue.cpp +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1053",
|
|
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": {
|
|
@@ -289,7 +289,7 @@ const std::string ConstAggValVar::toString() const
|
|
|
289
289
|
{
|
|
290
290
|
std::string str;
|
|
291
291
|
std::stringstream rawstr(str);
|
|
292
|
-
rawstr << "
|
|
292
|
+
rawstr << "ConstAggValVar ID: " << getId();
|
|
293
293
|
if (Options::ShowSVFIRValue())
|
|
294
294
|
{
|
|
295
295
|
rawstr << "\n";
|
|
@@ -301,7 +301,7 @@ const std::string ConstDataValVar::toString() const
|
|
|
301
301
|
{
|
|
302
302
|
std::string str;
|
|
303
303
|
std::stringstream rawstr(str);
|
|
304
|
-
rawstr << "
|
|
304
|
+
rawstr << "ConstDataValVar ID: " << getId();
|
|
305
305
|
if (Options::ShowSVFIRValue())
|
|
306
306
|
{
|
|
307
307
|
rawstr << "\n";
|
|
@@ -327,7 +327,7 @@ const std::string ConstFPValVar::toString() const
|
|
|
327
327
|
{
|
|
328
328
|
std::string str;
|
|
329
329
|
std::stringstream rawstr(str);
|
|
330
|
-
rawstr << "
|
|
330
|
+
rawstr << "ConstFPValVar ID: " << getId();
|
|
331
331
|
if (Options::ShowSVFIRValue())
|
|
332
332
|
{
|
|
333
333
|
rawstr << "\n";
|
|
@@ -340,7 +340,7 @@ const std::string ConstIntValVar::toString() const
|
|
|
340
340
|
{
|
|
341
341
|
std::string str;
|
|
342
342
|
std::stringstream rawstr(str);
|
|
343
|
-
rawstr << "
|
|
343
|
+
rawstr << "ConstIntValVar ID: " << getId();
|
|
344
344
|
if (Options::ShowSVFIRValue())
|
|
345
345
|
{
|
|
346
346
|
rawstr << "\n";
|
|
@@ -366,7 +366,7 @@ const std::string GlobalObjVar::toString() const
|
|
|
366
366
|
{
|
|
367
367
|
std::string str;
|
|
368
368
|
std::stringstream rawstr(str);
|
|
369
|
-
rawstr << "
|
|
369
|
+
rawstr << "GlobalObjVar ID: " << getId();
|
|
370
370
|
if (Options::ShowSVFIRValue())
|
|
371
371
|
{
|
|
372
372
|
rawstr << "\n";
|
|
@@ -57,7 +57,7 @@ public:
|
|
|
57
57
|
typedef Map<const Function*, SVFFunction*> LLVMFun2SVFFunMap;
|
|
58
58
|
typedef Map<const Function*, FunObjVar*> LLVMFun2FunObjVarMap;
|
|
59
59
|
typedef Map<const BasicBlock*, SVFBasicBlock*> LLVMBB2SVFBBMap;
|
|
60
|
-
typedef Map<const Instruction*,
|
|
60
|
+
typedef Map<const Instruction*, SVFLLVMValue*> LLVMInst2SVFInstMap;
|
|
61
61
|
typedef Map<const Argument*, SVFLLVMValue*> LLVMArgument2SVFArgumentMap;
|
|
62
62
|
typedef Map<const Constant*, SVFLLVMValue*> LLVMConst2SVFConstMap;
|
|
63
63
|
typedef Map<const Value*, SVFLLVMValue*> LLVMValue2SVFOtherValueMap;
|
|
@@ -233,7 +233,7 @@ public:
|
|
|
233
233
|
SVFBaseNode2LLVMValue[svfBB] = bb;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
inline void addInstructionMap(const Instruction* inst,
|
|
236
|
+
inline void addInstructionMap(const Instruction* inst, SVFLLVMValue* svfInst)
|
|
237
237
|
{
|
|
238
238
|
LLVMInst2SVFInst[inst] = svfInst;
|
|
239
239
|
setValueAttr(inst,svfInst);
|
|
@@ -346,7 +346,7 @@ public:
|
|
|
346
346
|
return it->second;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
inline
|
|
349
|
+
inline SVFLLVMValue* getSVFInstruction(const Instruction* inst) const
|
|
350
350
|
{
|
|
351
351
|
LLVMInst2SVFInstMap::const_iterator it = LLVMInst2SVFInst.find(inst);
|
|
352
352
|
assert(it!=LLVMInst2SVFInst.end() && "SVF Instruction not found!");
|
|
@@ -454,9 +454,9 @@ protected:
|
|
|
454
454
|
inline void addStoreEdge(NodeID src, NodeID dst)
|
|
455
455
|
{
|
|
456
456
|
ICFGNode* node;
|
|
457
|
-
if (const
|
|
457
|
+
if (const Instruction* inst = SVFUtil::dyn_cast<Instruction>(llvmModuleSet()->getLLVMValue(curVal)))
|
|
458
458
|
node = llvmModuleSet()->getICFGNode(
|
|
459
|
-
SVFUtil::cast<Instruction>(
|
|
459
|
+
SVFUtil::cast<Instruction>(inst));
|
|
460
460
|
else
|
|
461
461
|
node = nullptr;
|
|
462
462
|
if (StoreStmt* edge = pag->addStoreStmt(src, dst, node))
|
|
@@ -63,7 +63,6 @@ public:
|
|
|
63
63
|
{
|
|
64
64
|
SVFVal,
|
|
65
65
|
SVFFunc,
|
|
66
|
-
SVFInst,
|
|
67
66
|
};
|
|
68
67
|
|
|
69
68
|
private:
|
|
@@ -375,47 +374,6 @@ public:
|
|
|
375
374
|
}
|
|
376
375
|
};
|
|
377
376
|
|
|
378
|
-
class ICFGNode;
|
|
379
|
-
class FunObjVar;
|
|
380
|
-
|
|
381
|
-
class SVFInstruction : public SVFLLVMValue
|
|
382
|
-
{
|
|
383
|
-
friend class SVFIRWriter;
|
|
384
|
-
friend class SVFIRReader;
|
|
385
|
-
|
|
386
|
-
private:
|
|
387
|
-
const SVFBasicBlock* bb; /// The BasicBlock where this Instruction resides
|
|
388
|
-
bool terminator; /// return true if this is a terminator instruction
|
|
389
|
-
bool ret; /// return true if this is an return instruction of a function
|
|
390
|
-
|
|
391
|
-
public:
|
|
392
|
-
/// Constructor without name, set name with setName()
|
|
393
|
-
SVFInstruction(const SVFType* ty, const SVFBasicBlock* b, bool tm,
|
|
394
|
-
bool isRet, SVFValKind k = SVFInst);
|
|
395
|
-
SVFInstruction(void) = delete;
|
|
396
|
-
|
|
397
|
-
static inline bool classof(const SVFLLVMValue *node)
|
|
398
|
-
{
|
|
399
|
-
return node->getKind() == SVFInst;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
inline const SVFBasicBlock* getParent() const
|
|
403
|
-
{
|
|
404
|
-
return bb;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
inline const FunObjVar* getFunction() const
|
|
408
|
-
{
|
|
409
|
-
return bb->getParent();
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
inline bool isRetInst() const
|
|
413
|
-
{
|
|
414
|
-
return ret;
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
|
|
419
377
|
/// [FOR DEBUG ONLY, DON'T USE IT UNSIDE `svf`!]
|
|
420
378
|
/// Converts an SVFValue to corresponding LLVM::Value, then get the string
|
|
421
379
|
/// representation of it. Use it only when you are debugging. Don't use
|
|
@@ -288,9 +288,7 @@ void LLVMModuleSet::createSVFFunction(const Function* func)
|
|
|
288
288
|
addBasicBlock(svfFunc, &bb);
|
|
289
289
|
for (const Instruction& inst : bb)
|
|
290
290
|
{
|
|
291
|
-
|
|
292
|
-
getSVFBasicBlock(&bb), inst.isTerminator(),
|
|
293
|
-
SVFUtil::isa<ReturnInst>(inst));
|
|
291
|
+
SVFLLVMValue* svfInst = new SVFLLVMValue(getSVFType(inst.getType()));
|
|
294
292
|
|
|
295
293
|
addInstructionMap(&inst, svfInst);
|
|
296
294
|
}
|
|
@@ -1541,7 +1541,9 @@ NodeID SVFIRBuilder::getGepValVar(const Value* val, const AccessPath& ap, const
|
|
|
1541
1541
|
* 1. Instruction
|
|
1542
1542
|
* 2. GlobalVariable
|
|
1543
1543
|
*/
|
|
1544
|
-
assert(
|
|
1544
|
+
assert(
|
|
1545
|
+
(SVFUtil::isa<Instruction>(llvmModuleSet()->getLLVMValue(curVal)) || SVFUtil::isa<GlobalVariable>(
|
|
1546
|
+
llvmModuleSet()->getLLVMValue(curVal))) && "curVal not an instruction or a globalvariable?");
|
|
1545
1547
|
|
|
1546
1548
|
// We assume every GepValNode and its GepEdge to the baseNode are unique across the whole program
|
|
1547
1549
|
// We preserve the current BB information to restore it after creating the gepNode
|
|
@@ -1590,17 +1592,17 @@ void SVFIRBuilder::setCurrentBBAndValueForPAGEdge(PAGEdge* edge)
|
|
|
1590
1592
|
edge->setValue(pag->getGNode(llvmModuleSet()->getValueNode(curVal)));
|
|
1591
1593
|
ICFGNode* icfgNode = pag->getICFG()->getGlobalICFGNode();
|
|
1592
1594
|
LLVMModuleSet* llvmMS = llvmModuleSet();
|
|
1593
|
-
if (const
|
|
1595
|
+
if (const Instruction* curInst = SVFUtil::dyn_cast<Instruction>(llvmMS->getLLVMValue(curVal)))
|
|
1594
1596
|
{
|
|
1595
1597
|
const FunObjVar* srcFun = edge->getSrcNode()->getFunction();
|
|
1596
1598
|
const FunObjVar* dstFun = edge->getDstNode()->getFunction();
|
|
1597
1599
|
if(srcFun!=nullptr && !SVFUtil::isa<RetPE>(edge) && !SVFUtil::isa<FunValVar>(edge->getSrcNode()) && !SVFUtil::isa<FunObjVar>(edge->getSrcNode()))
|
|
1598
1600
|
{
|
|
1599
|
-
assert(srcFun==curInst->getFunction() && "SrcNode of the PAGEdge not in the same function?");
|
|
1601
|
+
assert(srcFun==llvmMS->getFunObjVar(curInst->getFunction()) && "SrcNode of the PAGEdge not in the same function?");
|
|
1600
1602
|
}
|
|
1601
1603
|
if(dstFun!=nullptr && !SVFUtil::isa<CallPE>(edge) && !SVFUtil::isa<RetValPN>(edge->getDstNode()))
|
|
1602
1604
|
{
|
|
1603
|
-
assert(dstFun==curInst->getFunction() && "DstNode of the PAGEdge not in the same function?");
|
|
1605
|
+
assert(dstFun==llvmMS->getFunObjVar(curInst->getFunction()) && "DstNode of the PAGEdge not in the same function?");
|
|
1604
1606
|
}
|
|
1605
1607
|
|
|
1606
1608
|
/// We assume every GepValVar and its GepStmt are unique across whole program
|
|
@@ -1608,16 +1610,16 @@ void SVFIRBuilder::setCurrentBBAndValueForPAGEdge(PAGEdge* edge)
|
|
|
1608
1610
|
assert(curBB && "instruction does not have a basic block??");
|
|
1609
1611
|
|
|
1610
1612
|
/// We will have one unique function exit ICFGNode for all returns
|
|
1611
|
-
if(curInst
|
|
1613
|
+
if(SVFUtil::isa<ReturnInst>(curInst))
|
|
1612
1614
|
{
|
|
1613
|
-
icfgNode = pag->getICFG()->getFunExitICFGNode(curInst->getFunction());
|
|
1615
|
+
icfgNode = pag->getICFG()->getFunExitICFGNode(llvmMS->getFunObjVar(curInst->getFunction()));
|
|
1614
1616
|
}
|
|
1615
1617
|
else
|
|
1616
1618
|
{
|
|
1617
1619
|
if(SVFUtil::isa<RetPE>(edge))
|
|
1618
|
-
icfgNode = llvmMS->getRetICFGNode(SVFUtil::cast<Instruction>(
|
|
1620
|
+
icfgNode = llvmMS->getRetICFGNode(SVFUtil::cast<Instruction>(curInst));
|
|
1619
1621
|
else
|
|
1620
|
-
icfgNode = llvmMS->getICFGNode(SVFUtil::cast<Instruction>(
|
|
1622
|
+
icfgNode = llvmMS->getICFGNode(SVFUtil::cast<Instruction>(curInst));
|
|
1621
1623
|
}
|
|
1622
1624
|
}
|
|
1623
1625
|
else if (const Argument* arg = SVFUtil::dyn_cast<Argument>(llvmModuleSet()->getLLVMValue(curVal)))
|
|
@@ -128,7 +128,7 @@ void SVFIRBuilder::addComplexConsForExt(Value *D, Value *S, const Value* szValue
|
|
|
128
128
|
|
|
129
129
|
void SVFIRBuilder::handleExtCall(const CallBase* cs, const SVFFunction* svfCallee)
|
|
130
130
|
{
|
|
131
|
-
const
|
|
131
|
+
const SVFLLVMValue* svfInst = LLVMModuleSet::getLLVMModuleSet()->getSVFInstruction(cs);
|
|
132
132
|
const CallICFGNode *callICFGNode = llvmModuleSet()->getCallICFGNode(cs);
|
|
133
133
|
|
|
134
134
|
if (isHeapAllocExtCallViaRet(callICFGNode))
|
|
@@ -50,11 +50,6 @@ void SVFFunction::setExitBlock(SVFBasicBlock *bb)
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
SVFInstruction::SVFInstruction(const SVFType* ty, const SVFBasicBlock* b,
|
|
54
|
-
bool tm, bool isRet, SVFValKind k)
|
|
55
|
-
: SVFLLVMValue(ty, k), bb(b), terminator(tm), ret(isRet)
|
|
56
|
-
{
|
|
57
|
-
}
|
|
58
53
|
|
|
59
54
|
__attribute__((weak))
|
|
60
55
|
std::string SVFLLVMValue::toString() const
|