svf-lib 1.0.2195 → 1.0.2197
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-linux/Release-build/bin/ae +0 -0
- package/SVF-linux/Release-build/bin/cfl +0 -0
- package/SVF-linux/Release-build/bin/dvf +0 -0
- package/SVF-linux/Release-build/bin/llvm2svf +0 -0
- package/SVF-linux/Release-build/bin/mta +0 -0
- package/SVF-linux/Release-build/bin/saber +0 -0
- package/SVF-linux/Release-build/bin/svf-ex +0 -0
- package/SVF-linux/Release-build/bin/wpa +0 -0
- package/SVF-linux/Release-build/include/AE/Svfexe/AbsExtAPI.h +0 -7
- package/SVF-linux/Release-build/include/CFL/CFLAlias.h +0 -8
- package/SVF-linux/Release-build/include/DDA/DDAPass.h +4 -1
- package/SVF-linux/Release-build/include/Graphs/ConsG.h +0 -5
- package/SVF-linux/Release-build/include/Graphs/IRGraph.h +0 -24
- package/SVF-linux/Release-build/include/MSSA/MemRegion.h +1 -1
- package/SVF-linux/Release-build/include/MemoryModel/PointerAnalysis.h +2 -2
- package/SVF-linux/Release-build/include/MemoryModel/PointerAnalysisImpl.h +7 -4
- package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +3 -3
- package/SVF-linux/Release-build/include/SVFIR/SVFVariables.h +3 -3
- package/SVF-linux/Release-build/include/Util/SVFUtil.h +0 -16
- package/SVF-linux/Release-build/include/WPA/WPAPass.h +0 -7
- package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
- package/SVF-osx/Release-build/bin/ae +0 -0
- package/SVF-osx/Release-build/bin/cfl +0 -0
- package/SVF-osx/Release-build/bin/dvf +0 -0
- package/SVF-osx/Release-build/bin/llvm2svf +0 -0
- package/SVF-osx/Release-build/bin/mta +0 -0
- package/SVF-osx/Release-build/bin/saber +0 -0
- package/SVF-osx/Release-build/bin/svf-ex +0 -0
- package/SVF-osx/Release-build/bin/wpa +0 -0
- package/SVF-osx/Release-build/include/Graphs/IRGraph.h +238 -29
- package/SVF-osx/Release-build/include/MemoryModel/AccessPath.h +0 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/LLVMModule.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/SymbolTableBuilder.h +3 -3
- package/SVF-osx/Release-build/include/SVFIR/ObjTypeInfo.h +225 -0
- package/SVF-osx/Release-build/include/SVFIR/SVFIR.h +9 -19
- package/SVF-osx/Release-build/include/SVFIR/SVFVariables.h +4 -9
- package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
- package/package.json +1 -1
- package/SVF-osx/Release-build/include/SVFIR/SymbolTableInfo.h +0 -545
|
@@ -76,7 +76,7 @@ public:
|
|
|
76
76
|
private:
|
|
77
77
|
static LLVMModuleSet* llvmModuleSet;
|
|
78
78
|
static bool preProcessed;
|
|
79
|
-
|
|
79
|
+
SVFIR* svfir;
|
|
80
80
|
SVFModule* svfModule; ///< Borrowed from singleton SVFModule::svfModule
|
|
81
81
|
ICFG* icfg;
|
|
82
82
|
std::unique_ptr<LLVMContext> owned_ctx;
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
#define SymbolTableBuilder_H_
|
|
32
32
|
|
|
33
33
|
#include "SVF-LLVM/LLVMModule.h"
|
|
34
|
-
#include "SVFIR/
|
|
34
|
+
#include "SVFIR/ObjTypeInfo.h"
|
|
35
35
|
|
|
36
36
|
/*
|
|
37
37
|
* This class is to build SymbolTableInfo, MemObjs and ObjTypeInfo
|
|
@@ -45,11 +45,11 @@ class SymbolTableBuilder
|
|
|
45
45
|
{
|
|
46
46
|
friend class SVFIRBuilder;
|
|
47
47
|
private:
|
|
48
|
-
|
|
48
|
+
SVFIR* svfir;
|
|
49
49
|
|
|
50
50
|
public:
|
|
51
51
|
/// Constructor
|
|
52
|
-
SymbolTableBuilder(
|
|
52
|
+
SymbolTableBuilder(SVFIR* ir): svfir(ir)
|
|
53
53
|
{
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
//===- ObjTypeInfo.h -- Object type information------------------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-> <Yulei Sui>
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// This program is free software: you can redistribute it and/or modify
|
|
9
|
+
// it under the terms of the GNU Affero General Public License as published by
|
|
10
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
// (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
// This program is distributed in the hope that it will be useful,
|
|
14
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
// GNU Affero General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU Affero General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* ObjTypeInfo.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: Nov 11, 2013
|
|
27
|
+
* Author: Yulei Sui
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef INCLUDE_SVFIR_OBJTYPEINFO_H_
|
|
31
|
+
#define INCLUDE_SVFIR_OBJTYPEINFO_H_
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
#include "Util/SVFUtil.h"
|
|
35
|
+
#include "MemoryModel/AccessPath.h"
|
|
36
|
+
#include "SVFIR/SVFModule.h"
|
|
37
|
+
namespace SVF
|
|
38
|
+
{
|
|
39
|
+
|
|
40
|
+
/*!
|
|
41
|
+
* Type Info of an abstract memory object
|
|
42
|
+
*/
|
|
43
|
+
class ObjTypeInfo
|
|
44
|
+
{
|
|
45
|
+
friend class SVFIRWriter;
|
|
46
|
+
friend class SVFIRReader;
|
|
47
|
+
friend class SymbolTableBuilder;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
typedef enum
|
|
51
|
+
{
|
|
52
|
+
FUNCTION_OBJ = 0x1, // object is a function
|
|
53
|
+
GLOBVAR_OBJ = 0x2, // object is a global variable
|
|
54
|
+
STATIC_OBJ = 0x4, // object is a static variable allocated before main
|
|
55
|
+
STACK_OBJ = 0x8, // object is a stack variable
|
|
56
|
+
HEAP_OBJ = 0x10, // object is a heap variable
|
|
57
|
+
VAR_STRUCT_OBJ = 0x20, // object contains struct
|
|
58
|
+
VAR_ARRAY_OBJ = 0x40, // object contains array
|
|
59
|
+
CONST_STRUCT_OBJ = 0x80, // constant struct
|
|
60
|
+
CONST_ARRAY_OBJ = 0x100, // constant array
|
|
61
|
+
CONST_GLOBAL_OBJ = 0x200, // global constant object
|
|
62
|
+
CONST_DATA = 0x400, // constant object str e.g. 5, 10, 1.0
|
|
63
|
+
} MEMTYPE;
|
|
64
|
+
|
|
65
|
+
private:
|
|
66
|
+
/// SVF type
|
|
67
|
+
const SVFType* type;
|
|
68
|
+
/// Type flags
|
|
69
|
+
u32_t flags;
|
|
70
|
+
/// Max offset for flexible field sensitive analysis
|
|
71
|
+
/// maximum number of field object can be created
|
|
72
|
+
/// minimum number is 0 (field insensitive analysis)
|
|
73
|
+
u32_t maxOffsetLimit;
|
|
74
|
+
/// Size of the object or number of elements
|
|
75
|
+
u32_t elemNum;
|
|
76
|
+
|
|
77
|
+
/// Byte size of object
|
|
78
|
+
u32_t byteSize;
|
|
79
|
+
|
|
80
|
+
inline void resetTypeForHeapStaticObj(const SVFType* t)
|
|
81
|
+
{
|
|
82
|
+
assert((isStaticObj() || isHeap()) && "can only reset the inferred type for heap and static objects!");
|
|
83
|
+
type = t;
|
|
84
|
+
}
|
|
85
|
+
public:
|
|
86
|
+
|
|
87
|
+
/// Constructors
|
|
88
|
+
ObjTypeInfo(const SVFType* t, u32_t max) : type(t), flags(0), maxOffsetLimit(max), elemNum(max)
|
|
89
|
+
{
|
|
90
|
+
assert(t && "no type information for this object?");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/// Destructor
|
|
94
|
+
virtual ~ObjTypeInfo()
|
|
95
|
+
{
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/// Get LLVM type
|
|
99
|
+
inline const SVFType* getType() const
|
|
100
|
+
{
|
|
101
|
+
return type;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/// Get max field offset limit
|
|
105
|
+
inline u32_t getMaxFieldOffsetLimit()
|
|
106
|
+
{
|
|
107
|
+
return maxOffsetLimit;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/// Get max field offset limit
|
|
111
|
+
inline void setMaxFieldOffsetLimit(u32_t limit)
|
|
112
|
+
{
|
|
113
|
+
maxOffsetLimit = limit;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/// Set the number of elements of this object
|
|
117
|
+
inline void setNumOfElements(u32_t num)
|
|
118
|
+
{
|
|
119
|
+
elemNum = num;
|
|
120
|
+
setMaxFieldOffsetLimit(num);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/// Get the number of elements of this object
|
|
124
|
+
inline u32_t getNumOfElements() const
|
|
125
|
+
{
|
|
126
|
+
return elemNum;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/// Get the byte size of this object
|
|
130
|
+
inline u32_t getByteSizeOfObj() const
|
|
131
|
+
{
|
|
132
|
+
assert(isConstantByteSize() && "This Obj's byte size is not constant.");
|
|
133
|
+
return byteSize;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/// Set the byte size of this object
|
|
137
|
+
inline void setByteSizeOfObj(u32_t size)
|
|
138
|
+
{
|
|
139
|
+
byteSize = size;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/// Check if byte size is a const value
|
|
143
|
+
inline bool isConstantByteSize() const
|
|
144
|
+
{
|
|
145
|
+
return byteSize != 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/// Flag for this object type
|
|
149
|
+
//@{
|
|
150
|
+
inline void setFlag(MEMTYPE mask)
|
|
151
|
+
{
|
|
152
|
+
flags |= mask;
|
|
153
|
+
}
|
|
154
|
+
inline bool hasFlag(MEMTYPE mask)
|
|
155
|
+
{
|
|
156
|
+
return (flags & mask) == mask;
|
|
157
|
+
}
|
|
158
|
+
//@}
|
|
159
|
+
|
|
160
|
+
/// Object attributes
|
|
161
|
+
//@{
|
|
162
|
+
inline bool isFunction()
|
|
163
|
+
{
|
|
164
|
+
return hasFlag(FUNCTION_OBJ);
|
|
165
|
+
}
|
|
166
|
+
inline bool isGlobalObj()
|
|
167
|
+
{
|
|
168
|
+
return hasFlag(GLOBVAR_OBJ);
|
|
169
|
+
}
|
|
170
|
+
inline bool isStaticObj()
|
|
171
|
+
{
|
|
172
|
+
return hasFlag(STATIC_OBJ);
|
|
173
|
+
}
|
|
174
|
+
inline bool isStack()
|
|
175
|
+
{
|
|
176
|
+
return hasFlag(STACK_OBJ);
|
|
177
|
+
}
|
|
178
|
+
inline bool isHeap()
|
|
179
|
+
{
|
|
180
|
+
return hasFlag(HEAP_OBJ);
|
|
181
|
+
}
|
|
182
|
+
//@}
|
|
183
|
+
|
|
184
|
+
/// Object attributes (noted that an object can be a nested compound types)
|
|
185
|
+
/// e.g. both isStruct and isArray can return true
|
|
186
|
+
//@{
|
|
187
|
+
inline bool isVarStruct()
|
|
188
|
+
{
|
|
189
|
+
return hasFlag(VAR_STRUCT_OBJ);
|
|
190
|
+
}
|
|
191
|
+
inline bool isConstantStruct()
|
|
192
|
+
{
|
|
193
|
+
return hasFlag(CONST_STRUCT_OBJ);
|
|
194
|
+
}
|
|
195
|
+
inline bool isStruct()
|
|
196
|
+
{
|
|
197
|
+
return hasFlag(VAR_STRUCT_OBJ) || hasFlag(CONST_STRUCT_OBJ);
|
|
198
|
+
}
|
|
199
|
+
inline bool isVarArray()
|
|
200
|
+
{
|
|
201
|
+
return hasFlag(VAR_ARRAY_OBJ);
|
|
202
|
+
}
|
|
203
|
+
inline bool isConstantArray()
|
|
204
|
+
{
|
|
205
|
+
return hasFlag(CONST_ARRAY_OBJ);
|
|
206
|
+
}
|
|
207
|
+
inline bool isArray()
|
|
208
|
+
{
|
|
209
|
+
return hasFlag(VAR_ARRAY_OBJ) || hasFlag(CONST_ARRAY_OBJ);
|
|
210
|
+
}
|
|
211
|
+
inline bool isConstDataOrConstGlobal()
|
|
212
|
+
{
|
|
213
|
+
return hasFlag(CONST_GLOBAL_OBJ) || hasFlag(CONST_DATA);
|
|
214
|
+
}
|
|
215
|
+
inline bool isConstDataOrAggData()
|
|
216
|
+
{
|
|
217
|
+
return hasFlag(CONST_DATA);
|
|
218
|
+
}
|
|
219
|
+
//@}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
} // End namespace SVF
|
|
224
|
+
|
|
225
|
+
#endif /* INCLUDE_SVFIR_OBJTYPEINFO_H_ */
|
|
@@ -431,27 +431,17 @@ public:
|
|
|
431
431
|
|
|
432
432
|
/// Get black hole and constant id
|
|
433
433
|
//@{
|
|
434
|
-
|
|
435
|
-
{
|
|
436
|
-
return (SymbolTableInfo::isBlkPtr(id));
|
|
437
|
-
}
|
|
438
|
-
inline bool isNullPtr(NodeID id) const
|
|
439
|
-
{
|
|
440
|
-
return (SymbolTableInfo::isNullPtr(id));
|
|
441
|
-
}
|
|
434
|
+
|
|
442
435
|
inline bool isBlkObjOrConstantObj(NodeID id) const
|
|
443
436
|
{
|
|
444
437
|
return (isBlkObj(id) || isConstantObj(id));
|
|
445
438
|
}
|
|
446
|
-
|
|
447
|
-
{
|
|
448
|
-
return SymbolTableInfo::isBlkObj(id);
|
|
449
|
-
}
|
|
439
|
+
|
|
450
440
|
inline bool isConstantObj(NodeID id) const
|
|
451
441
|
{
|
|
452
442
|
const BaseObjVar* obj = getBaseObject(id);
|
|
453
443
|
assert(obj && "not an object node?");
|
|
454
|
-
return
|
|
444
|
+
return isConstantSym(id) ||
|
|
455
445
|
obj->isConstDataOrConstGlobal();
|
|
456
446
|
}
|
|
457
447
|
//@}
|
|
@@ -715,25 +705,25 @@ private:
|
|
|
715
705
|
}
|
|
716
706
|
inline NodeID addDummyObjNode(NodeID i, const SVFType* type)
|
|
717
707
|
{
|
|
718
|
-
if (
|
|
708
|
+
if (idToObjTypeInfoMap().find(i) == idToObjTypeInfoMap().end())
|
|
719
709
|
{
|
|
720
|
-
ObjTypeInfo* ti =
|
|
721
|
-
|
|
710
|
+
ObjTypeInfo* ti = createObjTypeInfo(type);
|
|
711
|
+
idToObjTypeInfoMap()[i] = ti;
|
|
722
712
|
return addObjNode(new DummyObjVar(i, ti, nullptr, type));
|
|
723
713
|
}
|
|
724
714
|
else
|
|
725
715
|
{
|
|
726
|
-
return addObjNode(new DummyObjVar(i,
|
|
716
|
+
return addObjNode(new DummyObjVar(i, getObjTypeInfo(i), nullptr, type));
|
|
727
717
|
}
|
|
728
718
|
}
|
|
729
719
|
|
|
730
720
|
inline NodeID addBlackholeObjNode()
|
|
731
721
|
{
|
|
732
|
-
return addObjNode(new DummyObjVar(getBlackHoleNode(),
|
|
722
|
+
return addObjNode(new DummyObjVar(getBlackHoleNode(), getObjTypeInfo(getBlackHoleNode()), nullptr));
|
|
733
723
|
}
|
|
734
724
|
inline NodeID addConstantObjNode()
|
|
735
725
|
{
|
|
736
|
-
return addObjNode(new DummyObjVar(getConstantNode(),
|
|
726
|
+
return addObjNode(new DummyObjVar(getConstantNode(), getObjTypeInfo(getConstantNode()), nullptr));
|
|
737
727
|
}
|
|
738
728
|
inline NodeID addBlackholePtrNode()
|
|
739
729
|
{
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
#define INCLUDE_SVFIR_SVFVARIABLE_H_
|
|
32
32
|
|
|
33
33
|
#include "Graphs/GenericGraph.h"
|
|
34
|
-
#include "SVFIR/
|
|
34
|
+
#include "SVFIR/ObjTypeInfo.h"
|
|
35
35
|
#include "SVFIR/SVFStatements.h"
|
|
36
36
|
|
|
37
37
|
namespace SVF
|
|
@@ -648,10 +648,7 @@ public:
|
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
/// Whether it is a black hole object
|
|
651
|
-
bool isBlackHoleObj() const
|
|
652
|
-
{
|
|
653
|
-
return SymbolTableInfo::isBlkObj(getId());
|
|
654
|
-
}
|
|
651
|
+
bool isBlackHoleObj() const;
|
|
655
652
|
|
|
656
653
|
/// Get the byte size of this object
|
|
657
654
|
u32_t getByteSizeOfObj() const
|
|
@@ -802,10 +799,8 @@ public:
|
|
|
802
799
|
}
|
|
803
800
|
|
|
804
801
|
/// Return the type of this gep object
|
|
805
|
-
inline virtual const SVFType* getType() const
|
|
806
|
-
|
|
807
|
-
return SymbolTableInfo::SymbolInfo()->getFlatternedElemType(type, apOffset);
|
|
808
|
-
}
|
|
802
|
+
inline virtual const SVFType* getType() const;
|
|
803
|
+
|
|
809
804
|
|
|
810
805
|
/// Return name of a LLVM value
|
|
811
806
|
inline const std::string getValueName() const
|
|
Binary file
|
|
Binary file
|