svf-tools 1.0.374 → 1.0.375
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/AndersenStat_8cpp_source.html +5 -6
- package/SVF-doxygen/html/html/Andersen_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/CHGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ConsG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ConsG_8h_source.html +6 -6
- package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/DDAClient_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/DDAClient_8h_source.html +1 -1
- package/SVF-doxygen/html/html/DDAPass_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/DDAVFSolver_8h_source.html +13 -13
- package/SVF-doxygen/html/html/FlowDDA_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/FlowSensitiveStat_8cpp_source.html +5 -5
- package/SVF-doxygen/html/html/FlowSensitiveTBHC_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/IRAnnotator_8h_source.html +3 -3
- package/SVF-doxygen/html/html/IRGraph_8cpp_source.html +5 -5
- package/SVF-doxygen/html/html/IRGraph_8h_source.html +1 -1
- package/SVF-doxygen/html/html/LeakChecker_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/LocationSet_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +8 -8
- package/SVF-doxygen/html/html/OfflineConsG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PTAStat_8cpp_source.html +15 -15
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +6 -6
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8h_source.html +2 -2
- package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +9 -9
- package/SVF-doxygen/html/html/PointerAnalysis_8h_source.html +13 -13
- package/SVF-doxygen/html/html/SVFG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/SVFIRBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFIR_8cpp_source.html +30 -28
- package/SVF-doxygen/html/html/SVFIR_8h_source.html +63 -65
- 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/SVFVariables_8cpp_source.html +18 -19
- package/SVF-doxygen/html/html/SVFVariables_8h_source.html +118 -121
- package/SVF-doxygen/html/html/SaberSVFGBuilder_8cpp_source.html +6 -6
- package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +20 -13
- package/SVF-doxygen/html/html/SymbolTableBuilder_8h_source.html +7 -4
- package/SVF-doxygen/html/html/SymbolTableInfo_8cpp_source.html +81 -43
- package/SVF-doxygen/html/html/SymbolTableInfo_8h_source.html +45 -47
- package/SVF-doxygen/html/html/ThreadCallGraph_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8cpp_source.html +12 -12
- package/SVF-doxygen/html/html/VFGNode_8h_source.html +2 -2
- package/SVF-doxygen/html/html/VFG_8cpp_source.html +7 -7
- package/SVF-doxygen/html/html/VFG_8h_source.html +2 -2
- package/SVF-doxygen/html/html/VersionedFlowSensitiveStat_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/VersionedFlowSensitive_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/WPAPass_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ActualParmVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ActualRetVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AliasDDAClient.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1Andersen.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1AndersenBase.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1AndersenStat.html +5 -6
- package/SVF-doxygen/html/html/classSVF_1_1ArgumentVFGNode.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +10 -10
- package/SVF-doxygen/html/html/classSVF_1_1BinaryOPVFGNode.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1BranchStmt.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1CHGBuilder.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CloneDummyObjVar-members.html +22 -25
- package/SVF-doxygen/html/html/classSVF_1_1CloneDummyObjVar.html +16 -25
- package/SVF-doxygen/html/html/classSVF_1_1CloneFIObjVar-members.html +22 -25
- package/SVF-doxygen/html/html/classSVF_1_1CloneFIObjVar.html +17 -26
- package/SVF-doxygen/html/html/classSVF_1_1CloneGepObjVar-members.html +23 -26
- package/SVF-doxygen/html/html/classSVF_1_1CloneGepObjVar.html +17 -26
- package/SVF-doxygen/html/html/classSVF_1_1CmpVFGNode.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1CondPTAImpl.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintGraph.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1DDAClient.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1DDAPass.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1DDAVFSolver.html +12 -12
- package/SVF-doxygen/html/html/classSVF_1_1DummyObjVar-members.html +22 -25
- package/SVF-doxygen/html/html/classSVF_1_1DummyObjVar.html +18 -27
- package/SVF-doxygen/html/html/classSVF_1_1DummyValVar-members.html +21 -24
- package/SVF-doxygen/html/html/classSVF_1_1DummyValVar.html +18 -27
- package/SVF-doxygen/html/html/classSVF_1_1FIObjVar-members.html +22 -25
- package/SVF-doxygen/html/html/classSVF_1_1FIObjVar.html +19 -28
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveStat.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveTBHC.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1FormalParmVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FormalRetVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FunptrDDAClient.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar-members.html +24 -27
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar.html +41 -50
- package/SVF-doxygen/html/html/classSVF_1_1GepValVar-members.html +22 -25
- package/SVF-doxygen/html/html/classSVF_1_1GepValVar.html +28 -37
- package/SVF-doxygen/html/html/classSVF_1_1IRGraph.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1InterPHIVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1IntraPHIVFGNode.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1LeakChecker.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1LocationSet.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1MRGenerator.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1MemObj.html +69 -69
- package/SVF-doxygen/html/html/classSVF_1_1NullPtrVFGNode.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ObjTypeInfo-members.html +7 -8
- package/SVF-doxygen/html/html/classSVF_1_1ObjTypeInfo.html +124 -174
- package/SVF-doxygen/html/html/classSVF_1_1ObjVar-members.html +22 -25
- package/SVF-doxygen/html/html/classSVF_1_1ObjVar.html +23 -32
- package/SVF-doxygen/html/html/classSVF_1_1OfflineConsG.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PAGBuilderFromFile.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1PHIVFGNode.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1PTAStat.html +16 -16
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +26 -26
- package/SVF-doxygen/html/html/classSVF_1_1RetPN-members.html +22 -25
- package/SVF-doxygen/html/html/classSVF_1_1RetPN.html +18 -27
- package/SVF-doxygen/html/html/classSVF_1_1SVFG.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR-members.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR.html +181 -187
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +33 -33
- package/SVF-doxygen/html/html/classSVF_1_1SVFModule.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SVFVar-members.html +23 -26
- package/SVF-doxygen/html/html/classSVF_1_1SVFVar.html +54 -151
- package/SVF-doxygen/html/html/classSVF_1_1SaberSVFGBuilder.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1StInfo.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder-members.html +10 -7
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +154 -35
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo.html +77 -73
- package/SVF-doxygen/html/html/classSVF_1_1ThreadCallGraph.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1TypeBasedHeapCloning.html +20 -20
- package/SVF-doxygen/html/html/classSVF_1_1UnaryOPVFGNode.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1VFG.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1ValVar-members.html +21 -24
- package/SVF-doxygen/html/html/classSVF_1_1ValVar.html +16 -25
- package/SVF-doxygen/html/html/classSVF_1_1VarArgPN-members.html +22 -25
- package/SVF-doxygen/html/html/classSVF_1_1VarArgPN.html +18 -27
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitive.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1WPAPass.html +1 -1
- package/SVF-doxygen/html/html/functions_a.html +6 -6
- package/SVF-doxygen/html/html/functions_c.html +1 -1
- package/SVF-doxygen/html/html/functions_func.html +6 -6
- package/SVF-doxygen/html/html/functions_func_c.html +1 -1
- package/SVF-doxygen/html/html/functions_func_g.html +6 -3
- package/SVF-doxygen/html/html/functions_func_i.html +11 -17
- package/SVF-doxygen/html/html/functions_func_o.html +4 -4
- package/SVF-doxygen/html/html/functions_func_r.html +5 -2
- package/SVF-doxygen/html/html/functions_g.html +7 -4
- package/SVF-doxygen/html/html/functions_i.html +12 -21
- package/SVF-doxygen/html/html/functions_l.html +3 -3
- package/SVF-doxygen/html/html/functions_o.html +17 -13
- package/SVF-doxygen/html/html/functions_p.html +7 -7
- package/SVF-doxygen/html/html/functions_r.html +10 -7
- package/SVF-doxygen/html/html/functions_rela.html +2 -1
- package/SVF-doxygen/html/html/functions_s.html +15 -12
- package/SVF-doxygen/html/html/functions_t.html +7 -5
- package/SVF-doxygen/html/html/functions_v.html +6 -6
- package/SVF-doxygen/html/html/functions_vars_i.html +3 -6
- package/SVF-doxygen/html/html/namespaceSVF.html +1 -1
- package/SVF-doxygen/html/html/search/all_1.js +4 -4
- package/SVF-doxygen/html/html/search/all_10.js +10 -10
- package/SVF-doxygen/html/html/search/all_12.js +1 -0
- package/SVF-doxygen/html/html/search/all_13.js +9 -9
- package/SVF-doxygen/html/html/search/all_14.js +5 -5
- package/SVF-doxygen/html/html/search/all_16.js +2 -2
- package/SVF-doxygen/html/html/search/all_3.js +1 -1
- package/SVF-doxygen/html/html/search/all_7.js +2 -1
- package/SVF-doxygen/html/html/search/all_9.js +2 -5
- package/SVF-doxygen/html/html/search/all_c.js +2 -2
- package/SVF-doxygen/html/html/search/all_d.js +2 -2
- package/SVF-doxygen/html/html/search/all_e.js +2 -2
- package/SVF-doxygen/html/html/search/all_f.js +1 -1
- package/SVF-doxygen/html/html/search/functions_0.js +4 -4
- package/SVF-doxygen/html/html/search/functions_2.js +1 -1
- package/SVF-doxygen/html/html/search/functions_6.js +2 -1
- package/SVF-doxygen/html/html/search/functions_8.js +1 -3
- package/SVF-doxygen/html/html/search/functions_d.js +1 -1
- package/SVF-doxygen/html/html/search/functions_e.js +1 -1
- package/SVF-doxygen/html/html/search/functions_f.js +1 -0
- package/SVF-doxygen/html/html/search/related_9.js +1 -1
- package/SVF-doxygen/html/html/search/variables_14.js +2 -2
- package/SVF-doxygen/html/html/search/variables_9.js +1 -2
- package/SVF-doxygen/html/html/search/variables_d.js +1 -1
- package/SVF-doxygen/html/html/search/variables_e.js +2 -2
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01ConstraintGraph_01_5_01_4.html +1 -1
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01IRGraph_01_5_01_4.html +3 -3
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01OfflineConsG_01_5_01_4.html +1 -1
- 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/MemoryModel/SVFIR.h +4 -36
- package/include/MemoryModel/SVFVariables.h +2 -13
- package/include/MemoryModel/SymbolTableInfo.h +6 -18
- package/include/SVF-FE/SymbolTableBuilder.h +8 -1
- package/lib/MemoryModel/SVFIR.cpp +50 -2
- package/lib/MemoryModel/SVFVariables.cpp +6 -13
- package/lib/MemoryModel/SymbolTableInfo.cpp +21 -48
- package/lib/SVF-FE/SVFIRBuilder.cpp +1 -1
- package/lib/SVF-FE/SymbolTableBuilder.cpp +60 -13
- package/lib/WPA/AndersenStat.cpp +1 -1
- package/package.json +1 -1
|
@@ -389,7 +389,7 @@ protected:
|
|
|
389
389
|
virtual void collectSimpleTypeInfo(const Type* T);
|
|
390
390
|
|
|
391
391
|
/// Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
|
|
392
|
-
ObjTypeInfo* createObjTypeInfo(const Type *type
|
|
392
|
+
ObjTypeInfo* createObjTypeInfo(const Type *type);
|
|
393
393
|
|
|
394
394
|
/// Every type T is mapped to StInfo
|
|
395
395
|
/// which contains size (fsize) , offset(foffset)
|
|
@@ -592,7 +592,7 @@ public:
|
|
|
592
592
|
*/
|
|
593
593
|
class ObjTypeInfo
|
|
594
594
|
{
|
|
595
|
-
|
|
595
|
+
friend class SymbolTableBuilder;
|
|
596
596
|
public:
|
|
597
597
|
typedef enum
|
|
598
598
|
{
|
|
@@ -619,30 +619,18 @@ private:
|
|
|
619
619
|
/// maximum number of field object can be created
|
|
620
620
|
/// minimum number is 0 (field insensitive analysis)
|
|
621
621
|
u32_t maxOffsetLimit;
|
|
622
|
+
|
|
623
|
+
void resetTypeForHeapStaticObj(const Type* type);
|
|
622
624
|
public:
|
|
623
625
|
|
|
624
626
|
/// Constructors
|
|
625
|
-
ObjTypeInfo(const
|
|
626
|
-
type(t), flags(0), maxOffsetLimit(max)
|
|
627
|
-
{
|
|
628
|
-
}
|
|
629
|
-
/// Constructor
|
|
630
|
-
ObjTypeInfo(u32_t max, const Type* t) : type(t), flags(0), maxOffsetLimit(max)
|
|
631
|
-
{
|
|
627
|
+
ObjTypeInfo(const Type* t, u32_t max);
|
|
632
628
|
|
|
633
|
-
}
|
|
634
629
|
/// Destructor
|
|
635
630
|
virtual ~ObjTypeInfo()
|
|
636
631
|
{
|
|
637
|
-
|
|
638
632
|
}
|
|
639
|
-
|
|
640
|
-
/// Analyse types of heap and static objects
|
|
641
|
-
void analyzeHeapObjType(const Type* type);
|
|
642
|
-
|
|
643
|
-
/// Analyse types of heap and static objects
|
|
644
|
-
void analyzeStaticObjType(const Type* type);
|
|
645
|
-
|
|
633
|
+
|
|
646
634
|
/// Get LLVM type
|
|
647
635
|
inline const Type* getType() const
|
|
648
636
|
{
|
|
@@ -79,7 +79,14 @@ public:
|
|
|
79
79
|
/// Initialize TypeInfo based on LLVM Value
|
|
80
80
|
void initTypeInfo(ObjTypeInfo* typeinfo, const Value* value);
|
|
81
81
|
/// Analyse types of all flattened fields of this object
|
|
82
|
-
void
|
|
82
|
+
void analyzeObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
83
|
+
/// Analyse types of heap and static objects
|
|
84
|
+
void analyzeHeapObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
85
|
+
/// Analyse types of heap and static objects
|
|
86
|
+
void analyzeStaticObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
87
|
+
/// Return the bitcast instruction which is val's only use site, otherwise return nullptr
|
|
88
|
+
const Value* getUniqueUseViaCastInst(const Value* val);
|
|
89
|
+
|
|
83
90
|
/// Return size of this object based on LLVM value
|
|
84
91
|
u32_t getObjSize(const Value* val);
|
|
85
92
|
};
|
|
@@ -537,6 +537,24 @@ NodeID SVFIR::getBaseValVar(NodeID nodeId)
|
|
|
537
537
|
return nodeId;
|
|
538
538
|
}
|
|
539
539
|
|
|
540
|
+
/*!
|
|
541
|
+
* It is used to create a dummy GepValVar during global initiailzation.
|
|
542
|
+
*/
|
|
543
|
+
NodeID SVFIR::getGepValVar(const Value* curInst, NodeID base, const LocationSet& ls) const
|
|
544
|
+
{
|
|
545
|
+
GepValueVarMap::const_iterator iter = GepValObjMap.find(curInst);
|
|
546
|
+
if(iter==GepValObjMap.end()){
|
|
547
|
+
return UINT_MAX;
|
|
548
|
+
}
|
|
549
|
+
else{
|
|
550
|
+
NodeLocationSetMap::const_iterator lit = iter->second.find(std::make_pair(base, ls));
|
|
551
|
+
if(lit==iter->second.end())
|
|
552
|
+
return UINT_MAX;
|
|
553
|
+
else
|
|
554
|
+
return lit->second;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
540
558
|
/*!
|
|
541
559
|
* Get a base SVFVar given a pointer
|
|
542
560
|
* Return the source node of its connected normal gep edge
|
|
@@ -669,7 +687,37 @@ void SVFIR::initialiseCandidatePointers()
|
|
|
669
687
|
candidatePointers.insert(nodeId);
|
|
670
688
|
}
|
|
671
689
|
}
|
|
672
|
-
|
|
690
|
+
/*!
|
|
691
|
+
* Return true if FIObjVar can point to any object
|
|
692
|
+
* Or a field GepObjVar can point to any object.
|
|
693
|
+
*/
|
|
694
|
+
bool SVFIR::isNonPointerObj(NodeID id) const
|
|
695
|
+
{
|
|
696
|
+
SVFVar* node = getGNode(id);
|
|
697
|
+
if (const FIObjVar* fiNode = SVFUtil::dyn_cast<FIObjVar>(node))
|
|
698
|
+
{
|
|
699
|
+
if(Options::FirstFieldEqBase)
|
|
700
|
+
return fiNode->getMemObj()->isNonPtrFieldObj(0);
|
|
701
|
+
else
|
|
702
|
+
return (fiNode->getMemObj()->hasPtrObj()==false);
|
|
703
|
+
}
|
|
704
|
+
else if (const GepObjVar* gepNode = SVFUtil::dyn_cast<GepObjVar>(node))
|
|
705
|
+
{
|
|
706
|
+
return (gepNode->getMemObj()->isNonPtrFieldObj(gepNode->getLocationSet()));
|
|
707
|
+
}
|
|
708
|
+
else if (const DummyObjVar* dummyNode = SVFUtil::dyn_cast<DummyObjVar>(node))
|
|
709
|
+
{
|
|
710
|
+
if(Options::FirstFieldEqBase)
|
|
711
|
+
return dummyNode->getMemObj()->isNonPtrFieldObj(0);
|
|
712
|
+
else
|
|
713
|
+
return (dummyNode->getMemObj()->hasPtrObj()==false);
|
|
714
|
+
}
|
|
715
|
+
else
|
|
716
|
+
{
|
|
717
|
+
assert(false && "expecting a object node");
|
|
718
|
+
abort();
|
|
719
|
+
}
|
|
720
|
+
}
|
|
673
721
|
/*
|
|
674
722
|
* If this is a dummy node or node does not have incoming edges we assume it is not a pointer here
|
|
675
723
|
*/
|
|
@@ -683,7 +731,7 @@ bool SVFIR::isValidPointer(NodeID nodeId) const
|
|
|
683
731
|
|
|
684
732
|
bool SVFIR::isValidTopLevelPtr(const SVFVar* node)
|
|
685
733
|
{
|
|
686
|
-
if (node
|
|
734
|
+
if (SVFUtil::isa<ValVar>(node))
|
|
687
735
|
{
|
|
688
736
|
if (isValidPointer(node->getId()) && node->hasValue())
|
|
689
737
|
{
|
|
@@ -40,36 +40,28 @@ using namespace SVFUtil;
|
|
|
40
40
|
SVFVar::SVFVar(const Value* val, NodeID i, PNODEK k) :
|
|
41
41
|
GenericPAGNodeTy(i,k), value(val)
|
|
42
42
|
{
|
|
43
|
-
|
|
44
43
|
assert( ValNode <= k && k <= CloneDummyObjNode && "new SVFIR node kind?");
|
|
45
|
-
|
|
46
44
|
switch (k)
|
|
47
45
|
{
|
|
48
46
|
case ValNode:
|
|
49
47
|
case GepValNode:
|
|
50
48
|
{
|
|
51
49
|
assert(val != nullptr && "value is nullptr for ValVar or GepValNode");
|
|
52
|
-
|
|
53
|
-
isATPointer = false;
|
|
50
|
+
isPtr = val->getType()->isPointerTy();
|
|
54
51
|
break;
|
|
55
52
|
}
|
|
56
|
-
|
|
57
53
|
case RetNode:
|
|
58
54
|
{
|
|
59
55
|
assert(val != nullptr && "value is nullptr for RetNode");
|
|
60
|
-
|
|
61
|
-
isATPointer = false;
|
|
56
|
+
isPtr = SVFUtil::cast<Function>(val)->getReturnType()->isPointerTy();
|
|
62
57
|
break;
|
|
63
58
|
}
|
|
64
|
-
|
|
65
59
|
case VarargNode:
|
|
66
60
|
case DummyValNode:
|
|
67
61
|
{
|
|
68
|
-
|
|
69
|
-
isATPointer = false;
|
|
62
|
+
isPtr = true;
|
|
70
63
|
break;
|
|
71
64
|
}
|
|
72
|
-
|
|
73
65
|
case ObjNode:
|
|
74
66
|
case GepObjNode:
|
|
75
67
|
case FIObjNode:
|
|
@@ -78,8 +70,9 @@ SVFVar::SVFVar(const Value* val, NodeID i, PNODEK k) :
|
|
|
78
70
|
case CloneFIObjNode:
|
|
79
71
|
case CloneDummyObjNode:
|
|
80
72
|
{
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
isPtr = true;
|
|
74
|
+
if(val)
|
|
75
|
+
isPtr = val->getType()->isPointerTy();
|
|
83
76
|
break;
|
|
84
77
|
}
|
|
85
78
|
}
|
|
@@ -44,6 +44,17 @@ SymbolTableInfo* SymbolTableInfo::symInfo = nullptr;
|
|
|
44
44
|
u32_t StInfo::maxFieldLimit = 0;
|
|
45
45
|
|
|
46
46
|
|
|
47
|
+
ObjTypeInfo::ObjTypeInfo(const Type* t, u32_t max) : type(t), flags(0), maxOffsetLimit(max)
|
|
48
|
+
{
|
|
49
|
+
assert(t && "no type information for this object?");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
void ObjTypeInfo::resetTypeForHeapStaticObj(const Type* t){
|
|
54
|
+
assert((isStaticObj() || isHeap()) && "can only reset the inferred type for heap and static objects!");
|
|
55
|
+
type = t;
|
|
56
|
+
}
|
|
57
|
+
|
|
47
58
|
/// Add field (index and offset) with its corresponding type
|
|
48
59
|
void StInfo::addFldWithType(u32_t fldIdx, const Type* type, u32_t elemIdx)
|
|
49
60
|
{
|
|
@@ -90,8 +101,11 @@ SymbolTableInfo::TypeToFieldInfoMap::iterator SymbolTableInfo::getStructInfoIter
|
|
|
90
101
|
*/
|
|
91
102
|
ObjTypeInfo* SymbolTableInfo::createObjTypeInfo(const Type* type)
|
|
92
103
|
{
|
|
93
|
-
ObjTypeInfo* typeInfo = new ObjTypeInfo(StInfo::getMaxFieldLimit()
|
|
94
|
-
|
|
104
|
+
ObjTypeInfo* typeInfo = new ObjTypeInfo(type, StInfo::getMaxFieldLimit());
|
|
105
|
+
if(type && type->isPointerTy()){
|
|
106
|
+
typeInfo->setFlag(ObjTypeInfo::HEAP_OBJ);
|
|
107
|
+
typeInfo->setFlag(ObjTypeInfo::HASPTR_OBJ);
|
|
108
|
+
}
|
|
95
109
|
return typeInfo;
|
|
96
110
|
}
|
|
97
111
|
|
|
@@ -360,7 +374,7 @@ MemObj* SymbolTableInfo::createBlkObj(SymID symId)
|
|
|
360
374
|
{
|
|
361
375
|
assert(isBlkObj(symId));
|
|
362
376
|
assert(objMap.find(symId)==objMap.end());
|
|
363
|
-
MemObj* obj = new MemObj(symId, createObjTypeInfo());
|
|
377
|
+
MemObj* obj = new MemObj(symId, createObjTypeInfo(IntegerType::get(LLVMModuleSet::getLLVMModuleSet()->getContext(), 32)));
|
|
364
378
|
objMap[symId] = obj;
|
|
365
379
|
return obj;
|
|
366
380
|
}
|
|
@@ -369,7 +383,7 @@ MemObj* SymbolTableInfo::createConstantObj(SymID symId)
|
|
|
369
383
|
{
|
|
370
384
|
assert(isConstantObj(symId));
|
|
371
385
|
assert(objMap.find(symId)==objMap.end());
|
|
372
|
-
MemObj* obj = new MemObj(symId, createObjTypeInfo());
|
|
386
|
+
MemObj* obj = new MemObj(symId, createObjTypeInfo(IntegerType::get(LLVMModuleSet::getLLVMModuleSet()->getContext(), 32)));
|
|
373
387
|
objMap[symId] = obj;
|
|
374
388
|
return obj;
|
|
375
389
|
}
|
|
@@ -595,36 +609,13 @@ u32_t SymbolTableInfo::getTypeSizeInBytes(const StructType *sty, u32_t field_idx
|
|
|
595
609
|
}
|
|
596
610
|
|
|
597
611
|
|
|
598
|
-
|
|
599
|
-
/*!
|
|
600
|
-
* Analyse types of heap and static objects
|
|
601
|
-
*/
|
|
602
|
-
void ObjTypeInfo::analyzeHeapObjType(const Type*)
|
|
603
|
-
{
|
|
604
|
-
// TODO: Heap and static objects are considered as pointers right now.
|
|
605
|
-
// Refine this function to get more details about heap and static objects.
|
|
606
|
-
setFlag(HEAP_OBJ);
|
|
607
|
-
setFlag(HASPTR_OBJ);
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
/*!
|
|
611
|
-
* Analyse types of heap and static objects
|
|
612
|
-
*/
|
|
613
|
-
void ObjTypeInfo::analyzeStaticObjType(const Type*)
|
|
614
|
-
{
|
|
615
|
-
// TODO: Heap and static objects are considered as pointers right now.
|
|
616
|
-
// Refine this function to get more details about heap and static objects.
|
|
617
|
-
setFlag(STATIC_OBJ);
|
|
618
|
-
setFlag(HASPTR_OBJ);
|
|
619
|
-
}
|
|
620
|
-
|
|
621
612
|
/*!
|
|
622
613
|
* Whether a location set is a pointer type or not
|
|
623
614
|
*/
|
|
624
615
|
bool ObjTypeInfo::isNonPtrFieldObj(const LocationSet& ls)
|
|
625
616
|
{
|
|
626
|
-
if (
|
|
627
|
-
return
|
|
617
|
+
if (hasPtrObj() == false)
|
|
618
|
+
return true;
|
|
628
619
|
|
|
629
620
|
const Type* ety = getType();
|
|
630
621
|
while (const ArrayType *AT= SVFUtil::dyn_cast<ArrayType>(ety))
|
|
@@ -653,28 +644,10 @@ bool ObjTypeInfo::isNonPtrFieldObj(const LocationSet& ls)
|
|
|
653
644
|
}
|
|
654
645
|
else
|
|
655
646
|
{
|
|
656
|
-
|
|
657
|
-
{
|
|
658
|
-
// TODO: Objects which cannot find proper field for a certain offset including
|
|
659
|
-
// arguments in main(), static objects allocated before main and heap
|
|
660
|
-
// objects. Right now they're considered to have infinite fields and we
|
|
661
|
-
// treat each field as pointers conservatively.
|
|
662
|
-
// Try to model static and heap objects more accurately in the future.
|
|
663
|
-
return false;
|
|
664
|
-
}
|
|
665
|
-
else
|
|
666
|
-
{
|
|
667
|
-
// TODO: Using new memory model (locMM) may create objects with spurious offset
|
|
668
|
-
// as we simply return new offset by mod operation without checking its
|
|
669
|
-
// correctness in LocSymTableInfo::getModulusOffset(). So the following
|
|
670
|
-
// assertion may fail. Try to refine the new memory model.
|
|
671
|
-
//assert(ls.getConstantFieldIdx() == 0 && "cannot get a field from a non-struct type");
|
|
672
|
-
return (hasPtrObj() == false);
|
|
673
|
-
}
|
|
647
|
+
return (hasPtrObj() == false);
|
|
674
648
|
}
|
|
675
649
|
}
|
|
676
650
|
|
|
677
|
-
|
|
678
651
|
/*!
|
|
679
652
|
* Set mem object to be field sensitive (up to maximum field limit)
|
|
680
653
|
*/
|
|
@@ -1111,7 +1111,7 @@ void SVFIRBuilder::handleExtCall(CallSite cs, const SVFFunction *callee)
|
|
|
1111
1111
|
{
|
|
1112
1112
|
NodeID vnArg = getValueNode(arg);
|
|
1113
1113
|
NodeID dummy = pag->addDummyValNode();
|
|
1114
|
-
NodeID obj = pag->addDummyObjNode();
|
|
1114
|
+
NodeID obj = pag->addDummyObjNode(arg->getType());
|
|
1115
1115
|
if (vnArg && dummy && obj)
|
|
1116
1116
|
{
|
|
1117
1117
|
addAddrEdge(obj, dummy);
|
|
@@ -486,7 +486,7 @@ ObjTypeInfo* SymbolTableBuilder::createObjTypeInfo(const Value *val)
|
|
|
486
486
|
if (refTy)
|
|
487
487
|
{
|
|
488
488
|
Type *objTy = refTy->getElementType();
|
|
489
|
-
ObjTypeInfo* typeInfo = new ObjTypeInfo(
|
|
489
|
+
ObjTypeInfo* typeInfo = new ObjTypeInfo(objTy, Options::MaxFieldLimit);
|
|
490
490
|
initTypeInfo(typeInfo,val);
|
|
491
491
|
return typeInfo;
|
|
492
492
|
}
|
|
@@ -496,7 +496,7 @@ ObjTypeInfo* SymbolTableBuilder::createObjTypeInfo(const Value *val)
|
|
|
496
496
|
writeWrnMsg(val->getName().str());
|
|
497
497
|
writeWrnMsg("(" + getSourceLoc(val) + ")");
|
|
498
498
|
if(symInfo->isConstantObjSym(val)){
|
|
499
|
-
ObjTypeInfo* typeInfo = new ObjTypeInfo(val
|
|
499
|
+
ObjTypeInfo* typeInfo = new ObjTypeInfo(val->getType(), 0);
|
|
500
500
|
initTypeInfo(typeInfo,val);
|
|
501
501
|
return typeInfo;
|
|
502
502
|
}
|
|
@@ -507,15 +507,14 @@ ObjTypeInfo* SymbolTableBuilder::createObjTypeInfo(const Value *val)
|
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
|
|
511
510
|
/*!
|
|
512
511
|
* Analyse types of all flattened fields of this object
|
|
513
512
|
*/
|
|
514
|
-
void SymbolTableBuilder::
|
|
513
|
+
void SymbolTableBuilder::analyzeObjType(ObjTypeInfo* typeinfo, const Value* val)
|
|
515
514
|
{
|
|
516
515
|
|
|
517
516
|
const PointerType * refty = SVFUtil::dyn_cast<PointerType>(val->getType());
|
|
518
|
-
assert(
|
|
517
|
+
assert(refty && "this value should be a pointer type!");
|
|
519
518
|
Type* elemTy = refty->getElementType();
|
|
520
519
|
bool isPtrObj = false;
|
|
521
520
|
// Find the inter nested array element
|
|
@@ -526,9 +525,7 @@ void SymbolTableBuilder::analyzeGlobalStackObjType(ObjTypeInfo* typeinfo, const
|
|
|
526
525
|
isPtrObj = true;
|
|
527
526
|
if(SVFUtil::isa<GlobalVariable>(val) && SVFUtil::cast<GlobalVariable>(val)->hasInitializer()
|
|
528
527
|
&& SVFUtil::isa<ConstantArray>(SVFUtil::cast<GlobalVariable>(val)->getInitializer()))
|
|
529
|
-
{
|
|
530
528
|
typeinfo->setFlag(ObjTypeInfo::CONST_ARRAY_OBJ);
|
|
531
|
-
}
|
|
532
529
|
else
|
|
533
530
|
typeinfo->setFlag(ObjTypeInfo::VAR_ARRAY_OBJ);
|
|
534
531
|
}
|
|
@@ -556,6 +553,56 @@ void SymbolTableBuilder::analyzeGlobalStackObjType(ObjTypeInfo* typeinfo, const
|
|
|
556
553
|
typeinfo->setFlag(ObjTypeInfo::HASPTR_OBJ);
|
|
557
554
|
}
|
|
558
555
|
|
|
556
|
+
/*!
|
|
557
|
+
* Analyse types of heap and static objects
|
|
558
|
+
*/
|
|
559
|
+
void SymbolTableBuilder::analyzeHeapObjType(ObjTypeInfo* typeinfo, const Value* val)
|
|
560
|
+
{
|
|
561
|
+
if(const Value* castUse = getUniqueUseViaCastInst(val)){
|
|
562
|
+
typeinfo->setFlag(ObjTypeInfo::HEAP_OBJ);
|
|
563
|
+
typeinfo->resetTypeForHeapStaticObj(castUse->getType());
|
|
564
|
+
analyzeObjType(typeinfo,castUse);
|
|
565
|
+
}
|
|
566
|
+
else{
|
|
567
|
+
typeinfo->setFlag(ObjTypeInfo::HEAP_OBJ);
|
|
568
|
+
typeinfo->setFlag(ObjTypeInfo::HASPTR_OBJ);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/*!
|
|
573
|
+
* Analyse types of heap and static objects
|
|
574
|
+
*/
|
|
575
|
+
void SymbolTableBuilder::analyzeStaticObjType(ObjTypeInfo* typeinfo, const Value* val)
|
|
576
|
+
{
|
|
577
|
+
if(const Value* castUse = getUniqueUseViaCastInst(val)){
|
|
578
|
+
typeinfo->setFlag(ObjTypeInfo::STATIC_OBJ);
|
|
579
|
+
typeinfo->resetTypeForHeapStaticObj(castUse->getType());
|
|
580
|
+
analyzeObjType(typeinfo,castUse);
|
|
581
|
+
}
|
|
582
|
+
else{
|
|
583
|
+
typeinfo->setFlag(ObjTypeInfo::HEAP_OBJ);
|
|
584
|
+
typeinfo->setFlag(ObjTypeInfo::HASPTR_OBJ);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/*
|
|
589
|
+
* Get the first dominated cast instruction for heap allocations since they typically come from void* (i8*)
|
|
590
|
+
* for example, %4 = call align 16 i8* @malloc(i64 10); %5 = bitcast i8* %4 to i32*
|
|
591
|
+
* return %5 whose type is i32* but not %4 whose type is i8*
|
|
592
|
+
*/
|
|
593
|
+
const Value* SymbolTableBuilder::getUniqueUseViaCastInst(const Value* val){
|
|
594
|
+
const PointerType * type = SVFUtil::dyn_cast<PointerType>(val->getType());
|
|
595
|
+
assert(type && "this value should be a pointer type!");
|
|
596
|
+
/// If type is void* (i8*) and val is only used at a bitcast instruction
|
|
597
|
+
if (IntegerType *IT = SVFUtil::dyn_cast<IntegerType>(type->getPointerElementType())){
|
|
598
|
+
if (IT->getBitWidth() == 8 && val->getNumUses()==1){
|
|
599
|
+
const Use *u = &*val->use_begin();
|
|
600
|
+
return SVFUtil::dyn_cast<BitCastInst>(u->getUser());
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return nullptr;
|
|
604
|
+
}
|
|
605
|
+
|
|
559
606
|
/*!
|
|
560
607
|
* Initialize the type info of an object
|
|
561
608
|
*/
|
|
@@ -566,13 +613,13 @@ void SymbolTableBuilder::initTypeInfo(ObjTypeInfo* typeinfo, const Value* val){
|
|
|
566
613
|
if (SVFUtil::isa<Function>(val))
|
|
567
614
|
{
|
|
568
615
|
typeinfo->setFlag(ObjTypeInfo::FUNCTION_OBJ);
|
|
569
|
-
|
|
616
|
+
analyzeObjType(typeinfo,val);
|
|
570
617
|
objSize = getObjSize(val);
|
|
571
618
|
}
|
|
572
619
|
else if(SVFUtil::isa<AllocaInst>(val))
|
|
573
620
|
{
|
|
574
621
|
typeinfo->setFlag(ObjTypeInfo::STACK_OBJ);
|
|
575
|
-
|
|
622
|
+
analyzeObjType(typeinfo,val);
|
|
576
623
|
objSize = getObjSize(val);
|
|
577
624
|
}
|
|
578
625
|
else if(SVFUtil::isa<GlobalVariable>(val))
|
|
@@ -580,24 +627,24 @@ void SymbolTableBuilder::initTypeInfo(ObjTypeInfo* typeinfo, const Value* val){
|
|
|
580
627
|
typeinfo->setFlag(ObjTypeInfo::GLOBVAR_OBJ);
|
|
581
628
|
if(SymbolTableInfo::SymbolInfo()->isConstantObjSym(val))
|
|
582
629
|
typeinfo->setFlag(ObjTypeInfo::CONST_GLOBAL_OBJ);
|
|
583
|
-
|
|
630
|
+
analyzeObjType(typeinfo,val);
|
|
584
631
|
objSize = getObjSize(val);
|
|
585
632
|
}
|
|
586
633
|
else if (SVFUtil::isa<Instruction>(val) && isHeapAllocExtCall(SVFUtil::cast<Instruction>(val)))
|
|
587
634
|
{
|
|
588
|
-
|
|
635
|
+
analyzeHeapObjType(typeinfo,val);
|
|
589
636
|
// Heap object, label its field as infinite here
|
|
590
637
|
objSize = -1;
|
|
591
638
|
}
|
|
592
639
|
else if (SVFUtil::isa<Instruction>(val) && isStaticExtCall(SVFUtil::cast<Instruction>(val)))
|
|
593
640
|
{
|
|
594
|
-
|
|
641
|
+
analyzeStaticObjType(typeinfo,val);
|
|
595
642
|
// static object allocated before main, label its field as infinite here
|
|
596
643
|
objSize = -1;
|
|
597
644
|
}
|
|
598
645
|
else if(ArgInProgEntryFunction(val))
|
|
599
646
|
{
|
|
600
|
-
|
|
647
|
+
analyzeStaticObjType(typeinfo,val);
|
|
601
648
|
// user input data, label its field as infinite here
|
|
602
649
|
objSize = -1;
|
|
603
650
|
}
|
package/lib/WPA/AndersenStat.cpp
CHANGED
|
@@ -226,7 +226,7 @@ void AndersenStat::statNullPtr()
|
|
|
226
226
|
{
|
|
227
227
|
NodeID pagNodeId = iter->first;
|
|
228
228
|
PAGNode* pagNode = iter->second;
|
|
229
|
-
if (pagNode
|
|
229
|
+
if (SVFUtil::isa<ValVar>(pagNode) == false)
|
|
230
230
|
continue;
|
|
231
231
|
SVFStmt::SVFStmtSetTy& inComingStore = pagNode->getIncomingEdges(SVFStmt::Store);
|
|
232
232
|
SVFStmt::SVFStmtSetTy& outGoingLoad = pagNode->getOutgoingEdges(SVFStmt::Load);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.375",
|
|
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": {
|