svf-tools 1.0.378 → 1.0.382
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 +3 -3
- 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/ConsGEdge_8h_source.html +2 -2
- package/SVF-doxygen/html/html/ConsG_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/ConsG_8h_source.html +3 -3
- package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/DDAVFSolver_8h_source.html +6 -6
- package/SVF-doxygen/html/html/FlowDDA_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/FlowSensitiveStat_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/FlowSensitiveTBHC_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/IRAnnotator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/IRGraph_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/IRGraph_8h_source.html +2 -2
- package/SVF-doxygen/html/html/LocationSet_8cpp_source.html +8 -8
- package/SVF-doxygen/html/html/LocationSet_8h.html +0 -2
- package/SVF-doxygen/html/html/LocationSet_8h_source.html +28 -21
- package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +6 -6
- package/SVF-doxygen/html/html/PAGBuilderFromFile_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/PTAStat_8cpp_source.html +15 -15
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +6 -6
- package/SVF-doxygen/html/html/PointerAnalysis_8h_source.html +6 -6
- package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +4 -5
- package/SVF-doxygen/html/html/SVFIRBuilder_8h_source.html +59 -58
- package/SVF-doxygen/html/html/SVFIR_8cpp_source.html +8 -8
- package/SVF-doxygen/html/html/SVFIR_8h_source.html +8 -8
- package/SVF-doxygen/html/html/SVFModule_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFStatements_8cpp_source.html +27 -27
- package/SVF-doxygen/html/html/SVFStatements_8h_source.html +6 -6
- package/SVF-doxygen/html/html/SVFVariables_8h_source.html +8 -8
- package/SVF-doxygen/html/html/SaberSVFGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +23 -23
- package/SVF-doxygen/html/html/SymbolTableBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableInfo_8cpp_source.html +80 -84
- package/SVF-doxygen/html/html/SymbolTableInfo_8h_source.html +79 -77
- package/SVF-doxygen/html/html/ThreadCallGraph_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8cpp_source.html +5 -5
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8h_source.html +2 -2
- package/SVF-doxygen/html/html/VFGNode_8h_source.html +1 -1
- package/SVF-doxygen/html/html/VersionedFlowSensitiveStat_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/annotated.html +192 -193
- package/SVF-doxygen/html/html/classSVF_1_1AddrStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AddrStmt.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1AddrVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AndersenBase.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1AssignStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AssignStmt.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1BinaryOPStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1BinaryOPStmt.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1BranchStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1BranchStmt.html +17 -17
- package/SVF-doxygen/html/html/classSVF_1_1BranchVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CHGBuilder.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CallPE-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CallPE.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1CmpStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CmpStmt.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintGraph.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1CopyStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CopyStmt.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1CopyVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1DDAVFSolver.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveTBHC.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1GepStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1GepStmt.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1GepVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1GepValVar.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1IRGraph.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1LoadStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1LoadStmt.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1LoadVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1LocationSet.html +54 -54
- package/SVF-doxygen/html/html/classSVF_1_1MRGenerator.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1MemObj.html +87 -87
- package/SVF-doxygen/html/html/classSVF_1_1MultiOpndStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1MultiOpndStmt.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1NormalGepCGEdge.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ObjTypeInfo.html +88 -92
- package/SVF-doxygen/html/html/classSVF_1_1ObjVar.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PAGBuilderFromFile.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1PTAStat.html +16 -16
- package/SVF-doxygen/html/html/classSVF_1_1PhiStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PhiStmt.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1RetPE-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1RetPE.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR.html +22 -22
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder-members.html +61 -60
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +295 -243
- package/SVF-doxygen/html/html/classSVF_1_1SVFModule.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SVFStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SVFStmt.html +17 -11
- package/SVF-doxygen/html/html/classSVF_1_1SaberSVFGBuilder.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SelectStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SelectStmt.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1StInfo-members.html +24 -23
- package/SVF-doxygen/html/html/classSVF_1_1StInfo.html +99 -64
- package/SVF-doxygen/html/html/classSVF_1_1StmtVFGNode.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1StoreStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1StoreStmt.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1StoreVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +33 -33
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo-members.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo.html +126 -110
- package/SVF-doxygen/html/html/classSVF_1_1TDForkPE-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1TDForkPE.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1TDJoinPE-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1TDJoinPE.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1ThreadCallGraph.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1TypeBasedHeapCloning.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1UnaryOPStmt-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1UnaryOPStmt.html +13 -13
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/classes.html +97 -98
- package/SVF-doxygen/html/html/functions_f.html +12 -18
- package/SVF-doxygen/html/html/functions_func_f.html +0 -3
- package/SVF-doxygen/html/html/functions_func_g.html +23 -24
- package/SVF-doxygen/html/html/functions_func_s.html +1 -1
- package/SVF-doxygen/html/html/functions_g.html +24 -25
- package/SVF-doxygen/html/html/functions_l.html +5 -5
- package/SVF-doxygen/html/html/functions_n.html +6 -6
- package/SVF-doxygen/html/html/functions_o.html +3 -3
- package/SVF-doxygen/html/html/functions_p.html +9 -9
- package/SVF-doxygen/html/html/functions_r.html +3 -5
- package/SVF-doxygen/html/html/functions_s.html +4 -4
- package/SVF-doxygen/html/html/functions_t.html +3 -3
- package/SVF-doxygen/html/html/functions_v.html +3 -3
- package/SVF-doxygen/html/html/functions_vars_f.html +3 -6
- package/SVF-doxygen/html/html/functions_w.html +9 -5
- package/SVF-doxygen/html/html/hierarchy.html +332 -333
- package/SVF-doxygen/html/html/namespaceSVF.html +0 -2
- 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 +5 -5
- package/SVF-doxygen/html/html/search/all_14.js +3 -3
- package/SVF-doxygen/html/html/search/all_16.js +1 -1
- package/SVF-doxygen/html/html/search/all_17.js +1 -1
- package/SVF-doxygen/html/html/search/all_6.js +2 -4
- package/SVF-doxygen/html/html/search/all_7.js +6 -6
- package/SVF-doxygen/html/html/search/all_c.js +4 -4
- package/SVF-doxygen/html/html/search/all_d.js +2 -2
- package/SVF-doxygen/html/html/search/all_e.js +3 -3
- package/SVF-doxygen/html/html/search/all_f.js +1 -1
- package/SVF-doxygen/html/html/search/classes_5.js +0 -1
- package/SVF-doxygen/html/html/search/functions_10.js +2 -2
- package/SVF-doxygen/html/html/search/functions_5.js +0 -1
- package/SVF-doxygen/html/html/search/functions_6.js +6 -6
- package/SVF-doxygen/html/html/search/variables_14.js +1 -1
- package/SVF-doxygen/html/html/search/variables_6.js +2 -3
- package/SVF-doxygen/html/html/search/variables_d.js +2 -2
- package/SVF-doxygen/html/html/search/variables_e.js +1 -1
- package/SVF-doxygen/html/html/structstd_1_1hash_3_01SVF_1_1LocationSet_01_4.html +4 -4
- package/include/MemoryModel/LocationSet.h +0 -24
- package/include/MemoryModel/SVFIR.h +1 -1
- package/include/MemoryModel/SVFStatements.h +1 -1
- package/include/MemoryModel/SVFVariables.h +1 -1
- package/include/MemoryModel/SymbolTableInfo.h +17 -10
- package/include/SVF-FE/SVFIRBuilder.h +8 -4
- package/lib/Graphs/IRGraph.cpp +3 -3
- package/lib/MemoryModel/SVFStatements.cpp +7 -5
- package/lib/MemoryModel/SymbolTableInfo.cpp +56 -57
- package/lib/SVF-FE/SVFIRBuilder.cpp +52 -57
- package/lib/SVF-FE/SymbolTableBuilder.cpp +3 -3
- package/package.json +1 -1
|
@@ -214,38 +214,12 @@ void SVFIRBuilder::initialiseNodes()
|
|
|
214
214
|
Handling single value types, for constant index, including pointer, integer, etc
|
|
215
215
|
e.g. field_idx = getelementptr i8, %i8* %p, i64 -4
|
|
216
216
|
We can obtain the field index by inferring the byteoffset if %p is casted from a pointer to a struct
|
|
217
|
+
For another example, the following can be an array access.
|
|
218
|
+
e.g. field_idx = getelementptr i8, %struct_type %p, i64 1
|
|
219
|
+
|
|
217
220
|
*/
|
|
218
221
|
u32_t SVFIRBuilder::inferFieldIdxFromByteOffset(const llvm::GEPOperator* gepOp, DataLayout *dl, LocationSet& ls, s64_t idx){
|
|
219
|
-
|
|
220
|
-
llvm::BitCastOperator* castop1 = SVFUtil::dyn_cast<llvm::BitCastOperator>(srcptr);
|
|
221
|
-
Type* sttype = nullptr;
|
|
222
|
-
if(castop1 && castop1->getSrcTy()->isPointerTy() && castop1->getSrcTy()->getPointerElementType()->isStructTy()){
|
|
223
|
-
sttype = castop1->getSrcTy()->getPointerElementType();
|
|
224
|
-
}
|
|
225
|
-
else
|
|
226
|
-
{
|
|
227
|
-
for(auto user : srcptr->users()){
|
|
228
|
-
if(SVFUtil::isa<llvm::BitCastOperator>(user)){
|
|
229
|
-
llvm::BitCastOperator* castop2 = SVFUtil::dyn_cast<llvm::BitCastOperator>(user);
|
|
230
|
-
if(castop2 && castop2->getDestTy()->isPointerTy() && castop2->getDestTy()->getPointerElementType()->isStructTy()){
|
|
231
|
-
sttype = castop2->getDestTy()->getPointerElementType();
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
if(sttype){
|
|
238
|
-
// Case 1: Access a field of a struct (which is not ANSI-compliant)
|
|
239
|
-
// Case 2: A pointer-arithematic
|
|
240
|
-
// Since this is a field-index based memory model, for both cases, we set field-index to 0, but we set constant offset to byte offset
|
|
241
|
-
// We conside the whole array of object as one element for field-sensitive analysis, but byteoffset can be used for handling pointer arithematic
|
|
242
|
-
// (This handling is unsound since the program itself is not ANSI-compliant)
|
|
243
|
-
const llvm::StructLayout* stdl = dl->getStructLayout(SVFUtil::dyn_cast<StructType>(sttype));
|
|
244
|
-
return stdl->getElementContainingOffset(idx);
|
|
245
|
-
}else{
|
|
246
|
-
// Case 2: This operation is likely accessing an array through pointer p.
|
|
247
|
-
return 0;
|
|
248
|
-
}
|
|
222
|
+
return 0;
|
|
249
223
|
}
|
|
250
224
|
|
|
251
225
|
/*!
|
|
@@ -305,11 +279,11 @@ bool SVFIRBuilder::computeGepOffset(const User *V, LocationSet& ls)
|
|
|
305
279
|
if(!op)
|
|
306
280
|
return false;
|
|
307
281
|
// The actual index
|
|
308
|
-
s64_t idx = op->getSExtValue();
|
|
282
|
+
//s64_t idx = op->getSExtValue();
|
|
309
283
|
|
|
310
|
-
//
|
|
311
|
-
|
|
312
|
-
ls.setFldIdx(ls.accumulateConstantFieldIdx() +
|
|
284
|
+
// For pointer arithmetic we ignore the byte offset
|
|
285
|
+
// consider using inferFieldIdxFromByteOffset(geopOp,dataLayout,ls,idx)?
|
|
286
|
+
// ls.setFldIdx(ls.accumulateConstantFieldIdx() + inferFieldIdxFromByteOffset(geopOp,idx));
|
|
313
287
|
}
|
|
314
288
|
}
|
|
315
289
|
return true;
|
|
@@ -444,7 +418,7 @@ void SVFIRBuilder::processCE(const Value *val)
|
|
|
444
418
|
* FIXME:Here we only get the field that actually used in the program
|
|
445
419
|
* We ignore the initialization of global variable field that not used in the program
|
|
446
420
|
*/
|
|
447
|
-
NodeID SVFIRBuilder::getGlobalVarField(const GlobalVariable *gvar, u32_t offset)
|
|
421
|
+
NodeID SVFIRBuilder::getGlobalVarField(const GlobalVariable *gvar, u32_t offset, Type* tpy)
|
|
448
422
|
{
|
|
449
423
|
|
|
450
424
|
// if the global variable do not have any field needs to be initialized
|
|
@@ -456,10 +430,7 @@ NodeID SVFIRBuilder::getGlobalVarField(const GlobalVariable *gvar, u32_t offset)
|
|
|
456
430
|
/// then we need to create a gep node for this field
|
|
457
431
|
else
|
|
458
432
|
{
|
|
459
|
-
|
|
460
|
-
while (const PointerType *ptype = SVFUtil::dyn_cast<PointerType>(gvartype))
|
|
461
|
-
gvartype = ptype->getElementType();
|
|
462
|
-
return getGepValVar(gvar, LocationSet(offset), gvartype);
|
|
433
|
+
return getGepValVar(gvar, LocationSet(offset), tpy);
|
|
463
434
|
}
|
|
464
435
|
}
|
|
465
436
|
|
|
@@ -486,7 +457,7 @@ void SVFIRBuilder::InitialGlobal(const GlobalVariable *gvar, Constant *C,
|
|
|
486
457
|
NodeID src = getValueNode(C);
|
|
487
458
|
// get the field value if it is avaiable, otherwise we create a dummy field node.
|
|
488
459
|
setCurrentLocation(gvar, nullptr);
|
|
489
|
-
NodeID field = getGlobalVarField(gvar, offset);
|
|
460
|
+
NodeID field = getGlobalVarField(gvar, offset, C->getType()->getPointerTo());
|
|
490
461
|
|
|
491
462
|
if (SVFUtil::isa<GlobalVariable>(C) || SVFUtil::isa<Function>(C))
|
|
492
463
|
{
|
|
@@ -1010,25 +981,37 @@ void SVFIRBuilder::handleDirectCall(CallSite cs, const SVFFunction *F)
|
|
|
1010
981
|
}
|
|
1011
982
|
}
|
|
1012
983
|
|
|
984
|
+
const Value* SVFIRBuilder::getBaseValueForExtArg(const Value* V){
|
|
985
|
+
const Value * value = stripAllCasts(V);
|
|
986
|
+
assert(value && "null ptr?");
|
|
987
|
+
if(const GetElementPtrInst* gep = SVFUtil::dyn_cast<GetElementPtrInst>(value)){
|
|
988
|
+
s64_t totalidx = 0;
|
|
989
|
+
for (bridge_gep_iterator gi = bridge_gep_begin(gep), ge = bridge_gep_end(gep); gi != ge; ++gi){
|
|
990
|
+
if(const ConstantInt *op = SVFUtil::dyn_cast<ConstantInt>(gi.getOperand()))
|
|
991
|
+
totalidx += op->getSExtValue();
|
|
992
|
+
}
|
|
993
|
+
if(totalidx == 0 && !SVFUtil::isa<StructType>(value->getType()))
|
|
994
|
+
value = gep->getPointerOperand();
|
|
995
|
+
}
|
|
996
|
+
return value;
|
|
997
|
+
}
|
|
998
|
+
|
|
1013
999
|
/*!
|
|
1014
1000
|
* Find the base type and the max possible offset of an object pointed to by (V).
|
|
1015
1001
|
*/
|
|
1016
1002
|
const Type *SVFIRBuilder::getBaseTypeAndFlattenedFields(const Value *V, std::vector<LocationSet> &fields, const Value* szValue)
|
|
1017
1003
|
{
|
|
1018
1004
|
assert(V);
|
|
1019
|
-
const Value
|
|
1020
|
-
assert(value && "null ptr?");
|
|
1021
|
-
if(const GetElementPtrInst* gep = SVFUtil::dyn_cast<GetElementPtrInst>(value))
|
|
1022
|
-
value = gep->getPointerOperand();
|
|
1023
|
-
|
|
1005
|
+
const Value* value = getBaseValueForExtArg(V);
|
|
1024
1006
|
const Type *T = value->getType();
|
|
1025
1007
|
while (const PointerType *ptype = SVFUtil::dyn_cast<PointerType>(T))
|
|
1026
1008
|
T = ptype->getElementType();
|
|
1027
1009
|
|
|
1028
1010
|
u32_t numOfElems = SymbolTableInfo::SymbolInfo()->getNumOfFlattenElements(T);
|
|
1029
1011
|
/// use user-specified size for this copy operation if the size is a constaint int
|
|
1030
|
-
if(szValue && SVFUtil::isa<ConstantInt>(szValue))
|
|
1031
|
-
numOfElems = SVFUtil::cast<ConstantInt>(szValue)->getSExtValue();
|
|
1012
|
+
if(szValue && SVFUtil::isa<ConstantInt>(szValue)){
|
|
1013
|
+
numOfElems = (numOfElems > SVFUtil::cast<ConstantInt>(szValue)->getSExtValue()) ? SVFUtil::cast<ConstantInt>(szValue)->getSExtValue() : numOfElems;
|
|
1014
|
+
}
|
|
1032
1015
|
|
|
1033
1016
|
LLVMContext& context = LLVMModuleSet::getLLVMModuleSet()->getContext();
|
|
1034
1017
|
for(u32_t ei = 0; ei < numOfElems; ei++){
|
|
@@ -1077,8 +1060,10 @@ void SVFIRBuilder::addComplexConsForExt(Value *D, Value *S, const Value* szValue
|
|
|
1077
1060
|
//For each field (i), add (Ti = *S + i) and (*D + i = Ti).
|
|
1078
1061
|
for (u32_t index = 0; index < sz; index++)
|
|
1079
1062
|
{
|
|
1080
|
-
|
|
1081
|
-
|
|
1063
|
+
const Type* dElementType = SymbolTableInfo::SymbolInfo()->getFlatternedElemType(dtype, fields[index].accumulateConstantFieldIdx());
|
|
1064
|
+
const Type* sElementType = SymbolTableInfo::SymbolInfo()->getFlatternedElemType(stype, fields[index].accumulateConstantFieldIdx());
|
|
1065
|
+
NodeID dField = getGepValVar(D,fields[index],dElementType);
|
|
1066
|
+
NodeID sField = getGepValVar(S,fields[index],sElementType);
|
|
1082
1067
|
NodeID dummy = pag->addDummyValNode();
|
|
1083
1068
|
addLoadEdge(sField,dummy);
|
|
1084
1069
|
addStoreEdge(dummy,dField);
|
|
@@ -1183,10 +1168,18 @@ void SVFIRBuilder::handleExtCall(CallSite cs, const SVFFunction *callee)
|
|
|
1183
1168
|
}
|
|
1184
1169
|
case ExtAPI::EFT_L_A0__A0R_A1:
|
|
1185
1170
|
{
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1171
|
+
// this is for memset(void *str, int c, size_t n)
|
|
1172
|
+
// which copies the character c (an unsigned char) to the first n characters of the string pointed to, by the argument str
|
|
1173
|
+
std::vector<LocationSet> dstFields;
|
|
1174
|
+
const Type *dtype = getBaseTypeAndFlattenedFields(cs.getArgument(0), dstFields, cs.getArgument(2));
|
|
1175
|
+
u32_t sz = dstFields.size();
|
|
1176
|
+
//For each field (i), add store edge *(arg0 + i) = arg1
|
|
1177
|
+
for (u32_t index = 0; index < sz; index++)
|
|
1178
|
+
{
|
|
1179
|
+
const Type* dElementType = SymbolTableInfo::SymbolInfo()->getFlatternedElemType(dtype, dstFields[index].accumulateConstantFieldIdx());
|
|
1180
|
+
NodeID dField = getGepValVar(cs.getArgument(0), dstFields[index], dElementType);
|
|
1181
|
+
addStoreEdge(pag->getValueNode(cs.getArgument(1)),dField);
|
|
1182
|
+
}
|
|
1190
1183
|
if(SVFUtil::isa<PointerType>(inst->getType()))
|
|
1191
1184
|
addCopyEdge(getValueNode(cs.getArgument(0)), getValueNode(inst));
|
|
1192
1185
|
break;
|
|
@@ -1332,7 +1325,8 @@ void SVFIRBuilder::handleExtCall(CallSite cs, const SVFFunction *callee)
|
|
|
1332
1325
|
// Note that arg0 is aligned with "offset".
|
|
1333
1326
|
for (int i = offset + 1; i <= offset + 3; ++i)
|
|
1334
1327
|
{
|
|
1335
|
-
|
|
1328
|
+
const Type* elementType = SymbolTableInfo::SymbolInfo()->getFlatternedElemType(type, fields[i].accumulateConstantFieldIdx());
|
|
1329
|
+
NodeID vnD = getGepValVar(vArg3, fields[i], elementType);
|
|
1336
1330
|
NodeID vnS = getValueNode(vArg1);
|
|
1337
1331
|
if(vnD && vnS)
|
|
1338
1332
|
addStoreEdge(vnS,vnD);
|
|
@@ -1356,7 +1350,8 @@ void SVFIRBuilder::handleExtCall(CallSite cs, const SVFFunction *callee)
|
|
|
1356
1350
|
// Note that arg0 is aligned with "offset".
|
|
1357
1351
|
for (int i = offset + 1; i <= offset + 3; ++i)
|
|
1358
1352
|
{
|
|
1359
|
-
|
|
1353
|
+
const Type* elementType = SymbolTableInfo::SymbolInfo()->getFlatternedElemType(type, fields[i].accumulateConstantFieldIdx());
|
|
1354
|
+
NodeID vnS = getGepValVar(vArg, fields[i], elementType);
|
|
1360
1355
|
if(vnD && vnS)
|
|
1361
1356
|
addStoreEdge(vnS,vnD);
|
|
1362
1357
|
}
|
|
@@ -1540,7 +1535,7 @@ void SVFIRBuilder::sanityCheck()
|
|
|
1540
1535
|
* Add a temp field value node according to base value and offset
|
|
1541
1536
|
* this node is after the initial node method, it is out of scope of symInfo table
|
|
1542
1537
|
*/
|
|
1543
|
-
NodeID SVFIRBuilder::getGepValVar(const Value* val, const LocationSet& ls, const Type *
|
|
1538
|
+
NodeID SVFIRBuilder::getGepValVar(const Value* val, const LocationSet& ls, const Type *elementType)
|
|
1544
1539
|
{
|
|
1545
1540
|
NodeID base = pag->getBaseValVar(getValueNode(val));
|
|
1546
1541
|
NodeID gepval = pag->getGepValVar(curVal, base, ls);
|
|
@@ -1562,7 +1557,7 @@ NodeID SVFIRBuilder::getGepValVar(const Value* val, const LocationSet& ls, const
|
|
|
1562
1557
|
const Value* cval = getCurrentValue();
|
|
1563
1558
|
const BasicBlock* cbb = getCurrentBB();
|
|
1564
1559
|
setCurrentLocation(curVal, nullptr);
|
|
1565
|
-
NodeID gepNode= pag->addGepValNode(curVal, val,ls, NodeIDAllocator::get()->allocateValueId(),
|
|
1560
|
+
NodeID gepNode= pag->addGepValNode(curVal, val,ls, NodeIDAllocator::get()->allocateValueId(),elementType->getPointerTo());
|
|
1566
1561
|
addGepEdge(base, gepNode, ls, true);
|
|
1567
1562
|
setCurrentLocation(cval, cbb);
|
|
1568
1563
|
return gepNode;
|
|
@@ -531,11 +531,11 @@ void SymbolTableBuilder::analyzeObjType(ObjTypeInfo* typeinfo, const Value* val)
|
|
|
531
531
|
}
|
|
532
532
|
if (const StructType *ST= SVFUtil::dyn_cast<StructType>(elemTy))
|
|
533
533
|
{
|
|
534
|
-
const std::vector<
|
|
535
|
-
for(std::vector<
|
|
534
|
+
const std::vector<const Type*>& flattenFields = SymbolTableInfo::SymbolInfo()->getFlattenFieldTypes(ST);
|
|
535
|
+
for(std::vector<const Type*>::const_iterator it = flattenFields.begin(), eit = flattenFields.end();
|
|
536
536
|
it!=eit; ++it)
|
|
537
537
|
{
|
|
538
|
-
if((*it)
|
|
538
|
+
if((*it)->isPointerTy())
|
|
539
539
|
isPtrObj = true;
|
|
540
540
|
}
|
|
541
541
|
if(SVFUtil::isa<GlobalVariable>(val) && SVFUtil::cast<GlobalVariable>(val)->hasInitializer()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.382",
|
|
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": {
|