svf-tools 1.0.356 → 1.0.360
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/SVF-doxygen/html/html/AndersenSFR_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/Andersen_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/CHGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/CallGraphBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ConsG_8cpp_source.html +7 -7
- package/SVF-doxygen/html/html/ConsG_8h_source.html +2 -2
- package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/DDAVFSolver_8h_source.html +6 -6
- package/SVF-doxygen/html/html/FlowDDA_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/FlowSensitiveStat_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/FlowSensitiveTBHC_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/FlowSensitive_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/Graph2Json_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ICFGBuilder_8cpp_source.html +2 -4
- package/SVF-doxygen/html/html/ICFGBuilder_8h_source.html +7 -7
- package/SVF-doxygen/html/html/ICFGNode_8h_source.html +3 -3
- package/SVF-doxygen/html/html/ICFG_8cpp_source.html +17 -17
- package/SVF-doxygen/html/html/ICFG_8h_source.html +17 -18
- package/SVF-doxygen/html/html/IRGraph_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/IRGraph_8h_source.html +2 -2
- package/SVF-doxygen/html/html/LeakChecker_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/LocationSet_8cpp_source.html +12 -12
- package/SVF-doxygen/html/html/LocationSet_8h_source.html +1 -1
- package/SVF-doxygen/html/html/LockAnalysis_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/LockResultValidator_8h_source.html +2 -2
- package/SVF-doxygen/html/html/MHP_8h_source.html +2 -2
- package/SVF-doxygen/html/html/MTAResultValidator_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +10 -10
- package/SVF-doxygen/html/html/MemSSA_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/PAGBuilderFromFile_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/PCG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PCG_8h_source.html +3 -3
- package/SVF-doxygen/html/html/PTAStat_8cpp_source.html +15 -15
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +8 -8
- package/SVF-doxygen/html/html/PointerAnalysis_8h_source.html +5 -5
- package/SVF-doxygen/html/html/SVFGOPT_8h_source.html +3 -3
- package/SVF-doxygen/html/html/SVFG_8cpp_source.html +5 -5
- package/SVF-doxygen/html/html/SVFG_8h_source.html +5 -5
- package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +7 -7
- package/SVF-doxygen/html/html/SVFIRBuilder_8h_source.html +12 -12
- package/SVF-doxygen/html/html/SVFIR_8cpp_source.html +20 -20
- package/SVF-doxygen/html/html/SVFIR_8h_source.html +18 -18
- package/SVF-doxygen/html/html/SVFModule_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFStatements_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFStatements_8h_source.html +91 -89
- package/SVF-doxygen/html/html/SVFVariables_8h_source.html +5 -5
- package/SVF-doxygen/html/html/SaberSVFGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +22 -22
- package/SVF-doxygen/html/html/SymbolTableBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableInfo_8cpp_source.html +52 -50
- package/SVF-doxygen/html/html/SymbolTableInfo_8h_source.html +86 -83
- package/SVF-doxygen/html/html/TCT_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/TCT_8h_source.html +2 -2
- package/SVF-doxygen/html/html/ThreadCallGraph_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8h_source.html +1 -1
- package/SVF-doxygen/html/html/VFGNode_8h_source.html +7 -7
- package/SVF-doxygen/html/html/VFG_8cpp_source.html +17 -17
- package/SVF-doxygen/html/html/VFG_8h_source.html +16 -16
- package/SVF-doxygen/html/html/VersionedFlowSensitiveStat_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/WPAPass_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1Andersen.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1BinaryOPStmt.html +15 -15
- package/SVF-doxygen/html/html/classSVF_1_1BranchStmt.html +32 -32
- package/SVF-doxygen/html/html/classSVF_1_1BranchVFGNode.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1CHGBuilder.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CallGraphBuilder.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1CallICFGNode-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CallICFGNode.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1CallPE.html +15 -15
- package/SVF-doxygen/html/html/classSVF_1_1CmpStmt.html +16 -16
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintGraph.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1DDAVFSolver.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveTBHC.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1ForkJoinAnalysis.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1GepStmt-members.html +7 -5
- package/SVF-doxygen/html/html/classSVF_1_1GepStmt.html +80 -12
- package/SVF-doxygen/html/html/classSVF_1_1ICFG-members.html +22 -22
- package/SVF-doxygen/html/html/classSVF_1_1ICFG.html +234 -234
- package/SVF-doxygen/html/html/classSVF_1_1ICFGBuilder-members.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1ICFGBuilder.html +48 -51
- package/SVF-doxygen/html/html/classSVF_1_1ICFGPrinter-members.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1ICFGPrinter.html +18 -18
- package/SVF-doxygen/html/html/classSVF_1_1IRGraph.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1LeakChecker.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1LocationSet.html +27 -29
- package/SVF-doxygen/html/html/classSVF_1_1LockAnalysis.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1LockResultValidator.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1MHP.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1MRGenerator.html +16 -16
- package/SVF-doxygen/html/html/classSVF_1_1MTAResultValidator.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1MemObj.html +87 -87
- package/SVF-doxygen/html/html/classSVF_1_1MemSSA.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1MultiOpndStmt.html +25 -25
- package/SVF-doxygen/html/html/classSVF_1_1ObjTypeInfo.html +99 -99
- package/SVF-doxygen/html/html/classSVF_1_1ObjVar.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PAGBuilderFromFile.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1PCG-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PCG.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1PTAStat.html +16 -16
- package/SVF-doxygen/html/html/classSVF_1_1PhiStmt.html +15 -15
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1RetICFGNode-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1RetICFGNode.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1RetPE.html +15 -15
- package/SVF-doxygen/html/html/classSVF_1_1SVFG.html +13 -13
- package/SVF-doxygen/html/html/classSVF_1_1SVFGOPT.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR.html +33 -33
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +38 -38
- package/SVF-doxygen/html/html/classSVF_1_1SVFModule.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SaberSVFGBuilder.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1StInfo-members.html +20 -15
- package/SVF-doxygen/html/html/classSVF_1_1StInfo.html +239 -89
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +35 -35
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo-members.html +6 -4
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo.html +178 -130
- package/SVF-doxygen/html/html/classSVF_1_1TCT-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1TCT.html +12 -12
- package/SVF-doxygen/html/html/classSVF_1_1TDForkPE.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1TDJoinPE.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1ThreadCallGraph.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1ThreadCallGraphBuilder.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1TypeBasedHeapCloning.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1UnaryOPStmt.html +20 -20
- package/SVF-doxygen/html/html/classSVF_1_1VFG.html +31 -31
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1WPAPass.html +6 -6
- package/SVF-doxygen/html/html/functions_a.html +13 -13
- package/SVF-doxygen/html/html/functions_e.html +3 -0
- package/SVF-doxygen/html/html/functions_f.html +15 -20
- package/SVF-doxygen/html/html/functions_func.html +13 -13
- package/SVF-doxygen/html/html/functions_func_g.html +49 -47
- package/SVF-doxygen/html/html/functions_func_i.html +9 -8
- package/SVF-doxygen/html/html/functions_func_s.html +8 -5
- package/SVF-doxygen/html/html/functions_g.html +50 -48
- package/SVF-doxygen/html/html/functions_i.html +15 -14
- package/SVF-doxygen/html/html/functions_l.html +6 -6
- package/SVF-doxygen/html/html/functions_n.html +6 -0
- package/SVF-doxygen/html/html/functions_p.html +9 -9
- package/SVF-doxygen/html/html/functions_r.html +2 -4
- package/SVF-doxygen/html/html/functions_s.html +22 -19
- package/SVF-doxygen/html/html/functions_t.html +7 -7
- package/SVF-doxygen/html/html/functions_vars_e.html +3 -0
- package/SVF-doxygen/html/html/functions_vars_f.html +0 -3
- package/SVF-doxygen/html/html/functions_vars_n.html +6 -0
- package/SVF-doxygen/html/html/search/all_1.js +6 -6
- package/SVF-doxygen/html/html/search/all_10.js +6 -6
- package/SVF-doxygen/html/html/search/all_12.js +2 -2
- package/SVF-doxygen/html/html/search/all_13.js +9 -8
- package/SVF-doxygen/html/html/search/all_14.js +4 -4
- package/SVF-doxygen/html/html/search/all_15.js +1 -1
- package/SVF-doxygen/html/html/search/all_16.js +1 -1
- package/SVF-doxygen/html/html/search/all_5.js +1 -0
- package/SVF-doxygen/html/html/search/all_6.js +0 -1
- package/SVF-doxygen/html/html/search/all_7.js +19 -20
- package/SVF-doxygen/html/html/search/all_9.js +2 -2
- package/SVF-doxygen/html/html/search/all_c.js +2 -2
- package/SVF-doxygen/html/html/search/all_d.js +1 -1
- package/SVF-doxygen/html/html/search/all_e.js +4 -2
- package/SVF-doxygen/html/html/search/functions_0.js +6 -6
- package/SVF-doxygen/html/html/search/functions_10.js +1 -0
- package/SVF-doxygen/html/html/search/functions_6.js +19 -20
- package/SVF-doxygen/html/html/search/functions_8.js +1 -1
- package/SVF-doxygen/html/html/search/functions_e.js +1 -1
- package/SVF-doxygen/html/html/search/variables_14.js +2 -2
- package/SVF-doxygen/html/html/search/variables_15.js +1 -1
- package/SVF-doxygen/html/html/search/variables_5.js +1 -0
- package/SVF-doxygen/html/html/search/variables_6.js +0 -1
- package/SVF-doxygen/html/html/search/variables_d.js +1 -1
- package/SVF-doxygen/html/html/search/variables_e.js +3 -1
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01IRGraph_01_5_01_4.html +2 -2
- package/SVF-doxygen/html/html/svf-ex_8cpp.html +2 -2
- package/SVF-doxygen/html/html/svf-ex_8cpp_source.html +2 -2
- package/include/Graphs/ICFG.h +18 -18
- package/include/Graphs/ICFGNode.h +2 -2
- package/include/Graphs/SVFG.h +4 -4
- package/include/Graphs/SVFGOPT.h +2 -2
- package/include/Graphs/VFG.h +7 -7
- package/include/MTA/LockResultValidator.h +1 -1
- package/include/MTA/MHP.h +2 -2
- package/include/MTA/PCG.h +2 -2
- package/include/MTA/TCT.h +2 -2
- package/include/MemoryModel/SVFIR.h +2 -2
- package/include/MemoryModel/SVFStatements.h +11 -3
- package/include/MemoryModel/SymbolTableInfo.h +37 -41
- package/include/SVF-FE/ICFGBuilder.h +5 -5
- package/include/SVF-FE/SVFIRBuilder.h +1 -1
- package/lib/Graphs/ICFG.cpp +23 -23
- package/lib/Graphs/SVFG.cpp +4 -4
- package/lib/Graphs/VFG.cpp +3 -3
- package/lib/MSSA/MemRegion.cpp +7 -7
- package/lib/MSSA/MemSSA.cpp +3 -3
- package/lib/MTA/LockAnalysis.cpp +4 -4
- package/lib/MTA/MTAResultValidator.cpp +1 -1
- package/lib/MTA/PCG.cpp +1 -1
- package/lib/MTA/TCT.cpp +2 -2
- package/lib/MemoryModel/LocationSet.cpp +42 -37
- package/lib/MemoryModel/PointerAnalysis.cpp +1 -1
- package/lib/MemoryModel/SymbolTableInfo.cpp +71 -8
- package/lib/SABER/LeakChecker.cpp +3 -3
- package/lib/SVF-FE/CallGraphBuilder.cpp +4 -4
- package/lib/SVF-FE/ICFGBuilder.cpp +19 -27
- package/lib/SVF-FE/SVFIRBuilder.cpp +15 -15
- package/lib/WPA/Andersen.cpp +3 -3
- package/lib/WPA/WPAPass.cpp +4 -4
- package/package.json +1 -1
- package/tools/Example/svf-ex.cpp +1 -1
|
@@ -96,7 +96,7 @@ CallStrCxt MTAResultValidator::getCxtArg(const Instruction* inst, unsigned int a
|
|
|
96
96
|
const SVFFunction* callee = SVFUtil::getFunction(y[1]);
|
|
97
97
|
CallSite cs = SVFUtil::getLLVMCallSite(csnumToInstMap[atoi(y[0].c_str())]);
|
|
98
98
|
assert(callee && "callee error");
|
|
99
|
-
CallICFGNode* cbn = mhp->getTCT()->
|
|
99
|
+
CallICFGNode* cbn = mhp->getTCT()->getCallICFGNode(cs.getInstruction());
|
|
100
100
|
CallSiteID csId = tcg->getCallSiteID(cbn, callee);
|
|
101
101
|
cxt.push_back(csId);
|
|
102
102
|
}
|
package/lib/MTA/PCG.cpp
CHANGED
|
@@ -206,7 +206,7 @@ void PCG::identifyFollowers()
|
|
|
206
206
|
// if this is an call/invoke instruction but not a spawn site
|
|
207
207
|
if ((SVFUtil::isa<CallInst>(inst) || SVFUtil::isa<InvokeInst>(inst)) && !isSpawnsite(inst))
|
|
208
208
|
{
|
|
209
|
-
CallICFGNode* cbn =
|
|
209
|
+
CallICFGNode* cbn = getCallICFGNode(inst);
|
|
210
210
|
if (callgraph->hasCallGraphEdge(cbn))
|
|
211
211
|
{
|
|
212
212
|
for (PTACallGraph::CallGraphEdgeSet::const_iterator cgIt = callgraph->getCallEdgeBegin(cbn),
|
package/lib/MTA/TCT.cpp
CHANGED
|
@@ -476,7 +476,7 @@ void TCT::pushCxt(CallStrCxt& cxt, const Instruction* call, const Function* call
|
|
|
476
476
|
const Function* caller = call->getParent()->getParent();
|
|
477
477
|
const SVFFunction* svfcaller = getSVFFun(caller);
|
|
478
478
|
const SVFFunction* svfcallee = getSVFFun(callee);
|
|
479
|
-
CallSiteID csId = tcg->getCallSiteID(
|
|
479
|
+
CallSiteID csId = tcg->getCallSiteID(getCallICFGNode(call), svfcallee);
|
|
480
480
|
|
|
481
481
|
/// handle calling context for candidate functions only
|
|
482
482
|
if(isCandidateFun(caller) == false)
|
|
@@ -498,7 +498,7 @@ bool TCT::matchCxt(CallStrCxt& cxt, const Instruction* call, const Function* cal
|
|
|
498
498
|
|
|
499
499
|
const Function* caller = call->getParent()->getParent();
|
|
500
500
|
const SVFFunction* svfcallee = getSVFFun(callee);
|
|
501
|
-
CallSiteID csId = tcg->getCallSiteID(
|
|
501
|
+
CallSiteID csId = tcg->getCallSiteID(getCallICFGNode(call), svfcallee);
|
|
502
502
|
|
|
503
503
|
/// handle calling context for candidate functions only
|
|
504
504
|
if(isCandidateFun(caller) == false)
|
|
@@ -56,71 +56,76 @@ bool LocationSet::isConstantOffset() const
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/// Return element number of a type
|
|
59
|
-
/// (1) StructType, return flatterned number elements
|
|
60
|
-
/// (2)
|
|
61
|
-
/// (3)
|
|
62
|
-
/// (4) non-pointer SingleValueType, return 1
|
|
59
|
+
/// (1) StructType or Array, return flatterned number elements.
|
|
60
|
+
/// (2) PointerType, return the element number of the pointee
|
|
61
|
+
/// (3) non-pointer SingleValueType, return 1
|
|
63
62
|
u32_t LocationSet::getElementNum(const Type* type) const{
|
|
64
|
-
|
|
65
|
-
if(
|
|
66
|
-
{
|
|
67
|
-
/// handle nested arrays
|
|
68
|
-
const Type* innerTy = aty;
|
|
69
|
-
while (const ArrayType* arr = SVFUtil::dyn_cast<ArrayType>(innerTy))
|
|
70
|
-
{
|
|
71
|
-
sz *= arr->getNumElements();
|
|
72
|
-
innerTy = arr->getElementType();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else if (const StructType *sty = SVFUtil::dyn_cast<StructType>(type) )
|
|
63
|
+
|
|
64
|
+
if(SVFUtil::isa<ArrayType>(type) || SVFUtil::isa<StructType>(type))
|
|
76
65
|
{
|
|
77
|
-
|
|
78
|
-
sz = so.back() + 1;
|
|
66
|
+
return SymbolTableInfo::SymbolInfo()->getNumOfFlattenElements(type);
|
|
79
67
|
}
|
|
80
68
|
else if (type->isSingleValueType())
|
|
81
69
|
{
|
|
82
70
|
/// This is a pointer arithmic
|
|
83
|
-
if(const PointerType* pty = SVFUtil::dyn_cast<PointerType>(type)
|
|
84
|
-
|
|
85
|
-
|
|
71
|
+
if(const PointerType* pty = SVFUtil::dyn_cast<PointerType>(type))
|
|
72
|
+
return getElementNum(pty->getElementType());
|
|
73
|
+
else
|
|
74
|
+
return 1;
|
|
86
75
|
}
|
|
87
76
|
else{
|
|
88
77
|
SVFUtil::outs() << "GepIter Type" << *type << "\n";
|
|
89
78
|
assert(false && "What other types for this gep?");
|
|
79
|
+
abort();
|
|
90
80
|
}
|
|
91
|
-
return sz;
|
|
92
81
|
}
|
|
93
82
|
|
|
94
83
|
/// Return accumulated constant offset
|
|
95
84
|
///
|
|
96
85
|
/// "value" is the offset variable (must be a constant)
|
|
97
86
|
/// "type" is the location where we want to compute offset
|
|
98
|
-
///
|
|
99
|
-
///
|
|
100
|
-
///
|
|
101
|
-
|
|
102
|
-
///
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
87
|
+
/// Given a vector: [(value1,type1), (value2,type2), (value3,type3)]
|
|
88
|
+
/// totalConstOffset = flattenOffset(value1,type1) * flattenOffset(type2,type2) + flattenOffset(type3,type3)
|
|
89
|
+
/// For a pointer type (e.g., t1 is PointerType), we will retrieve the pointee type and times the offset, i.e., getElementNum(t1) X off1
|
|
90
|
+
|
|
91
|
+
/// For example,
|
|
92
|
+
// struct inner{ int rollNumber; float percentage;};
|
|
93
|
+
// struct Student { struct inner rollNumber; char studentName[10][3];}
|
|
94
|
+
// char x = studentRecord[1].studentName[3][2];
|
|
95
|
+
|
|
96
|
+
/// %5 = getelementptr inbounds %struct.Student, %struct.Student* %4, i64 1
|
|
97
|
+
/// value1: i64 1 type1: %struct.Student*
|
|
98
|
+
/// accumulateConstantOffset = 32
|
|
99
|
+
/// %6 = getelementptr inbounds %struct.Student, %struct.Student* %5, i32 0, i32 1
|
|
100
|
+
/// value1: i32 0 type1: %struct.Student*
|
|
101
|
+
/// value2: i32 1 type2: %struct.Student = type { %struct.inner, [10 x [3 x i8]] }
|
|
102
|
+
/// accumulateConstantOffset = 2
|
|
103
|
+
/// %7 = getelementptr inbounds [10 x [3 x i8]], [10 x [3 x i8]]* %6, i64 0, i64 3
|
|
104
|
+
/// value1: i64 0 type1: [10 x [3 x i8]]*
|
|
105
|
+
/// value2: i64 3 type2: [10 x [3 x i8]]
|
|
106
|
+
/// accumulateConstantOffset = 9
|
|
107
|
+
/// %8 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 2
|
|
108
|
+
/// value1: i64 0 type1: [3 x i8]*
|
|
109
|
+
/// value2: i64 2 type2: [3 x i8]
|
|
110
|
+
/// accumulateConstantOffset = 2
|
|
106
111
|
s64_t LocationSet::accumulateConstantOffset() const{
|
|
107
112
|
|
|
108
113
|
assert(isConstantOffset() && "not a constant offset");
|
|
109
114
|
|
|
110
115
|
s64_t totalConstOffset = 0;
|
|
111
|
-
u32_t sz = 1;
|
|
112
116
|
for(int i = offsetValues.size() - 1; i >= 0; i--){
|
|
113
117
|
const Value* value = offsetValues[i].first;
|
|
114
118
|
const Type* type = offsetValues[i].second;
|
|
115
119
|
const ConstantInt *op = SVFUtil::dyn_cast<ConstantInt>(value);
|
|
116
120
|
assert(op && "not a constant offset?");
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
if(const PointerType* pty = SVFUtil::dyn_cast<PointerType>(type))
|
|
122
|
+
totalConstOffset += op->getSExtValue() * getElementNum(pty->getElementType());
|
|
123
|
+
else{
|
|
124
|
+
s64_t offset = op->getSExtValue();
|
|
125
|
+
const std::vector<u32_t>& so = SymbolTableInfo::SymbolInfo()->getFlattenedElemIdxVec(type);
|
|
126
|
+
assert((u32_t)offset <= so.size() && "out of bounds or offset is a negative value?");
|
|
127
|
+
totalConstOffset += so[op->getSExtValue()];
|
|
121
128
|
}
|
|
122
|
-
totalConstOffset += op->getSExtValue() * sz;
|
|
123
|
-
sz *= getElementNum(type);
|
|
124
129
|
}
|
|
125
130
|
return totalConstOffset;
|
|
126
131
|
}
|
|
@@ -515,7 +515,7 @@ void PointerAnalysis::connectVCallToVFns(const CallICFGNode* cs, const VFunSet &
|
|
|
515
515
|
{
|
|
516
516
|
newEdges[cs].insert(callee);
|
|
517
517
|
getIndCallMap()[cs].insert(callee);
|
|
518
|
-
const CallICFGNode* callBlockNode = pag->getICFG()->
|
|
518
|
+
const CallICFGNode* callBlockNode = pag->getICFG()->getCallICFGNode(cs->getCallSite());
|
|
519
519
|
ptaCallGraph->addIndirectCallGraphEdge(callBlockNode, cs->getCaller(),callee);
|
|
520
520
|
}
|
|
521
521
|
}
|
|
@@ -43,6 +43,48 @@ DataLayout* SymbolTableInfo::dl = nullptr;
|
|
|
43
43
|
SymbolTableInfo* SymbolTableInfo::symInfo = nullptr;
|
|
44
44
|
u32_t StInfo::maxFieldLimit = 0;
|
|
45
45
|
|
|
46
|
+
|
|
47
|
+
/// Add field (index and offset) with its corresponding type
|
|
48
|
+
void StInfo::addFldWithType(u32_t fldIdx, const Type* type, u32_t elemIdx)
|
|
49
|
+
{
|
|
50
|
+
fldIdxVec.push_back(fldIdx);
|
|
51
|
+
elemIdxVec.push_back(elemIdx);
|
|
52
|
+
fldIdx2TypeMap[fldIdx] = type;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/// struct A { int id; int salary; }; struct B { char name[20]; struct A a;} B b;
|
|
56
|
+
/// OriginalFieldType of b with field_idx 1 : Struct A
|
|
57
|
+
/// FlatternedFieldType of b with field_idx 1 : int
|
|
58
|
+
//{@
|
|
59
|
+
const Type* StInfo::getOriginalFieldType(u32_t fldIdx)
|
|
60
|
+
{
|
|
61
|
+
Map<u32_t, const Type*>::const_iterator it = fldIdx2TypeMap.find(fldIdx);
|
|
62
|
+
if(it!=fldIdx2TypeMap.end())
|
|
63
|
+
return it->second;
|
|
64
|
+
return nullptr;
|
|
65
|
+
}
|
|
66
|
+
const Type* StInfo::getFlatternedFieldType(u32_t fldIdx)
|
|
67
|
+
{
|
|
68
|
+
for(FlattenedFieldInfo& fallenedFld : finfo){
|
|
69
|
+
if(fallenedFld.getFlattenFldIdx() == fldIdx)
|
|
70
|
+
return fallenedFld.getFlattenElemTy();
|
|
71
|
+
}
|
|
72
|
+
return nullptr;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
SymbolTableInfo::TypeToFieldInfoMap::iterator SymbolTableInfo::getStructInfoIter(const Type *T)
|
|
76
|
+
{
|
|
77
|
+
assert(T);
|
|
78
|
+
TypeToFieldInfoMap::iterator it = typeToFieldInfo.find(T);
|
|
79
|
+
if (it != typeToFieldInfo.end())
|
|
80
|
+
return it;
|
|
81
|
+
else
|
|
82
|
+
{
|
|
83
|
+
collectTypeInfo(T);
|
|
84
|
+
return typeToFieldInfo.find(T);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
46
88
|
/*
|
|
47
89
|
* Initial the memory object here (for a dummy object)
|
|
48
90
|
*/
|
|
@@ -87,20 +129,17 @@ void SymbolTableInfo::collectTypeInfo(const Type* ty)
|
|
|
87
129
|
*/
|
|
88
130
|
void SymbolTableInfo::collectArrayInfo(const ArrayType* ty)
|
|
89
131
|
{
|
|
90
|
-
u64_t
|
|
132
|
+
u64_t totalElemNum = ty->getNumElements();
|
|
91
133
|
const Type* elemTy = ty->getElementType();
|
|
92
134
|
while (const ArrayType* aty = SVFUtil::dyn_cast<ArrayType>(elemTy))
|
|
93
135
|
{
|
|
94
|
-
|
|
136
|
+
totalElemNum *= aty->getNumElements();
|
|
95
137
|
elemTy = aty->getElementType();
|
|
96
138
|
}
|
|
97
139
|
|
|
98
|
-
StInfo* stinfo = new StInfo(
|
|
140
|
+
StInfo* stinfo = new StInfo(totalElemNum);
|
|
99
141
|
typeToFieldInfo[ty] = stinfo;
|
|
100
142
|
|
|
101
|
-
/// Array itself only has one field which is the inner most element
|
|
102
|
-
stinfo->addFldWithType(0, elemTy, 0);
|
|
103
|
-
|
|
104
143
|
/// Array's flatten field infor is the same as its element's
|
|
105
144
|
/// flatten infor.
|
|
106
145
|
StInfo* elemStInfo = getStructInfo(elemTy);
|
|
@@ -112,6 +151,14 @@ void SymbolTableInfo::collectArrayInfo(const ArrayType* ty)
|
|
|
112
151
|
FlattenedFieldInfo field(idx, fieldTy);
|
|
113
152
|
stinfo->getFlattenedFieldInfoVec().push_back(field);
|
|
114
153
|
}
|
|
154
|
+
|
|
155
|
+
/// Flatten arrays, map each array element index `i` to flattened index `(i * nfE * totalElemNum)/outArrayElemNum`
|
|
156
|
+
/// nfE>1 if the array element is a struct with more than one field.
|
|
157
|
+
u32_t outArrayElemNum = ty->getNumElements();
|
|
158
|
+
for(u32_t i = 0; i < outArrayElemNum; i++)
|
|
159
|
+
stinfo->addFldWithType(0, elemTy, (i * nfE * totalElemNum)/outArrayElemNum);
|
|
160
|
+
|
|
161
|
+
stinfo->setNumOfFieldsAndElems(nfE, nfE * totalElemNum);
|
|
115
162
|
}
|
|
116
163
|
|
|
117
164
|
|
|
@@ -160,6 +207,8 @@ void SymbolTableInfo::collectStructInfo(const StructType *sty)
|
|
|
160
207
|
}
|
|
161
208
|
}
|
|
162
209
|
|
|
210
|
+
stinfo->setNumOfFieldsAndElems(nf,strideOffset);
|
|
211
|
+
|
|
163
212
|
//Record the size of the complete struct and update max_struct.
|
|
164
213
|
if (nf > maxStSize)
|
|
165
214
|
{
|
|
@@ -182,6 +231,8 @@ void SymbolTableInfo::collectSimpleTypeInfo(const Type* ty)
|
|
|
182
231
|
|
|
183
232
|
FlattenedFieldInfo field(0, ty);
|
|
184
233
|
stinfo->getFlattenedFieldInfoVec().push_back(field);
|
|
234
|
+
|
|
235
|
+
stinfo->setNumOfFieldsAndElems(1,1);
|
|
185
236
|
}
|
|
186
237
|
|
|
187
238
|
|
|
@@ -322,10 +373,22 @@ const MemObj* SymbolTableInfo::createDummyObj(SymID symId, const Type* type)
|
|
|
322
373
|
return memObj;
|
|
323
374
|
}
|
|
324
375
|
|
|
376
|
+
/// Number of flattenned elements of an array or struct
|
|
377
|
+
const u32_t SymbolTableInfo::getNumOfFlattenElements(const Type *T)
|
|
378
|
+
{
|
|
379
|
+
return getStructInfoIter(T)->second->getNumOfFlattenElements();
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/// Number of flattenned fields of a struct
|
|
383
|
+
const u32_t SymbolTableInfo::getNumOfFlattenFields(const StructType *T)
|
|
384
|
+
{
|
|
385
|
+
return getStructInfoIter(T)->second->getNumOfFlattenFields();
|
|
386
|
+
}
|
|
387
|
+
|
|
325
388
|
/// Flatterned full offset information of a struct including its array fields
|
|
326
|
-
const std::vector<u32_t>& SymbolTableInfo::
|
|
389
|
+
const std::vector<u32_t>& SymbolTableInfo::getFlattenedElemIdxVec(const Type *T)
|
|
327
390
|
{
|
|
328
|
-
return getStructInfoIter(T)->second->
|
|
391
|
+
return getStructInfoIter(T)->second->getFlattenedElemIdxVec();
|
|
329
392
|
}
|
|
330
393
|
|
|
331
394
|
/// Flatterned field index information of a struct ignoring any array field
|
|
@@ -54,7 +54,7 @@ void LeakChecker::initSrcs()
|
|
|
54
54
|
continue;
|
|
55
55
|
|
|
56
56
|
PTACallGraph::FunctionSet callees;
|
|
57
|
-
getCallgraph()->getCallees(cs->
|
|
57
|
+
getCallgraph()->getCallees(cs->getCallICFGNode(),callees);
|
|
58
58
|
for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(), ecit = callees.end(); cit!=ecit; cit++)
|
|
59
59
|
{
|
|
60
60
|
const SVFFunction* fun = *cit;
|
|
@@ -62,11 +62,11 @@ void LeakChecker::initSrcs()
|
|
|
62
62
|
{
|
|
63
63
|
CSWorkList worklist;
|
|
64
64
|
SVFGNodeBS visited;
|
|
65
|
-
worklist.push(it->first->
|
|
65
|
+
worklist.push(it->first->getCallICFGNode());
|
|
66
66
|
while (!worklist.empty())
|
|
67
67
|
{
|
|
68
68
|
const CallICFGNode* cs = worklist.pop();
|
|
69
|
-
const RetICFGNode* retBlockNode = icfg->
|
|
69
|
+
const RetICFGNode* retBlockNode = icfg->getRetICFGNode(cs->getCallSite());
|
|
70
70
|
const PAGNode* pagNode = pag->getCallSiteRet(retBlockNode);
|
|
71
71
|
const SVFGNode* node = getSVFG()->getDefSVFGNode(pagNode);
|
|
72
72
|
if (visited.test(node->getId()) == 0)
|
|
@@ -55,7 +55,7 @@ PTACallGraph* CallGraphBuilder::buildCallGraph(SVFModule* svfModule)
|
|
|
55
55
|
{
|
|
56
56
|
if(const SVFFunction* callee = getCallee(inst))
|
|
57
57
|
{
|
|
58
|
-
const CallICFGNode* callBlockNode = icfg->
|
|
58
|
+
const CallICFGNode* callBlockNode = icfg->getCallICFGNode(inst);
|
|
59
59
|
const SVFFunction* caller = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
|
|
60
60
|
callgraph->addDirectCallGraphEdge(callBlockNode,caller,callee);
|
|
61
61
|
}
|
|
@@ -83,7 +83,7 @@ PTACallGraph* ThreadCallGraphBuilder::buildThreadCallGraph(SVFModule* svfModule)
|
|
|
83
83
|
const Instruction *inst = &*II;
|
|
84
84
|
if (tdAPI->isTDFork(inst))
|
|
85
85
|
{
|
|
86
|
-
const CallICFGNode* cs = icfg->
|
|
86
|
+
const CallICFGNode* cs = icfg->getCallICFGNode(inst);
|
|
87
87
|
cg->addForksite(cs);
|
|
88
88
|
const Function* forkee = SVFUtil::dyn_cast<Function>(tdAPI->getForkedFun(inst));
|
|
89
89
|
if (forkee)
|
|
@@ -98,7 +98,7 @@ PTACallGraph* ThreadCallGraphBuilder::buildThreadCallGraph(SVFModule* svfModule)
|
|
|
98
98
|
}
|
|
99
99
|
else if (tdAPI->isHareParFor(inst))
|
|
100
100
|
{
|
|
101
|
-
const CallICFGNode* cs = icfg->
|
|
101
|
+
const CallICFGNode* cs = icfg->getCallICFGNode(inst);
|
|
102
102
|
cg->addParForSite(cs);
|
|
103
103
|
const Function* taskFunc = SVFUtil::dyn_cast<Function>(tdAPI->getTaskFuncAtHareParForSite(inst));
|
|
104
104
|
if (taskFunc)
|
|
@@ -122,7 +122,7 @@ PTACallGraph* ThreadCallGraphBuilder::buildThreadCallGraph(SVFModule* svfModule)
|
|
|
122
122
|
const Instruction *inst = &*II;
|
|
123
123
|
if (tdAPI->isTDJoin(inst))
|
|
124
124
|
{
|
|
125
|
-
const CallICFGNode* cs = icfg->
|
|
125
|
+
const CallICFGNode* cs = icfg->getCallICFGNode(inst);
|
|
126
126
|
cg->addJoinsite(cs);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
@@ -58,7 +58,7 @@ void ICFGBuilder::build(SVFModule* svfModule)
|
|
|
58
58
|
*/
|
|
59
59
|
void ICFGBuilder::processFunEntry(const SVFFunction* fun, WorkList& worklist)
|
|
60
60
|
{
|
|
61
|
-
FunEntryICFGNode* FunEntryICFGNode = icfg->
|
|
61
|
+
FunEntryICFGNode* FunEntryICFGNode = icfg->getFunEntryICFGNode(fun);
|
|
62
62
|
const Instruction* entryInst = &((fun->getLLVMFun()->getEntryBlock()).front());
|
|
63
63
|
InstVec insts;
|
|
64
64
|
if (isIntrinsicInst(entryInst))
|
|
@@ -92,7 +92,7 @@ void ICFGBuilder::processFunBody(WorkList& worklist)
|
|
|
92
92
|
{
|
|
93
93
|
const Function* fun = inst->getFunction();
|
|
94
94
|
const SVFFunction* svfFun = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
|
|
95
|
-
FunExitICFGNode* FunExitICFGNode = icfg->
|
|
95
|
+
FunExitICFGNode* FunExitICFGNode = icfg->getFunExitICFGNode(svfFun);
|
|
96
96
|
icfg->addIntraEdge(srcNode, FunExitICFGNode);
|
|
97
97
|
}
|
|
98
98
|
InstVec nextInsts;
|
|
@@ -105,7 +105,7 @@ void ICFGBuilder::processFunBody(WorkList& worklist)
|
|
|
105
105
|
ICFGNode* dstNode = getOrAddBlockICFGNode(succ);
|
|
106
106
|
if (isNonInstricCallSite(inst))
|
|
107
107
|
{
|
|
108
|
-
RetICFGNode* retICFGNode =
|
|
108
|
+
RetICFGNode* retICFGNode = getRetICFGNode(inst);
|
|
109
109
|
srcNode = retICFGNode;
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -138,7 +138,7 @@ void ICFGBuilder::processFunBody(WorkList& worklist)
|
|
|
138
138
|
*/
|
|
139
139
|
void ICFGBuilder::processFunExit(const SVFFunction* fun)
|
|
140
140
|
{
|
|
141
|
-
FunExitICFGNode* FunExitICFGNode = icfg->
|
|
141
|
+
FunExitICFGNode* FunExitICFGNode = icfg->getFunExitICFGNode(fun);
|
|
142
142
|
|
|
143
143
|
for (inst_iterator II = inst_begin(fun->getLLVMFun()), EE = inst_end(fun->getLLVMFun()); II != EE; ++II)
|
|
144
144
|
{
|
|
@@ -161,7 +161,7 @@ InterICFGNode* ICFGBuilder::getOrAddInterBlockICFGNode(const Instruction* inst)
|
|
|
161
161
|
{
|
|
162
162
|
assert(SVFUtil::isCallSite(inst) && "not a call instruction?");
|
|
163
163
|
assert(SVFUtil::isNonInstricCallSite(inst) && "associating an intrinsic debug instruction with an ICFGNode!");
|
|
164
|
-
CallICFGNode* callICFGNode =
|
|
164
|
+
CallICFGNode* callICFGNode = getCallICFGNode(inst);
|
|
165
165
|
addICFGInterEdges(inst, getCallee(inst)); //creating interprocedural edges
|
|
166
166
|
return callICFGNode;
|
|
167
167
|
}
|
|
@@ -171,19 +171,23 @@ InterICFGNode* ICFGBuilder::getOrAddInterBlockICFGNode(const Instruction* inst)
|
|
|
171
171
|
*/
|
|
172
172
|
void ICFGBuilder::addICFGInterEdges(const Instruction* cs, const SVFFunction* callee)
|
|
173
173
|
{
|
|
174
|
-
CallICFGNode* CallICFGNode =
|
|
175
|
-
RetICFGNode* retBlockNode =
|
|
174
|
+
CallICFGNode* CallICFGNode = getCallICFGNode(cs);
|
|
175
|
+
RetICFGNode* retBlockNode = getRetICFGNode(cs);
|
|
176
176
|
|
|
177
177
|
/// direct call
|
|
178
178
|
if(callee){
|
|
179
|
-
FunEntryICFGNode* calleeEntryNode = icfg->getFunEntryBlockNode(callee);
|
|
180
|
-
FunExitICFGNode* calleeExitNode = icfg->getFunExitBlockNode(callee);
|
|
181
|
-
icfg->addCallEdge(CallICFGNode, calleeEntryNode, cs);
|
|
182
|
-
icfg->addRetEdge(calleeExitNode, retBlockNode, cs);
|
|
183
179
|
/// if this is an external function (no function body)
|
|
184
180
|
if (isExtCall(callee))
|
|
185
181
|
{
|
|
186
|
-
icfg->addIntraEdge(
|
|
182
|
+
icfg->addIntraEdge(CallICFGNode, retBlockNode);
|
|
183
|
+
}
|
|
184
|
+
/// otherwise connect interprocedural edges
|
|
185
|
+
else
|
|
186
|
+
{
|
|
187
|
+
FunEntryICFGNode* calleeEntryNode = icfg->getFunEntryICFGNode(callee);
|
|
188
|
+
FunExitICFGNode* calleeExitNode = icfg->getFunExitICFGNode(callee);
|
|
189
|
+
icfg->addCallEdge(CallICFGNode, calleeEntryNode, cs);
|
|
190
|
+
icfg->addRetEdge(calleeExitNode, retBlockNode, cs);
|
|
187
191
|
}
|
|
188
192
|
}
|
|
189
193
|
/// indirect call (don't know callee)
|
|
@@ -202,21 +206,9 @@ void ICFGBuilder::connectGlobalToProgEntry(SVFModule* svfModule)
|
|
|
202
206
|
if(mainFunc == nullptr)
|
|
203
207
|
return;
|
|
204
208
|
|
|
205
|
-
FunEntryICFGNode* entryNode = icfg->
|
|
206
|
-
GlobalICFGNode* globalNode = icfg->
|
|
207
|
-
|
|
208
|
-
std::vector<ICFGEdge*> toBeRemovedEdges;
|
|
209
|
-
for(ICFGEdge* edge : entryNode->getOutEdges())
|
|
210
|
-
toBeRemovedEdges.push_back(edge);
|
|
211
|
-
|
|
212
|
-
for(ICFGEdge* edge : toBeRemovedEdges){
|
|
213
|
-
assert(SVFUtil::isa<IntraCFGEdge>(edge) && "the outgoing edge of FunEntryICFGNode is not an intraCFGEdge?");
|
|
214
|
-
icfg->removeICFGEdge(edge);
|
|
215
|
-
IntraCFGEdge* intraEdge = new IntraCFGEdge(globalNode, edge->getDstNode());
|
|
216
|
-
icfg->addICFGEdge(intraEdge);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
IntraCFGEdge* intraEdge = new IntraCFGEdge(entryNode, globalNode);
|
|
209
|
+
FunEntryICFGNode* entryNode = icfg->getFunEntryICFGNode(mainFunc);
|
|
210
|
+
GlobalICFGNode* globalNode = icfg->getGlobalICFGNode();
|
|
211
|
+
IntraCFGEdge* intraEdge = new IntraCFGEdge(globalNode, entryNode);
|
|
220
212
|
icfg->addICFGEdge(intraEdge);
|
|
221
213
|
}
|
|
222
214
|
|
|
@@ -791,8 +791,8 @@ void SVFIRBuilder::visitCallSite(CallSite cs)
|
|
|
791
791
|
DBOUT(DPAGBuild,
|
|
792
792
|
outs() << "process callsite " << *cs.getInstruction() << "\n");
|
|
793
793
|
|
|
794
|
-
CallICFGNode* callBlockNode = pag->getICFG()->
|
|
795
|
-
RetICFGNode* retBlockNode = pag->getICFG()->
|
|
794
|
+
CallICFGNode* callBlockNode = pag->getICFG()->getCallICFGNode(cs.getInstruction());
|
|
795
|
+
RetICFGNode* retBlockNode = pag->getICFG()->getRetICFGNode(cs.getInstruction());
|
|
796
796
|
|
|
797
797
|
pag->addCallSite(callBlockNode);
|
|
798
798
|
|
|
@@ -893,7 +893,7 @@ void SVFIRBuilder::visitBranchInst(BranchInst &inst){
|
|
|
893
893
|
for (u32_t i = 0; i < inst.getNumSuccessors(); ++i)
|
|
894
894
|
{
|
|
895
895
|
const Instruction* succInst = &inst.getSuccessor(i)->front();
|
|
896
|
-
const ICFGNode* icfgNode = pag->getICFG()->
|
|
896
|
+
const ICFGNode* icfgNode = pag->getICFG()->getICFGNode(succInst);
|
|
897
897
|
successors.push_back(std::make_pair(icfgNode, 1-i));
|
|
898
898
|
}
|
|
899
899
|
const BranchStmt *brStmt = addBranchStmt(brinst, cond,successors);
|
|
@@ -910,7 +910,7 @@ void SVFIRBuilder::visitSwitchInst(SwitchInst &inst){
|
|
|
910
910
|
const ConstantInt* condVal = inst.findCaseDest(inst.getSuccessor(i));
|
|
911
911
|
/// default case is set to -1;
|
|
912
912
|
s64_t val = condVal ? condVal->getSExtValue() : -1;
|
|
913
|
-
const ICFGNode* icfgNode = pag->getICFG()->
|
|
913
|
+
const ICFGNode* icfgNode = pag->getICFG()->getICFGNode(succInst);
|
|
914
914
|
successors.push_back(std::make_pair(icfgNode,val));
|
|
915
915
|
}
|
|
916
916
|
const BranchStmt *brStmt = addBranchStmt(brinst, cond,successors);
|
|
@@ -960,7 +960,7 @@ void SVFIRBuilder::handleDirectCall(CallSite cs, const SVFFunction *F)
|
|
|
960
960
|
if (!cs.getType()->isVoidTy())
|
|
961
961
|
{
|
|
962
962
|
NodeID srcret = getReturnNode(F);
|
|
963
|
-
CallICFGNode* icfgNode = pag->getICFG()->
|
|
963
|
+
CallICFGNode* icfgNode = pag->getICFG()->getCallICFGNode(cs.getInstruction());
|
|
964
964
|
addRetEdge(srcret, dstrec,icfgNode);
|
|
965
965
|
}
|
|
966
966
|
//Iterators for the actual and formal parameters
|
|
@@ -982,7 +982,7 @@ void SVFIRBuilder::handleDirectCall(CallSite cs, const SVFFunction *F)
|
|
|
982
982
|
|
|
983
983
|
NodeID dstFA = getValueNode(FA);
|
|
984
984
|
NodeID srcAA = getValueNode(AA);
|
|
985
|
-
CallICFGNode* icfgNode = pag->getICFG()->
|
|
985
|
+
CallICFGNode* icfgNode = pag->getICFG()->getCallICFGNode(cs.getInstruction());
|
|
986
986
|
addCallEdge(srcAA, dstFA, icfgNode);
|
|
987
987
|
}
|
|
988
988
|
//Any remaining actual args must be varargs.
|
|
@@ -994,7 +994,7 @@ void SVFIRBuilder::handleDirectCall(CallSite cs, const SVFFunction *F)
|
|
|
994
994
|
{
|
|
995
995
|
Value *AA = *itA;
|
|
996
996
|
NodeID vnAA = getValueNode(AA);
|
|
997
|
-
CallICFGNode* icfgNode = pag->getICFG()->
|
|
997
|
+
CallICFGNode* icfgNode = pag->getICFG()->getCallICFGNode(cs.getInstruction());
|
|
998
998
|
addCallEdge(vnAA,vaF, icfgNode);
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
@@ -1477,7 +1477,7 @@ void SVFIRBuilder::handleExtCall(CallSite cs, const SVFFunction *callee)
|
|
|
1477
1477
|
/// Connect actual parameter to formal parameter of the start routine
|
|
1478
1478
|
if(SVFUtil::isa<PointerType>(actualParm->getType()) && SVFUtil::isa<PointerType>(formalParm->getType()) )
|
|
1479
1479
|
{
|
|
1480
|
-
CallICFGNode* icfgNode = pag->getICFG()->
|
|
1480
|
+
CallICFGNode* icfgNode = pag->getICFG()->getCallICFGNode(inst);
|
|
1481
1481
|
addThreadForkEdge(pag->getValueNode(actualParm), pag->getValueNode(formalParm),icfgNode);
|
|
1482
1482
|
}
|
|
1483
1483
|
}
|
|
@@ -1506,7 +1506,7 @@ void SVFIRBuilder::handleExtCall(CallSite cs, const SVFFunction *callee)
|
|
|
1506
1506
|
/// Connect actual parameter to formal parameter of the start routine
|
|
1507
1507
|
if(SVFUtil::isa<PointerType>(actualParm->getType()) && SVFUtil::isa<PointerType>(formalParm->getType()) )
|
|
1508
1508
|
{
|
|
1509
|
-
CallICFGNode* icfgNode = pag->getICFG()->
|
|
1509
|
+
CallICFGNode* icfgNode = pag->getICFG()->getCallICFGNode(inst);
|
|
1510
1510
|
addThreadForkEdge(pag->getValueNode(actualParm), pag->getValueNode(formalParm),icfgNode);
|
|
1511
1511
|
}
|
|
1512
1512
|
}
|
|
@@ -1528,7 +1528,7 @@ void SVFIRBuilder::handleExtCall(CallSite cs, const SVFFunction *callee)
|
|
|
1528
1528
|
*/
|
|
1529
1529
|
void SVFIRBuilder::handleIndCall(CallSite cs)
|
|
1530
1530
|
{
|
|
1531
|
-
const CallICFGNode* cbn = pag->getICFG()->
|
|
1531
|
+
const CallICFGNode* cbn = pag->getICFG()->getCallICFGNode(cs.getInstruction());
|
|
1532
1532
|
pag->addIndirectCallsites(cbn,pag->getValueNode(cs.getCalledValue()));
|
|
1533
1533
|
}
|
|
1534
1534
|
|
|
@@ -1618,7 +1618,7 @@ void SVFIRBuilder::setCurrentBBAndValueForPAGEdge(PAGEdge* edge)
|
|
|
1618
1618
|
edge->setValue(curVal);
|
|
1619
1619
|
// backmap in valuToEdgeMap
|
|
1620
1620
|
pag->mapValueToEdge(curVal, edge);
|
|
1621
|
-
ICFGNode* icfgNode = pag->getICFG()->
|
|
1621
|
+
ICFGNode* icfgNode = pag->getICFG()->getGlobalICFGNode();
|
|
1622
1622
|
if (const Instruction *curInst = SVFUtil::dyn_cast<Instruction>(curVal))
|
|
1623
1623
|
{
|
|
1624
1624
|
const Function* srcFun = edge->getSrcNode()->getFunction();
|
|
@@ -1637,23 +1637,23 @@ void SVFIRBuilder::setCurrentBBAndValueForPAGEdge(PAGEdge* edge)
|
|
|
1637
1637
|
/// We will have one unique function exit ICFGNode for all returns
|
|
1638
1638
|
if(const ReturnInst* retInst = SVFUtil::dyn_cast<ReturnInst>(curVal)){
|
|
1639
1639
|
const SVFFunction *fun = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(retInst->getParent()->getParent());
|
|
1640
|
-
icfgNode = pag->getICFG()->
|
|
1640
|
+
icfgNode = pag->getICFG()->getFunExitICFGNode(fun);
|
|
1641
1641
|
}
|
|
1642
1642
|
else
|
|
1643
|
-
icfgNode = pag->getICFG()->
|
|
1643
|
+
icfgNode = pag->getICFG()->getICFGNode(curInst);
|
|
1644
1644
|
}
|
|
1645
1645
|
else if (const Argument* arg = SVFUtil::dyn_cast<Argument>(curVal))
|
|
1646
1646
|
{
|
|
1647
1647
|
assert(curBB && (&curBB->getParent()->getEntryBlock() == curBB));
|
|
1648
1648
|
const SVFFunction* fun = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(arg->getParent());
|
|
1649
|
-
icfgNode = pag->getICFG()->
|
|
1649
|
+
icfgNode = pag->getICFG()->getFunEntryICFGNode(fun);
|
|
1650
1650
|
}
|
|
1651
1651
|
else if (SVFUtil::isa<ConstantExpr>(curVal))
|
|
1652
1652
|
{
|
|
1653
1653
|
if (!curBB)
|
|
1654
1654
|
pag->addGlobalPAGEdge(edge);
|
|
1655
1655
|
else
|
|
1656
|
-
icfgNode = pag->getICFG()->
|
|
1656
|
+
icfgNode = pag->getICFG()->getICFGNode(&curBB->front());
|
|
1657
1657
|
}
|
|
1658
1658
|
else if (SVFUtil::isa<GlobalVariable>(curVal) ||
|
|
1659
1659
|
SVFUtil::isa<Function>(curVal) ||
|
package/lib/WPA/Andersen.cpp
CHANGED
|
@@ -654,7 +654,7 @@ bool Andersen::updateCallGraph(const CallSiteToFunPtrMap& callsites)
|
|
|
654
654
|
void Andersen::heapAllocatorViaIndCall(CallSite cs, NodePairSet &cpySrcNodes)
|
|
655
655
|
{
|
|
656
656
|
assert(SVFUtil::getCallee(cs) == nullptr && "not an indirect callsite?");
|
|
657
|
-
RetICFGNode* retBlockNode = pag->getICFG()->
|
|
657
|
+
RetICFGNode* retBlockNode = pag->getICFG()->getRetICFGNode(cs.getInstruction());
|
|
658
658
|
const PAGNode* cs_return = pag->getCallSiteRet(retBlockNode);
|
|
659
659
|
NodeID srcret;
|
|
660
660
|
CallSite2DummyValPN::const_iterator it = callsite2DummyValPN.find(cs);
|
|
@@ -687,8 +687,8 @@ void Andersen::connectCaller2CalleeParams(CallSite cs, const SVFFunction* F, Nod
|
|
|
687
687
|
|
|
688
688
|
DBOUT(DAndersen, outs() << "connect parameters from indirect callsite " << *cs.getInstruction() << " to callee " << *F << "\n");
|
|
689
689
|
|
|
690
|
-
CallICFGNode* callBlockNode = pag->getICFG()->
|
|
691
|
-
RetICFGNode* retBlockNode = pag->getICFG()->
|
|
690
|
+
CallICFGNode* callBlockNode = pag->getICFG()->getCallICFGNode(cs.getInstruction());
|
|
691
|
+
RetICFGNode* retBlockNode = pag->getICFG()->getRetICFGNode(cs.getInstruction());
|
|
692
692
|
|
|
693
693
|
if(SVFUtil::isHeapAllocExtFunViaRet(F) && pag->callsiteHasRet(retBlockNode))
|
|
694
694
|
{
|
package/lib/WPA/WPAPass.cpp
CHANGED
|
@@ -239,7 +239,7 @@ ModRefInfo WPAPass::getModRefInfo(const CallInst* callInst)
|
|
|
239
239
|
{
|
|
240
240
|
assert(Options::PASelected.isSet(PointerAnalysis::AndersenWaveDiff_WPA) && Options::AnderSVFG && "mod-ref query is only support with -ander and -svfg turned on");
|
|
241
241
|
ICFG* icfg = _svfg->getPAG()->getICFG();
|
|
242
|
-
const CallICFGNode* cbn = icfg->
|
|
242
|
+
const CallICFGNode* cbn = icfg->getCallICFGNode(callInst);
|
|
243
243
|
return _svfg->getMSSA()->getMRGenerator()->getModRefInfo(cbn);
|
|
244
244
|
}
|
|
245
245
|
|
|
@@ -250,7 +250,7 @@ ModRefInfo WPAPass::getModRefInfo(const CallInst* callInst, const Value* V)
|
|
|
250
250
|
{
|
|
251
251
|
assert(Options::PASelected.isSet(PointerAnalysis::AndersenWaveDiff_WPA) && Options::AnderSVFG && "mod-ref query is only support with -ander and -svfg turned on");
|
|
252
252
|
ICFG* icfg = _svfg->getPAG()->getICFG();
|
|
253
|
-
const CallICFGNode* cbn = icfg->
|
|
253
|
+
const CallICFGNode* cbn = icfg->getCallICFGNode(callInst);
|
|
254
254
|
return _svfg->getMSSA()->getMRGenerator()->getModRefInfo(cbn, V);
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -261,7 +261,7 @@ ModRefInfo WPAPass::getModRefInfo(const CallInst* callInst1, const CallInst* cal
|
|
|
261
261
|
{
|
|
262
262
|
assert(Options::PASelected.isSet(PointerAnalysis::AndersenWaveDiff_WPA) && Options::AnderSVFG && "mod-ref query is only support with -ander and -svfg turned on");
|
|
263
263
|
ICFG* icfg = _svfg->getPAG()->getICFG();
|
|
264
|
-
const CallICFGNode* cbn1 = icfg->
|
|
265
|
-
const CallICFGNode* cbn2 = icfg->
|
|
264
|
+
const CallICFGNode* cbn1 = icfg->getCallICFGNode(callInst1);
|
|
265
|
+
const CallICFGNode* cbn2 = icfg->getCallICFGNode(callInst2);
|
|
266
266
|
return _svfg->getMSSA()->getMRGenerator()->getModRefInfo(cbn1, cbn2);
|
|
267
267
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.360",
|
|
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": {
|
package/tools/Example/svf-ex.cpp
CHANGED
|
@@ -79,7 +79,7 @@ std::string printPts(PointerAnalysis* pta, Value* val)
|
|
|
79
79
|
*/
|
|
80
80
|
void traverseOnICFG(ICFG* icfg, const Instruction* inst)
|
|
81
81
|
{
|
|
82
|
-
ICFGNode* iNode = icfg->
|
|
82
|
+
ICFGNode* iNode = icfg->getICFGNode(inst);
|
|
83
83
|
FIFOWorkList<const ICFGNode*> worklist;
|
|
84
84
|
Set<const ICFGNode*> visited;
|
|
85
85
|
worklist.push(iNode);
|