svf-tools 1.0.330 → 1.0.331
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 +4 -4
- package/SVF-doxygen/html/html/Andersen_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/CSC_8cpp_source.html +2 -3
- package/SVF-doxygen/html/html/ConsGEdge_8h_source.html +3 -3
- package/SVF-doxygen/html/html/ConsGNode_8h_source.html +5 -5
- package/SVF-doxygen/html/html/ConsG_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/ConsG_8h_source.html +4 -4
- package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +5 -5
- 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 +2 -2
- package/SVF-doxygen/html/html/IRAnnotator_8h_source.html +6 -7
- package/SVF-doxygen/html/html/IRGraph_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/IRGraph_8h_source.html +1 -1
- package/SVF-doxygen/html/html/LocationSet_8cpp.html +1 -0
- package/SVF-doxygen/html/html/LocationSet_8cpp_source.html +12 -15
- package/SVF-doxygen/html/html/LocationSet_8h.html +1 -1
- package/SVF-doxygen/html/html/LocationSet_8h_source.html +26 -40
- package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +5 -5
- package/SVF-doxygen/html/html/OfflineConsG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PAGBuilderFromFile_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/PTAStat_8cpp_source.html +14 -14
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +6 -6
- package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +5 -5
- package/SVF-doxygen/html/html/PointerAnalysis_8h_source.html +6 -6
- package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +6 -7
- package/SVF-doxygen/html/html/SVFIRBuilder_8h_source.html +32 -32
- package/SVF-doxygen/html/html/SVFIR_8cpp_source.html +12 -12
- package/SVF-doxygen/html/html/SVFIR_8h_source.html +12 -12
- package/SVF-doxygen/html/html/SVFStatements_8h_source.html +3 -3
- package/SVF-doxygen/html/html/SVFVariables_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/SVFVariables_8h.html +1 -1
- package/SVF-doxygen/html/html/SVFVariables_8h_source.html +69 -69
- package/SVF-doxygen/html/html/SaberSVFGBuilder_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +21 -21
- package/SVF-doxygen/html/html/SymbolTableBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableInfo_8cpp_source.html +52 -53
- package/SVF-doxygen/html/html/SymbolTableInfo_8h_source.html +72 -75
- package/SVF-doxygen/html/html/ThreadCallGraph_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8cpp_source.html +13 -13
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8h_source.html +2 -2
- package/SVF-doxygen/html/html/VersionedFlowSensitiveStat_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/annotated.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1AndersenBase.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1CSC.html +2 -3
- package/SVF-doxygen/html/html/classSVF_1_1CloneDummyObjVar.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1CloneFIObjVar.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1CloneGepObjVar-members.html +56 -55
- package/SVF-doxygen/html/html/classSVF_1_1CloneGepObjVar.html +44 -41
- package/SVF-doxygen/html/html/classSVF_1_1CloneGepObjVar.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintGraph.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode-members.html +26 -26
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode.html +43 -43
- 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_1DummyObjVar.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1DummyValVar.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1FIObjVar.html +13 -13
- package/SVF-doxygen/html/html/classSVF_1_1FlattenedFieldInfo-members.html +85 -0
- package/SVF-doxygen/html/html/classSVF_1_1FlattenedFieldInfo.html +254 -0
- 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 +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1GenericNode.html +22 -23
- package/SVF-doxygen/html/html/classSVF_1_1GenericNode.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar-members.html +173 -0
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar.html +813 -0
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1GepValVar.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1IRAnnotator-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1IRAnnotator.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1LocationSet-members.html +17 -21
- package/SVF-doxygen/html/html/classSVF_1_1LocationSet.html +150 -326
- package/SVF-doxygen/html/html/classSVF_1_1MRGenerator.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1MemObj.html +84 -84
- package/SVF-doxygen/html/html/classSVF_1_1NormalGepCGEdge.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1NormalGepStmt.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1ObjTypeInfo.html +96 -96
- package/SVF-doxygen/html/html/classSVF_1_1ObjVar.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1ObjVar.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1PAGBuilderFromFile.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1PTAStat.html +14 -14
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1RetPN.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR.html +26 -26
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +114 -115
- package/SVF-doxygen/html/html/classSVF_1_1SVFVar.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1SVFVar.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1SaberSVFGBuilder.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1StInfo-members.html +11 -14
- package/SVF-doxygen/html/html/classSVF_1_1StInfo.html +70 -168
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +30 -30
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo-members.html +59 -60
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo.html +118 -146
- package/SVF-doxygen/html/html/classSVF_1_1ThreadCallGraph.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1TypeBasedHeapCloning.html +18 -18
- package/SVF-doxygen/html/html/classSVF_1_1VarArgPN.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/classes.html +6 -6
- package/SVF-doxygen/html/html/functions_a.html +13 -10
- package/SVF-doxygen/html/html/functions_b.html +1 -5
- package/SVF-doxygen/html/html/functions_c.html +6 -8
- package/SVF-doxygen/html/html/functions_d.html +1 -1
- package/SVF-doxygen/html/html/functions_e.html +0 -16
- package/SVF-doxygen/html/html/functions_f.html +21 -19
- package/SVF-doxygen/html/html/functions_func.html +15 -12
- package/SVF-doxygen/html/html/functions_func_c.html +2 -2
- package/SVF-doxygen/html/html/functions_func_d.html +1 -1
- package/SVF-doxygen/html/html/functions_func_e.html +2 -8
- package/SVF-doxygen/html/html/functions_func_f.html +4 -4
- package/SVF-doxygen/html/html/functions_func_g.html +39 -60
- package/SVF-doxygen/html/html/functions_func_i.html +11 -14
- package/SVF-doxygen/html/html/functions_func_s.html +6 -9
- package/SVF-doxygen/html/html/functions_func_t.html +1 -1
- package/SVF-doxygen/html/html/functions_func_w.html +1 -1
- package/SVF-doxygen/html/html/functions_g.html +38 -59
- package/SVF-doxygen/html/html/functions_i.html +6 -9
- package/SVF-doxygen/html/html/functions_l.html +1 -1
- package/SVF-doxygen/html/html/functions_n.html +4 -7
- package/SVF-doxygen/html/html/functions_o.html +21 -16
- package/SVF-doxygen/html/html/functions_p.html +16 -14
- package/SVF-doxygen/html/html/functions_s.html +15 -18
- package/SVF-doxygen/html/html/functions_t.html +4 -4
- package/SVF-doxygen/html/html/functions_type_e.html +0 -4
- package/SVF-doxygen/html/html/functions_type_o.html +3 -0
- package/SVF-doxygen/html/html/functions_v.html +3 -3
- package/SVF-doxygen/html/html/functions_vars_b.html +1 -5
- package/SVF-doxygen/html/html/functions_vars_e.html +0 -6
- package/SVF-doxygen/html/html/functions_vars_f.html +9 -7
- package/SVF-doxygen/html/html/functions_vars_l.html +1 -1
- package/SVF-doxygen/html/html/functions_vars_n.html +0 -3
- package/SVF-doxygen/html/html/functions_vars_o.html +2 -2
- package/SVF-doxygen/html/html/functions_w.html +1 -1
- package/SVF-doxygen/html/html/hierarchy.html +64 -64
- package/SVF-doxygen/html/html/namespaceSVF.html +3 -3
- package/SVF-doxygen/html/html/search/all_1.js +3 -2
- package/SVF-doxygen/html/html/search/all_10.js +8 -8
- package/SVF-doxygen/html/html/search/all_12.js +1 -1
- package/SVF-doxygen/html/html/search/all_13.js +9 -10
- package/SVF-doxygen/html/html/search/all_14.js +7 -7
- package/SVF-doxygen/html/html/search/all_15.js +1 -1
- package/SVF-doxygen/html/html/search/all_16.js +2 -2
- package/SVF-doxygen/html/html/search/all_17.js +1 -1
- package/SVF-doxygen/html/html/search/all_2.js +2 -3
- package/SVF-doxygen/html/html/search/all_3.js +3 -3
- package/SVF-doxygen/html/html/search/all_4.js +1 -1
- package/SVF-doxygen/html/html/search/all_5.js +0 -5
- package/SVF-doxygen/html/html/search/all_6.js +6 -5
- package/SVF-doxygen/html/html/search/all_7.js +13 -21
- package/SVF-doxygen/html/html/search/all_9.js +1 -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 +1 -2
- package/SVF-doxygen/html/html/search/all_f.js +4 -3
- package/SVF-doxygen/html/html/search/classes_5.js +1 -1
- package/SVF-doxygen/html/html/search/classes_6.js +1 -1
- package/SVF-doxygen/html/html/search/functions_0.js +3 -2
- package/SVF-doxygen/html/html/search/functions_10.js +2 -3
- package/SVF-doxygen/html/html/search/functions_11.js +1 -1
- package/SVF-doxygen/html/html/search/functions_14.js +1 -1
- package/SVF-doxygen/html/html/search/functions_2.js +2 -2
- package/SVF-doxygen/html/html/search/functions_3.js +1 -1
- package/SVF-doxygen/html/html/search/functions_4.js +0 -2
- package/SVF-doxygen/html/html/search/functions_5.js +1 -1
- package/SVF-doxygen/html/html/search/functions_6.js +13 -21
- package/SVF-doxygen/html/html/search/functions_8.js +1 -2
- package/SVF-doxygen/html/html/search/functions_a.js +1 -1
- package/SVF-doxygen/html/html/search/functions_e.js +1 -1
- package/SVF-doxygen/html/html/search/typedefs_4.js +0 -1
- package/SVF-doxygen/html/html/search/typedefs_e.js +1 -0
- package/SVF-doxygen/html/html/search/variables_14.js +3 -3
- package/SVF-doxygen/html/html/search/variables_15.js +1 -1
- package/SVF-doxygen/html/html/search/variables_2.js +2 -3
- package/SVF-doxygen/html/html/search/variables_5.js +0 -2
- package/SVF-doxygen/html/html/search/variables_6.js +5 -4
- package/SVF-doxygen/html/html/search/variables_c.js +1 -1
- package/SVF-doxygen/html/html/search/variables_e.js +0 -1
- package/SVF-doxygen/html/html/search/variables_f.js +1 -1
- 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 +1 -1
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01OfflineConsG_01_5_01_4.html +1 -1
- package/SVF-doxygen/html/html/structstd_1_1hash_3_01SVF_1_1LocationSet_01_4.html +5 -5
- package/include/Graphs/ConsG.h +1 -1
- package/include/Graphs/ConsGEdge.h +1 -1
- package/include/MemoryModel/LocationSet.h +39 -126
- package/include/MemoryModel/SVFIR.h +1 -1
- package/include/MemoryModel/SVFStatements.h +1 -1
- package/include/MemoryModel/SVFVariables.h +17 -11
- package/include/MemoryModel/SymbolTableInfo.h +27 -25
- package/include/Util/IRAnnotator.h +3 -3
- package/lib/DDA/ContextDDA.cpp +1 -1
- package/lib/Graphs/ConsG.cpp +1 -1
- package/lib/Graphs/IRGraph.cpp +1 -1
- package/lib/Graphs/OfflineConsG.cpp +1 -1
- package/lib/MemoryModel/LocationSet.cpp +53 -95
- package/lib/MemoryModel/PointerAnalysisImpl.cpp +4 -4
- package/lib/MemoryModel/SVFIR.cpp +4 -4
- package/lib/MemoryModel/SVFVariables.cpp +2 -2
- package/lib/MemoryModel/SymbolTableInfo.cpp +36 -63
- package/lib/SABER/SaberSVFGBuilder.cpp +1 -1
- package/lib/SVF-FE/SVFIRBuilder.cpp +9 -10
- package/lib/SVF-FE/SymbolTableBuilder.cpp +4 -4
- package/lib/Util/TypeBasedHeapCloning.cpp +10 -10
- package/lib/WPA/Andersen.cpp +1 -1
- package/lib/WPA/AndersenSFR.cpp +2 -2
- package/lib/WPA/CSC.cpp +1 -1
- package/lib/WPA/FlowSensitiveTBHC.cpp +6 -6
- package/package.json +1 -1
|
@@ -42,44 +42,23 @@ namespace SVF
|
|
|
42
42
|
/*!
|
|
43
43
|
* Field information of an aggregate object
|
|
44
44
|
*/
|
|
45
|
-
class
|
|
45
|
+
class FlattenedFieldInfo
|
|
46
46
|
{
|
|
47
|
-
public:
|
|
48
|
-
typedef std::vector<NodePair > ElemNumStridePairVec;
|
|
49
|
-
|
|
50
47
|
private:
|
|
51
|
-
u32_t
|
|
52
|
-
|
|
53
|
-
const Type* elemTy;
|
|
54
|
-
ElemNumStridePairVec elemNumStridePair;
|
|
48
|
+
u32_t flattenedFldIdx;
|
|
49
|
+
const Type* flattenedElemTy;
|
|
55
50
|
public:
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
FlattenedFieldInfo(u32_t idx, const Type* ty) :
|
|
52
|
+
flattenedFldIdx(idx), flattenedElemTy(ty)
|
|
58
53
|
{
|
|
59
54
|
}
|
|
60
55
|
inline u32_t getFlattenFldIdx() const
|
|
61
56
|
{
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
inline u32_t getFlattenByteOffset() const
|
|
65
|
-
{
|
|
66
|
-
return byteOffset;
|
|
57
|
+
return flattenedFldIdx;
|
|
67
58
|
}
|
|
68
59
|
inline const Type* getFlattenElemTy() const
|
|
69
60
|
{
|
|
70
|
-
return
|
|
71
|
-
}
|
|
72
|
-
inline const ElemNumStridePairVec& getElemNumStridePairVect() const
|
|
73
|
-
{
|
|
74
|
-
return elemNumStridePair;
|
|
75
|
-
}
|
|
76
|
-
inline ElemNumStridePairVec::const_iterator elemStridePairBegin() const
|
|
77
|
-
{
|
|
78
|
-
return elemNumStridePair.begin();
|
|
79
|
-
}
|
|
80
|
-
inline ElemNumStridePairVec::const_iterator elemStridePairEnd() const
|
|
81
|
-
{
|
|
82
|
-
return elemNumStridePair.end();
|
|
61
|
+
return flattenedElemTy;
|
|
83
62
|
}
|
|
84
63
|
};
|
|
85
64
|
|
|
@@ -99,32 +78,22 @@ public:
|
|
|
99
78
|
NonOverlap, Overlap, Subset, Superset, Same
|
|
100
79
|
};
|
|
101
80
|
|
|
102
|
-
typedef
|
|
81
|
+
typedef std::vector<const Value* > OffsetValueVec;
|
|
103
82
|
|
|
104
83
|
/// Constructor
|
|
105
|
-
LocationSet(Size_t o = 0) : fldIdx(o)
|
|
84
|
+
LocationSet(Size_t o = 0) : fldIdx(o)
|
|
106
85
|
{}
|
|
107
86
|
|
|
108
87
|
/// Copy Constructor
|
|
109
88
|
LocationSet(const LocationSet& ls)
|
|
110
|
-
: fldIdx(ls.fldIdx)
|
|
89
|
+
: fldIdx(ls.fldIdx)
|
|
111
90
|
{
|
|
112
|
-
const ElemNumStridePairVec& vec = ls.getNumStridePair();
|
|
113
|
-
ElemNumStridePairVec::const_iterator it = vec.begin();
|
|
114
|
-
ElemNumStridePairVec::const_iterator eit = vec.end();
|
|
115
|
-
for (; it != eit; ++it)
|
|
116
|
-
addElemNumStridePair(*it);
|
|
117
91
|
}
|
|
118
92
|
|
|
119
|
-
/// Initialization from
|
|
120
|
-
LocationSet(const
|
|
121
|
-
: fldIdx(fi.getFlattenFldIdx())
|
|
93
|
+
/// Initialization from FlattenedFieldInfo
|
|
94
|
+
LocationSet(const FlattenedFieldInfo& fi)
|
|
95
|
+
: fldIdx(fi.getFlattenFldIdx())
|
|
122
96
|
{
|
|
123
|
-
const ElemNumStridePairVec& vec = fi.getElemNumStridePairVect();
|
|
124
|
-
ElemNumStridePairVec::const_iterator it = vec.begin();
|
|
125
|
-
ElemNumStridePairVec::const_iterator eit = vec.end();
|
|
126
|
-
for (; it != eit; ++it)
|
|
127
|
-
addElemNumStridePair(*it);
|
|
128
97
|
}
|
|
129
98
|
|
|
130
99
|
~LocationSet() {}
|
|
@@ -135,44 +104,37 @@ public:
|
|
|
135
104
|
inline LocationSet operator+ (const LocationSet& rhs) const
|
|
136
105
|
{
|
|
137
106
|
LocationSet ls(rhs);
|
|
138
|
-
ls.fldIdx +=
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
ElemNumStridePairVec::const_iterator eit = getNumStridePair().end();
|
|
107
|
+
ls.fldIdx += accumulateConstantOffset();
|
|
108
|
+
OffsetValueVec::const_iterator it = getOffsetValueVec().begin();
|
|
109
|
+
OffsetValueVec::const_iterator eit = getOffsetValueVec().end();
|
|
142
110
|
for (; it != eit; ++it)
|
|
143
|
-
ls.
|
|
111
|
+
ls.addOffsetValue(*it);
|
|
144
112
|
|
|
145
113
|
return ls;
|
|
146
114
|
}
|
|
147
115
|
inline const LocationSet& operator= (const LocationSet& rhs)
|
|
148
116
|
{
|
|
149
117
|
fldIdx = rhs.fldIdx;
|
|
150
|
-
|
|
151
|
-
numStridePair = rhs.getNumStridePair();
|
|
118
|
+
offsetValues = rhs.getOffsetValueVec();
|
|
152
119
|
return *this;
|
|
153
120
|
}
|
|
154
121
|
inline bool operator< (const LocationSet& rhs) const
|
|
155
122
|
{
|
|
156
123
|
if (fldIdx != rhs.fldIdx)
|
|
157
124
|
return (fldIdx < rhs.fldIdx);
|
|
158
|
-
// else if (byteOffset != rhs.byteOffset)
|
|
159
|
-
// return (byteOffset < rhs.byteOffset);
|
|
160
125
|
else
|
|
161
126
|
{
|
|
162
|
-
const
|
|
163
|
-
const
|
|
127
|
+
const OffsetValueVec& pairVec = getOffsetValueVec();
|
|
128
|
+
const OffsetValueVec& rhsPairVec = rhs.getOffsetValueVec();
|
|
164
129
|
if (pairVec.size() != rhsPairVec.size())
|
|
165
130
|
return (pairVec.size() < rhsPairVec.size());
|
|
166
131
|
else
|
|
167
132
|
{
|
|
168
|
-
|
|
169
|
-
|
|
133
|
+
OffsetValueVec::const_iterator it = pairVec.begin();
|
|
134
|
+
OffsetValueVec::const_iterator rhsIt = rhsPairVec.begin();
|
|
170
135
|
for (; it != pairVec.end() && rhsIt != rhsPairVec.end(); ++it, ++rhsIt)
|
|
171
136
|
{
|
|
172
|
-
|
|
173
|
-
return ((*it).first < (*rhsIt).first);
|
|
174
|
-
else if ((*it).second != (*rhsIt).second)
|
|
175
|
-
return ((*it).second < (*rhsIt).second);
|
|
137
|
+
return (*it) < (*rhsIt);
|
|
176
138
|
}
|
|
177
139
|
|
|
178
140
|
return false;
|
|
@@ -183,42 +145,30 @@ public:
|
|
|
183
145
|
inline bool operator==(const LocationSet& rhs) const
|
|
184
146
|
{
|
|
185
147
|
return this->fldIdx == rhs.fldIdx
|
|
186
|
-
&& this->
|
|
187
|
-
&& this->numStridePair == rhs.numStridePair;
|
|
148
|
+
&& this->offsetValues == rhs.offsetValues;
|
|
188
149
|
}
|
|
189
150
|
//@}
|
|
190
151
|
|
|
191
152
|
/// Get methods
|
|
192
153
|
//@{
|
|
193
|
-
inline Size_t
|
|
154
|
+
inline Size_t accumulateConstantOffset() const
|
|
194
155
|
{
|
|
195
156
|
return fldIdx;
|
|
196
157
|
}
|
|
197
|
-
inline Size_t getByteOffset() const
|
|
198
|
-
{
|
|
199
|
-
return byteOffset;
|
|
200
|
-
}
|
|
201
158
|
inline void setFldIdx(Size_t idx)
|
|
202
159
|
{
|
|
203
160
|
fldIdx = idx;
|
|
204
161
|
}
|
|
205
|
-
inline
|
|
162
|
+
inline const OffsetValueVec& getOffsetValueVec() const
|
|
206
163
|
{
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
inline const ElemNumStridePairVec& getNumStridePair() const
|
|
210
|
-
{
|
|
211
|
-
return numStridePair;
|
|
164
|
+
return offsetValues;
|
|
212
165
|
}
|
|
213
166
|
//@}
|
|
214
167
|
|
|
215
|
-
|
|
168
|
+
bool addOffsetValue(const Value* offsetValue);
|
|
216
169
|
|
|
217
170
|
/// Return TRUE if this is a constant location set.
|
|
218
|
-
|
|
219
|
-
{
|
|
220
|
-
return (numStridePair.size() == 0);
|
|
221
|
-
}
|
|
171
|
+
bool isConstantOffset() const;
|
|
222
172
|
|
|
223
173
|
/// Return TRUE if we share any location in common with RHS
|
|
224
174
|
inline bool intersects(const LocationSet& RHS) const
|
|
@@ -226,50 +176,13 @@ public:
|
|
|
226
176
|
return computeAllLocations().intersects(RHS.computeAllLocations());
|
|
227
177
|
}
|
|
228
178
|
|
|
229
|
-
/// Check relations of two location sets
|
|
230
|
-
static inline LSRelation checkRelation(const LocationSet& LHS, const LocationSet& RHS)
|
|
231
|
-
{
|
|
232
|
-
NodeBS lhsLocations = LHS.computeAllLocations();
|
|
233
|
-
NodeBS rhsLocations = RHS.computeAllLocations();
|
|
234
|
-
if (lhsLocations.intersects(rhsLocations))
|
|
235
|
-
{
|
|
236
|
-
if (lhsLocations == rhsLocations)
|
|
237
|
-
return Same;
|
|
238
|
-
else if (lhsLocations.contains(rhsLocations))
|
|
239
|
-
return Superset;
|
|
240
|
-
else if (rhsLocations.contains(lhsLocations))
|
|
241
|
-
return Subset;
|
|
242
|
-
else
|
|
243
|
-
return Overlap;
|
|
244
|
-
}
|
|
245
|
-
else
|
|
246
|
-
{
|
|
247
|
-
return NonOverlap;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
179
|
/// Dump location set
|
|
252
|
-
std::string dump() const
|
|
253
|
-
|
|
254
|
-
std::string str;
|
|
255
|
-
raw_string_ostream rawstr(str);
|
|
256
|
-
|
|
257
|
-
rawstr << "LocationSet\tField_Index: " << getOffset();
|
|
258
|
-
rawstr << "\tOffset: " << getByteOffset()
|
|
259
|
-
<< ",\tNum-Stride: {";
|
|
260
|
-
const ElemNumStridePairVec& vec = getNumStridePair();
|
|
261
|
-
ElemNumStridePairVec::const_iterator it = vec.begin();
|
|
262
|
-
ElemNumStridePairVec::const_iterator eit = vec.end();
|
|
263
|
-
for (; it != eit; ++it)
|
|
264
|
-
{
|
|
265
|
-
rawstr << " (" << it->first << "," << it->second << ")";
|
|
266
|
-
}
|
|
267
|
-
rawstr << " }\n";
|
|
268
|
-
return rawstr.str();
|
|
269
|
-
}
|
|
180
|
+
std::string dump() const;
|
|
181
|
+
|
|
270
182
|
private:
|
|
271
|
-
|
|
272
|
-
|
|
183
|
+
|
|
184
|
+
/// Check relations of two location sets
|
|
185
|
+
LSRelation checkRelation(const LocationSet& LHS, const LocationSet& RHS);
|
|
273
186
|
|
|
274
187
|
/// Compute all possible locations according to offset and number-stride pairs.
|
|
275
188
|
NodeBS computeAllLocations() const;
|
|
@@ -280,17 +193,17 @@ private:
|
|
|
280
193
|
return (n2 == 0) ? n1 : gcd (n2, n1 % n2);
|
|
281
194
|
}
|
|
282
195
|
|
|
283
|
-
Size_t fldIdx; ///<
|
|
284
|
-
|
|
285
|
-
ElemNumStridePairVec numStridePair; ///< element number and stride pair
|
|
196
|
+
Size_t fldIdx; ///< Accumulated Constant Offsets
|
|
197
|
+
OffsetValueVec offsetValues; ///< a vector of actual offset in the form of Values
|
|
286
198
|
};
|
|
287
199
|
|
|
288
200
|
} // End namespace SVF
|
|
289
201
|
|
|
290
202
|
template <> struct std::hash<SVF::LocationSet> {
|
|
291
203
|
size_t operator()(const SVF::LocationSet &ls) const {
|
|
292
|
-
SVF::Hash<std::pair<SVF::
|
|
293
|
-
|
|
204
|
+
SVF::Hash<std::pair<SVF::NodeID, SVF::NodeID>> h;
|
|
205
|
+
std::hash<SVF::LocationSet::OffsetValueVec> v;
|
|
206
|
+
return h(std::make_pair(ls.accumulateConstantOffset(), v(ls.getOffsetValueVec())));
|
|
294
207
|
}
|
|
295
208
|
};
|
|
296
209
|
|
|
@@ -418,7 +418,7 @@ public:
|
|
|
418
418
|
{
|
|
419
419
|
return (fiNode->getMemObj()->hasPtrObj() == false);
|
|
420
420
|
}
|
|
421
|
-
else if (
|
|
421
|
+
else if (GepObjVar* gepNode = SVFUtil::dyn_cast<GepObjVar>(node))
|
|
422
422
|
{
|
|
423
423
|
return (gepNode->getMemObj()->isNonPtrFieldObj(gepNode->getLocationSet()));
|
|
424
424
|
}
|
|
@@ -419,7 +419,7 @@ public:
|
|
|
419
419
|
/// offset of the base value variable
|
|
420
420
|
inline u32_t getOffset() const
|
|
421
421
|
{
|
|
422
|
-
return ls.
|
|
422
|
+
return ls.accumulateConstantOffset();
|
|
423
423
|
}
|
|
424
424
|
|
|
425
425
|
/// Return name of a LLVM value
|
|
@@ -448,7 +448,7 @@ public:
|
|
|
448
448
|
* Gep Obj variable, this is dynamic generated for field sensitive analysis
|
|
449
449
|
* Each gep obj variable is one field of a MemObj (base)
|
|
450
450
|
*/
|
|
451
|
-
class
|
|
451
|
+
class GepObjVar: public ObjVar
|
|
452
452
|
{
|
|
453
453
|
private:
|
|
454
454
|
LocationSet ls;
|
|
@@ -457,7 +457,7 @@ private:
|
|
|
457
457
|
public:
|
|
458
458
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
459
459
|
//@{
|
|
460
|
-
static inline bool classof(const
|
|
460
|
+
static inline bool classof(const GepObjVar *)
|
|
461
461
|
{
|
|
462
462
|
return true;
|
|
463
463
|
}
|
|
@@ -479,7 +479,7 @@ public:
|
|
|
479
479
|
//@}
|
|
480
480
|
|
|
481
481
|
/// Constructor
|
|
482
|
-
|
|
482
|
+
GepObjVar(const MemObj* mem, NodeID i, const LocationSet& l, PNODEK ty = GepObjNode) :
|
|
483
483
|
ObjVar(mem->getValue(), i, mem, ty), ls(l)
|
|
484
484
|
{
|
|
485
485
|
base = mem->getId();
|
|
@@ -491,6 +491,12 @@ public:
|
|
|
491
491
|
return ls;
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
+
/// offset of the mem object
|
|
495
|
+
inline u32_t getOffset() const
|
|
496
|
+
{
|
|
497
|
+
return ls.accumulateConstantOffset();
|
|
498
|
+
}
|
|
499
|
+
|
|
494
500
|
/// Set the base object from which this GEP node came from.
|
|
495
501
|
inline void setBaseNode(NodeID base)
|
|
496
502
|
{
|
|
@@ -504,17 +510,17 @@ public:
|
|
|
504
510
|
}
|
|
505
511
|
|
|
506
512
|
/// Return the type of this gep object
|
|
507
|
-
inline virtual const
|
|
513
|
+
inline virtual const Type* getType() const
|
|
508
514
|
{
|
|
509
|
-
return SymbolTableInfo::SymbolInfo()->
|
|
515
|
+
return SymbolTableInfo::SymbolInfo()->getOriginalFieldType(mem->getType(), ls.accumulateConstantOffset());
|
|
510
516
|
}
|
|
511
517
|
|
|
512
518
|
/// Return name of a LLVM value
|
|
513
519
|
inline const std::string getValueName() const
|
|
514
520
|
{
|
|
515
521
|
if (value && value->hasName())
|
|
516
|
-
return value->getName().str() + "_" + llvm::itostr(ls.
|
|
517
|
-
return "offset_" + llvm::itostr(ls.
|
|
522
|
+
return value->getName().str() + "_" + llvm::itostr(ls.accumulateConstantOffset());
|
|
523
|
+
return "offset_" + llvm::itostr(ls.accumulateConstantOffset());
|
|
518
524
|
}
|
|
519
525
|
|
|
520
526
|
virtual const std::string toString() const;
|
|
@@ -766,7 +772,7 @@ public:
|
|
|
766
772
|
/*
|
|
767
773
|
* Clone object for GEP objects.
|
|
768
774
|
*/
|
|
769
|
-
class CloneGepObjVar : public
|
|
775
|
+
class CloneGepObjVar : public GepObjVar
|
|
770
776
|
{
|
|
771
777
|
public:
|
|
772
778
|
//@{ Methods to support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -786,14 +792,14 @@ public:
|
|
|
786
792
|
|
|
787
793
|
/// Constructor
|
|
788
794
|
CloneGepObjVar(const MemObj* mem, NodeID i, const LocationSet& l, PNODEK ty = CloneGepObjNode) :
|
|
789
|
-
|
|
795
|
+
GepObjVar(mem, i, l, ty)
|
|
790
796
|
{
|
|
791
797
|
}
|
|
792
798
|
|
|
793
799
|
/// Return name of this node
|
|
794
800
|
inline const std::string getValueName() const
|
|
795
801
|
{
|
|
796
|
-
return "clone (gep) of " +
|
|
802
|
+
return "clone (gep) of " + GepObjVar::getValueName();
|
|
797
803
|
}
|
|
798
804
|
|
|
799
805
|
virtual const std::string toString() const;
|
|
@@ -364,11 +364,14 @@ public:
|
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
///Get a reference to the components of struct_info.
|
|
367
|
-
const std::vector<u32_t>&
|
|
368
|
-
const std::vector<
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
367
|
+
const std::vector<u32_t>& getFlattenedFieldIdxVec(const Type *T);
|
|
368
|
+
const std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec(const Type *T);
|
|
369
|
+
|
|
370
|
+
/// struct A { int id; int salary; }; struct B { char name[20]; struct A a;} B b;
|
|
371
|
+
/// OriginalFieldType of b with field_idx 1 : Struct A
|
|
372
|
+
/// FlatternedFieldType of b with field_idx 1 : int
|
|
373
|
+
const Type* getOriginalFieldType(const Type* baseType, u32_t field_idx);
|
|
374
|
+
const Type* getFlatternedFieldType(const Type* baseType, u32_t field_idx);
|
|
372
375
|
//@}
|
|
373
376
|
|
|
374
377
|
/// Collect type info
|
|
@@ -505,14 +508,10 @@ class StInfo
|
|
|
505
508
|
private:
|
|
506
509
|
/// flattened field indices of a struct
|
|
507
510
|
std::vector<u32_t> fldIdxVec;
|
|
508
|
-
/// flattened field offsets of of a struct
|
|
509
|
-
std::vector<u32_t> foffset;
|
|
510
511
|
/// Types of all fields of a struct
|
|
511
|
-
Map<u32_t, const
|
|
512
|
-
/// Types of all fields of a struct
|
|
513
|
-
Map<u32_t, const llvm::Type*> offset2TypeMap;
|
|
512
|
+
Map<u32_t, const Type*> fldIdx2TypeMap;
|
|
514
513
|
/// All field infos after flattening a struct
|
|
515
|
-
std::vector<
|
|
514
|
+
std::vector<FlattenedFieldInfo> finfo;
|
|
516
515
|
|
|
517
516
|
/// Max field limit
|
|
518
517
|
static u32_t maxFieldLimit;
|
|
@@ -537,37 +536,40 @@ public:
|
|
|
537
536
|
return maxFieldLimit;
|
|
538
537
|
}
|
|
539
538
|
|
|
540
|
-
///
|
|
539
|
+
/// struct A { int id; int salary; }; struct B { char name[20]; struct A a;} B b;
|
|
540
|
+
/// OriginalFieldType of b with field_idx 1 : Struct A
|
|
541
|
+
/// FlatternedFieldType of b with field_idx 1 : int
|
|
541
542
|
//{@
|
|
542
|
-
inline const
|
|
543
|
+
inline const Type* getOriginalFieldType(u32_t fldIdx)
|
|
543
544
|
{
|
|
544
|
-
|
|
545
|
+
Map<u32_t, const Type*>::const_iterator it = fldIdx2TypeMap.find(fldIdx);
|
|
546
|
+
if(it!=fldIdx2TypeMap.end())
|
|
547
|
+
return it->second;
|
|
548
|
+
return nullptr;
|
|
545
549
|
}
|
|
546
|
-
inline const
|
|
550
|
+
inline const Type* getFlatternedFieldType(u32_t fldIdx)
|
|
547
551
|
{
|
|
548
|
-
|
|
552
|
+
for(FlattenedFieldInfo& fallenedFld : finfo){
|
|
553
|
+
if(fallenedFld.getFlattenFldIdx() == fldIdx)
|
|
554
|
+
return fallenedFld.getFlattenElemTy();
|
|
555
|
+
}
|
|
556
|
+
return nullptr;
|
|
549
557
|
}
|
|
550
|
-
inline std::vector<u32_t>&
|
|
558
|
+
inline std::vector<u32_t>& getFlattenedFieldIdxVec()
|
|
551
559
|
{
|
|
552
560
|
return fldIdxVec;
|
|
553
561
|
}
|
|
554
|
-
inline std::vector<
|
|
555
|
-
{
|
|
556
|
-
return foffset;
|
|
557
|
-
}
|
|
558
|
-
inline std::vector<FieldInfo>& getFlattenFieldInfoVec()
|
|
562
|
+
inline std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec()
|
|
559
563
|
{
|
|
560
564
|
return finfo;
|
|
561
565
|
}
|
|
562
566
|
//@}
|
|
563
567
|
|
|
564
568
|
/// Add field (index and offset) with its corresponding type
|
|
565
|
-
inline void addFldWithType(u32_t fldIdx,
|
|
569
|
+
inline void addFldWithType(u32_t fldIdx, const Type* type)
|
|
566
570
|
{
|
|
567
571
|
fldIdxVec.push_back(fldIdx);
|
|
568
|
-
foffset.push_back(offset);
|
|
569
572
|
fldIdx2TypeMap[fldIdx] = type;
|
|
570
|
-
offset2TypeMap[offset] = type;
|
|
571
573
|
}
|
|
572
574
|
};
|
|
573
575
|
|
|
@@ -42,7 +42,7 @@ public:
|
|
|
42
42
|
{
|
|
43
43
|
auto nodeId = it->first;
|
|
44
44
|
auto pagNode = it->second;
|
|
45
|
-
auto gepNode = SVFUtil::dyn_cast<
|
|
45
|
+
auto gepNode = SVFUtil::dyn_cast<GepObjVar>(pagNode);
|
|
46
46
|
|
|
47
47
|
if (gepNode && writeFlag)
|
|
48
48
|
{
|
|
@@ -61,10 +61,10 @@ public:
|
|
|
61
61
|
private:
|
|
62
62
|
// Write the PAGgepNode to the IR such that metadata name is the SVFIR node id and the operands
|
|
63
63
|
// are its base node's id and location offset
|
|
64
|
-
void writePAGgepNode(SVF::NodeID nodeId,
|
|
64
|
+
void writePAGgepNode(SVF::NodeID nodeId, GepObjVar* gepNode)
|
|
65
65
|
{
|
|
66
66
|
auto baseNodeId = gepNode->getBaseNode();
|
|
67
|
-
auto locationSetOffset = gepNode->
|
|
67
|
+
auto locationSetOffset = gepNode->getOffset();
|
|
68
68
|
|
|
69
69
|
LLVMContext &context = mainModule->getContext();
|
|
70
70
|
llvm::SmallVector<llvm::Metadata *, 32> operands;
|
package/lib/DDA/ContextDDA.cpp
CHANGED
|
@@ -318,7 +318,7 @@ bool ContextDDA::isHeapCondMemObj(const CxtVar& var, const StoreSVFGNode*)
|
|
|
318
318
|
{
|
|
319
319
|
if (!mem->getValue()) {
|
|
320
320
|
PAGNode *pnode = _pag->getGNode(getPtrNodeID(var));
|
|
321
|
-
if(
|
|
321
|
+
if(GepObjVar* gepobj = SVFUtil::dyn_cast<GepObjVar>(pnode)){
|
|
322
322
|
assert(SVFUtil::isa<DummyObjVar>(_pag->getGNode(gepobj->getBaseNode())) && "emtpy refVal in a gep object whose base is a non-dummy object");
|
|
323
323
|
}
|
|
324
324
|
else{
|
package/lib/Graphs/ConsG.cpp
CHANGED
|
@@ -681,7 +681,7 @@ struct DOTGraphTraits<ConstraintGraph*> : public DOTGraphTraits<SVFIR*>
|
|
|
681
681
|
}
|
|
682
682
|
else if (SVFUtil::isa<ObjVar>(node))
|
|
683
683
|
{
|
|
684
|
-
if(SVFUtil::isa<
|
|
684
|
+
if(SVFUtil::isa<GepObjVar>(node))
|
|
685
685
|
return "shape=doubleoctagon";
|
|
686
686
|
else if(SVFUtil::isa<FIObjVar>(node))
|
|
687
687
|
return "shape=box3d";
|
package/lib/Graphs/IRGraph.cpp
CHANGED
|
@@ -174,7 +174,7 @@ struct DOTGraphTraits<IRGraph*> : public DefaultDOTGraphTraits
|
|
|
174
174
|
}
|
|
175
175
|
else if (SVFUtil::isa<ObjVar>(node))
|
|
176
176
|
{
|
|
177
|
-
if(SVFUtil::isa<
|
|
177
|
+
if(SVFUtil::isa<GepObjVar>(node))
|
|
178
178
|
return "shape=doubleoctagon";
|
|
179
179
|
else if(SVFUtil::isa<FIObjVar>(node))
|
|
180
180
|
return "shape=box3d";
|
|
@@ -254,7 +254,7 @@ struct DOTGraphTraits<OfflineConsG*> : public DOTGraphTraits<SVFIR*>
|
|
|
254
254
|
}
|
|
255
255
|
else if (SVFUtil::isa<ObjVar>(node))
|
|
256
256
|
{
|
|
257
|
-
if(SVFUtil::isa<
|
|
257
|
+
if(SVFUtil::isa<GepObjVar>(node))
|
|
258
258
|
return "shape=doubleoctagon";
|
|
259
259
|
else if(SVFUtil::isa<FIObjVar>(node))
|
|
260
260
|
return "shape=box3d";
|