svf-tools 1.0.1043 → 1.0.1044
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/package.json +1 -1
- package/svf/include/DDA/DDAClient.h +6 -11
- package/svf/include/DDA/DDAPass.h +1 -1
- package/svf/include/Graphs/CHG.h +2 -3
- package/svf/include/Graphs/GenericGraph.h +1 -286
- package/svf/include/MTA/MTA.h +2 -2
- package/svf/include/MTA/TCT.h +0 -6
- package/svf/include/MemoryModel/PointerAnalysis.h +1 -7
- package/svf/include/SABER/DoubleFreeChecker.h +1 -1
- package/svf/include/SABER/FileChecker.h +1 -1
- package/svf/include/SABER/LeakChecker.h +1 -1
- package/svf/include/SABER/SaberCondAllocator.h +1 -2
- package/svf/include/SABER/SrcSnkDDA.h +2 -2
- package/svf/include/SVFIR/ObjTypeInfo.h +0 -1
- package/svf/include/SVFIR/SVFIR.h +38 -11
- package/svf/include/SVFIR/SVFStatements.h +1 -0
- package/svf/include/SVFIR/SVFValue.h +202 -799
- package/svf/include/Util/CDGBuilder.h +1 -1
- package/svf/include/Util/GeneralType.h +1 -0
- package/svf/include/Util/SVFLoopAndDomInfo.h +169 -0
- package/svf/include/Util/SVFUtil.h +3 -1
- package/svf/include/Util/ThreadAPI.h +2 -1
- package/svf/include/WPA/FlowSensitive.h +1 -1
- package/svf/lib/DDA/DDAPass.cpp +7 -7
- package/svf/lib/Graphs/ConsG.cpp +1 -1
- package/svf/lib/Graphs/ICFG.cpp +0 -1
- package/svf/lib/Graphs/SVFG.cpp +1 -1
- package/svf/lib/Graphs/SVFGReadWrite.cpp +0 -1
- package/svf/lib/Graphs/ThreadCallGraph.cpp +0 -1
- package/svf/lib/Graphs/VFG.cpp +0 -1
- package/svf/lib/MSSA/MemRegion.cpp +0 -1
- package/svf/lib/MSSA/SVFGBuilder.cpp +0 -1
- package/svf/lib/MTA/MTA.cpp +4 -4
- package/svf/lib/MemoryModel/PointerAnalysis.cpp +5 -6
- package/svf/lib/MemoryModel/PointerAnalysisImpl.cpp +1 -1
- package/svf/lib/SABER/SaberCondAllocator.cpp +1 -1
- package/svf/lib/SABER/SrcSnkDDA.cpp +4 -4
- package/svf/lib/SVFIR/SVFIR.cpp +3 -3
- package/svf/lib/SVFIR/SVFValue.cpp +2 -58
- package/svf/lib/Util/CDGBuilder.cpp +2 -3
- package/svf/lib/Util/SVFStat.cpp +1 -1
- package/svf/lib/Util/ThreadAPI.cpp +2 -2
- package/svf/lib/WPA/FlowSensitive.cpp +0 -1
- package/svf/lib/WPA/WPAPass.cpp +0 -1
- package/svf-llvm/include/SVF-LLVM/BreakConstantExpr.h +1 -1
- package/svf-llvm/include/SVF-LLVM/CppUtil.h +1 -1
- package/svf-llvm/include/SVF-LLVM/DCHG.h +1 -1
- package/svf-llvm/include/SVF-LLVM/LLVMLoopAnalysis.h +1 -1
- package/svf-llvm/include/SVF-LLVM/LLVMModule.h +2 -2
- package/svf-llvm/include/SVF-LLVM/LLVMUtil.h +1 -1
- package/svf-llvm/include/SVF-LLVM/ObjTypeInference.h +1 -1
- package/{svf/include/SVFIR → svf-llvm/include/SVF-LLVM}/SVFModule.h +1 -36
- package/svf-llvm/include/SVF-LLVM/SVFValue.h +805 -0
- package/svf-llvm/lib/CHGBuilder.cpp +1 -1
- package/svf-llvm/lib/LLVMLoopAnalysis.cpp +2 -2
- package/svf-llvm/lib/LLVMModule.cpp +10 -6
- package/svf-llvm/lib/SVFIRBuilder.cpp +6 -9
- package/{svf/lib/SVFIR → svf-llvm/lib}/SVFModule.cpp +1 -2
- package/svf-llvm/lib/SVFValue.cpp +71 -0
- package/svf-llvm/lib/SymbolTableBuilder.cpp +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1044",
|
|
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": {
|
|
@@ -48,11 +48,11 @@ namespace SVF
|
|
|
48
48
|
class DDAClient
|
|
49
49
|
{
|
|
50
50
|
public:
|
|
51
|
-
DDAClient(
|
|
51
|
+
DDAClient() : pag(nullptr), curPtr(0), solveAll(true) {}
|
|
52
52
|
|
|
53
53
|
virtual ~DDAClient() {}
|
|
54
54
|
|
|
55
|
-
virtual inline void initialise(
|
|
55
|
+
virtual inline void initialise() {}
|
|
56
56
|
|
|
57
57
|
/// Collect candidate pointers for query.
|
|
58
58
|
virtual inline OrderedNodeSet& collectCandidateQueries(SVFIR* p)
|
|
@@ -91,16 +91,12 @@ public:
|
|
|
91
91
|
userInput.insert(ptr);
|
|
92
92
|
solveAll = false;
|
|
93
93
|
}
|
|
94
|
-
|
|
95
|
-
inline SVFModule* getModule() const
|
|
96
|
-
{
|
|
97
|
-
return module;
|
|
98
|
-
}
|
|
94
|
+
|
|
99
95
|
virtual void answerQueries(PointerAnalysis* pta);
|
|
100
96
|
|
|
101
97
|
virtual inline void performStat(PointerAnalysis*) {}
|
|
102
98
|
|
|
103
|
-
virtual inline void collectWPANum(
|
|
99
|
+
virtual inline void collectWPANum() {}
|
|
104
100
|
protected:
|
|
105
101
|
void addCandidate(NodeID id)
|
|
106
102
|
{
|
|
@@ -109,7 +105,6 @@ protected:
|
|
|
109
105
|
}
|
|
110
106
|
|
|
111
107
|
SVFIR* pag; ///< SVFIR graph used by current DDA analysis
|
|
112
|
-
SVFModule* module; ///< LLVM module
|
|
113
108
|
NodeID curPtr; ///< current pointer being queried
|
|
114
109
|
OrderedNodeSet candidateQueries; ///< store all candidate pointers to be queried
|
|
115
110
|
|
|
@@ -128,7 +123,7 @@ private:
|
|
|
128
123
|
typedef OrderedMap<NodeID,const CallICFGNode*> VTablePtrToCallSiteMap;
|
|
129
124
|
VTablePtrToCallSiteMap vtableToCallSiteMap;
|
|
130
125
|
public:
|
|
131
|
-
FunptrDDAClient(
|
|
126
|
+
FunptrDDAClient() : DDAClient() {}
|
|
132
127
|
~FunptrDDAClient() {}
|
|
133
128
|
|
|
134
129
|
/// Only collect function pointers as query candidates.
|
|
@@ -147,7 +142,7 @@ class AliasDDAClient : public DDAClient
|
|
|
147
142
|
public:
|
|
148
143
|
typedef OrderedSet<const PAGNode*> PAGNodeSet;
|
|
149
144
|
|
|
150
|
-
AliasDDAClient(
|
|
145
|
+
AliasDDAClient() : DDAClient() {}
|
|
151
146
|
~AliasDDAClient() {}
|
|
152
147
|
|
|
153
148
|
/// Only collect function pointers as query candidates.
|
package/svf/include/Graphs/CHG.h
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
#ifndef CHA_H_
|
|
34
34
|
#define CHA_H_
|
|
35
35
|
|
|
36
|
-
#include "
|
|
36
|
+
#include "Util/ThreadAPI.h"
|
|
37
37
|
#include "Graphs/GenericGraph.h"
|
|
38
38
|
#include "Util/WorkList.h"
|
|
39
39
|
|
|
@@ -252,7 +252,7 @@ public:
|
|
|
252
252
|
DESTRUCTOR = 0x2 // connect node based on destructor
|
|
253
253
|
} RELATIONTYPE;
|
|
254
254
|
|
|
255
|
-
CHGraph(
|
|
255
|
+
CHGraph(): classNum(0), vfID(0), buildingCHGTime(0)
|
|
256
256
|
{
|
|
257
257
|
this->kind = Standard;
|
|
258
258
|
}
|
|
@@ -318,7 +318,6 @@ public:
|
|
|
318
318
|
|
|
319
319
|
|
|
320
320
|
private:
|
|
321
|
-
SVFModule* svfMod;
|
|
322
321
|
u32_t classNum;
|
|
323
322
|
u32_t vfID;
|
|
324
323
|
double buildingCHGTime;
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
#include "SVFIR/SVFType.h"
|
|
34
34
|
#include "Util/iterator.h"
|
|
35
35
|
#include "Graphs/GraphTraits.h"
|
|
36
|
+
#include "SVFIR/SVFValue.h"
|
|
36
37
|
|
|
37
38
|
namespace SVF
|
|
38
39
|
{
|
|
@@ -134,292 +135,6 @@ protected:
|
|
|
134
135
|
};
|
|
135
136
|
|
|
136
137
|
|
|
137
|
-
class SVFBaseNode
|
|
138
|
-
{
|
|
139
|
-
|
|
140
|
-
public:
|
|
141
|
-
|
|
142
|
-
enum GNodeK
|
|
143
|
-
{
|
|
144
|
-
// ┌─────────────────────────────────────────────────────────────────────────┐
|
|
145
|
-
// │ ICFGNode: Classes of inter-procedural and intra-procedural control flow │
|
|
146
|
-
// │ graph nodes (Parent class: ICFGNode) │
|
|
147
|
-
// └─────────────────────────────────────────────────────────────────────────┘
|
|
148
|
-
IntraBlock, // ├── Represents a node within a single procedure
|
|
149
|
-
GlobalBlock, // ├── Represents a global-level block
|
|
150
|
-
// │ └─ Subclass: InterICFGNode
|
|
151
|
-
FunEntryBlock, // │ ├── Entry point of a function
|
|
152
|
-
FunExitBlock, // │ ├── Exit point of a function
|
|
153
|
-
FunCallBlock, // │ ├── Call site in the function
|
|
154
|
-
FunRetBlock, // │ └── Return site in the function
|
|
155
|
-
|
|
156
|
-
// ┌─────────────────────────────────────────────────────────────────────────┐
|
|
157
|
-
// │ SVFVar: Classes of variable nodes (Parent class: SVFVar) │
|
|
158
|
-
// │ Includes two main subclasses: ValVar and ObjVar │
|
|
159
|
-
// └─────────────────────────────────────────────────────────────────────────┘
|
|
160
|
-
// └─ Subclass: ValVar (Top-level variable nodes)
|
|
161
|
-
ValNode, // ├── Represents a standard value variable
|
|
162
|
-
ArgValNode, // ├── Represents an argument value variable
|
|
163
|
-
FunValNode, // ├── Represents a function value variable
|
|
164
|
-
GepValNode, // ├── Represents a GEP value variable
|
|
165
|
-
RetValNode, // ├── Represents a return value node
|
|
166
|
-
VarargValNode, // ├── Represents a variadic argument node
|
|
167
|
-
GlobalValNode, // ├── Represents a global variable node
|
|
168
|
-
ConstAggValNode, // ├── Represents a constant aggregate value node
|
|
169
|
-
// │ └─ Subclass: ConstDataValVar
|
|
170
|
-
ConstDataValNode, // │ ├── Represents a constant data variable
|
|
171
|
-
BlackHoleValNode, // │ ├── Represents a black hole node
|
|
172
|
-
ConstFPValNode, // │ ├── Represents a constant floating-point value node
|
|
173
|
-
ConstIntValNode, // │ ├── Represents a constant integer value node
|
|
174
|
-
ConstNullptrValNode, // │ └── Represents a constant nullptr value node
|
|
175
|
-
// │ └─ Subclass: DummyValVar
|
|
176
|
-
DummyValNode, // │ └── Dummy node for uninitialized values
|
|
177
|
-
|
|
178
|
-
// └─ Subclass: ObjVar (Object variable nodes)
|
|
179
|
-
ObjNode, // ├── Represents an object variable
|
|
180
|
-
// │ └─ Subclass: GepObjVar
|
|
181
|
-
GepObjNode, // │ ├── Represents a GEP object variable
|
|
182
|
-
// │ └─ Subclass: BaseObjVar
|
|
183
|
-
BaseObjNode, // │ ├── Represents a base object node
|
|
184
|
-
FunObjNode, // │ ├── Represents a function object
|
|
185
|
-
HeapObjNode, // │ ├── Represents a heap object
|
|
186
|
-
StackObjNode, // │ ├── Represents a stack object
|
|
187
|
-
GlobalObjNode, // │ ├── Represents a global object
|
|
188
|
-
ConstAggObjNode, // │ ├── Represents a constant aggregate object
|
|
189
|
-
// │ └─ Subclass: ConstDataObjVar
|
|
190
|
-
ConstDataObjNode, // │ ├── Represents a constant data object
|
|
191
|
-
ConstFPObjNode, // │ ├── Represents a constant floating-point object
|
|
192
|
-
ConstIntObjNode, // │ ├── Represents a constant integer object
|
|
193
|
-
ConstNullptrObjNode, // │ └── Represents a constant nullptr object
|
|
194
|
-
// │ └─ Subclass: DummyObjVar
|
|
195
|
-
DummyObjNode, // │ └── Dummy node for uninitialized objects
|
|
196
|
-
|
|
197
|
-
// ┌─────────────────────────────────────────────────────────────────────────┐
|
|
198
|
-
// │ VFGNode: Classes of Value Flow Graph (VFG) node kinds (Parent class: │
|
|
199
|
-
// │ VFGNode) │
|
|
200
|
-
// │ Includes operation nodes and specialized subclasses │
|
|
201
|
-
// └─────────────────────────────────────────────────────────────────────────┘
|
|
202
|
-
Cmp, // ├── Represents a comparison operation
|
|
203
|
-
BinaryOp, // ├── Represents a binary operation
|
|
204
|
-
UnaryOp, // ├── Represents a unary operation
|
|
205
|
-
Branch, // ├── Represents a branch operation
|
|
206
|
-
DummyVProp, // ├── Dummy node for value propagation
|
|
207
|
-
NPtr, // ├── Represents a null pointer operation
|
|
208
|
-
// │ └─ Subclass: ArgumentVFGNode
|
|
209
|
-
FRet, // │ ├── Represents a function return value
|
|
210
|
-
ARet, // │ ├── Represents an argument return value
|
|
211
|
-
AParm, // │ ├── Represents an argument parameter
|
|
212
|
-
FParm, // │ └── Represents a function parameter
|
|
213
|
-
// │ └─ Subclass: StmtVFGNode
|
|
214
|
-
Addr, // │ ├── Represents an address operation
|
|
215
|
-
Copy, // │ ├── Represents a copy operation
|
|
216
|
-
Gep, // │ ├── Represents a GEP operation
|
|
217
|
-
Store, // │ ├── Represents a store operation
|
|
218
|
-
Load, // │ └── Represents a load operation
|
|
219
|
-
// │ └─ Subclass: PHIVFGNode
|
|
220
|
-
TPhi, // │ ├── Represents a type-based PHI node
|
|
221
|
-
TIntraPhi, // │ ├── Represents an intra-procedural PHI node
|
|
222
|
-
TInterPhi, // │ └── Represents an inter-procedural PHI node
|
|
223
|
-
// │ └─ Subclass: MRSVFGNode
|
|
224
|
-
FPIN, // │ ├── Function parameter input
|
|
225
|
-
FPOUT, // │ ├── Function parameter output
|
|
226
|
-
APIN, // │ ├── Argument parameter input
|
|
227
|
-
APOUT, // │ └── Argument parameter output
|
|
228
|
-
// │ └─ Subclass: MSSAPHISVFGNode
|
|
229
|
-
MPhi, // │ ├── Memory PHI node
|
|
230
|
-
MIntraPhi, // │ ├── Intra-procedural memory PHI node
|
|
231
|
-
MInterPhi, // │ └── Inter-procedural memory PHI node
|
|
232
|
-
|
|
233
|
-
// ┌─────────────────────────────────────────────────────────────────────────┐
|
|
234
|
-
// │ Additional specific graph node types │
|
|
235
|
-
// └─────────────────────────────────────────────────────────────────────────┘
|
|
236
|
-
CallNodeKd, // Callgraph node
|
|
237
|
-
CDNodeKd, // Control dependence graph node
|
|
238
|
-
CFLNodeKd, // CFL graph node
|
|
239
|
-
CHNodeKd, // Class hierarchy graph node
|
|
240
|
-
ConstraintNodeKd, // Constraint graph node
|
|
241
|
-
TCTNodeKd, // Thread creation tree node
|
|
242
|
-
DCHNodeKd, // DCHG node
|
|
243
|
-
BasicBlockKd, // Basic block node
|
|
244
|
-
OtherKd // Other node kind
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
SVFBaseNode(NodeID i, GNodeK k, const SVFType* ty = nullptr): id(i),nodeKind(k), type(ty)
|
|
249
|
-
{
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/// Get ID
|
|
254
|
-
inline NodeID getId() const
|
|
255
|
-
{
|
|
256
|
-
return id;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/// Get node kind
|
|
260
|
-
inline GNodeK getNodeKind() const
|
|
261
|
-
{
|
|
262
|
-
return nodeKind;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
virtual const SVFType* getType() const
|
|
266
|
-
{
|
|
267
|
-
return type;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
inline virtual void setName(const std::string& nameInfo)
|
|
271
|
-
{
|
|
272
|
-
name = nameInfo;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
inline virtual void setName(std::string&& nameInfo)
|
|
276
|
-
{
|
|
277
|
-
name = std::move(nameInfo);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
virtual const std::string& getName() const
|
|
281
|
-
{
|
|
282
|
-
return name;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
inline virtual void setSourceLoc(const std::string& sourceCodeInfo)
|
|
286
|
-
{
|
|
287
|
-
sourceLoc = sourceCodeInfo;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
virtual const std::string getSourceLoc() const
|
|
291
|
-
{
|
|
292
|
-
return sourceLoc;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
const std::string valueOnlyToString() const;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
protected:
|
|
299
|
-
NodeID id; ///< Node ID
|
|
300
|
-
GNodeK nodeKind; ///< Node kind
|
|
301
|
-
const SVFType* type; ///< SVF type
|
|
302
|
-
|
|
303
|
-
std::string name;
|
|
304
|
-
std::string sourceLoc; ///< Source code information of this value
|
|
305
|
-
|
|
306
|
-
/// Helper functions to check node kinds
|
|
307
|
-
//{@ Check node kind
|
|
308
|
-
static inline bool isICFGNodeKinds(GNodeK n)
|
|
309
|
-
{
|
|
310
|
-
static_assert(FunRetBlock - IntraBlock == 5,
|
|
311
|
-
"the number of ICFGNodeKinds has changed, make sure "
|
|
312
|
-
"the range is correct");
|
|
313
|
-
return n <= FunRetBlock && n >= IntraBlock;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
static inline bool isInterICFGNodeKind(GNodeK n)
|
|
317
|
-
{
|
|
318
|
-
static_assert(FunRetBlock - FunEntryBlock == 3,
|
|
319
|
-
"the number of InterICFGNodeKind has changed, make sure "
|
|
320
|
-
"the range is correct");
|
|
321
|
-
return n <= FunRetBlock && n >= FunEntryBlock;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
static inline bool isSVFVarKind(GNodeK n)
|
|
325
|
-
{
|
|
326
|
-
static_assert(DummyObjNode - ValNode == 26,
|
|
327
|
-
"The number of SVFVarKinds has changed, make sure the "
|
|
328
|
-
"range is correct");
|
|
329
|
-
|
|
330
|
-
return n <= DummyObjNode && n >= ValNode;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
static inline bool isValVarKinds(GNodeK n)
|
|
334
|
-
{
|
|
335
|
-
static_assert(DummyValNode - ValNode == 13,
|
|
336
|
-
"The number of ValVarKinds has changed, make sure the "
|
|
337
|
-
"range is correct");
|
|
338
|
-
return n <= DummyValNode && n >= ValNode;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
static inline bool isConstantDataValVar(GNodeK n)
|
|
343
|
-
{
|
|
344
|
-
static_assert(ConstNullptrValNode - ConstDataValNode == 4,
|
|
345
|
-
"The number of ConstantDataValVarKinds has changed, make "
|
|
346
|
-
"sure the range is correct");
|
|
347
|
-
return n <= ConstNullptrValNode && n >= ConstDataValNode;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
static inline bool isObjVarKinds(GNodeK n)
|
|
351
|
-
{
|
|
352
|
-
static_assert(DummyObjNode - ObjNode == 12,
|
|
353
|
-
"The number of ObjVarKinds has changed, make sure the "
|
|
354
|
-
"range is correct");
|
|
355
|
-
return n <= DummyObjNode && n >= ObjNode;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
static inline bool isBaseObjVarKinds(GNodeK n)
|
|
359
|
-
{
|
|
360
|
-
static_assert(DummyObjNode - BaseObjNode == 10,
|
|
361
|
-
"The number of BaseObjVarKinds has changed, make sure the "
|
|
362
|
-
"range is correct");
|
|
363
|
-
return n <= DummyObjNode && n >= BaseObjNode;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
static inline bool isConstantDataObjVarKinds(GNodeK n)
|
|
367
|
-
{
|
|
368
|
-
static_assert(ConstNullptrObjNode - ConstDataObjNode == 3,
|
|
369
|
-
"The number of ConstantDataObjVarKinds has changed, make "
|
|
370
|
-
"sure the range is correct");
|
|
371
|
-
return n <= ConstNullptrObjNode && n >= ConstDataObjNode;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
static inline bool isVFGNodeKinds(GNodeK n)
|
|
375
|
-
{
|
|
376
|
-
static_assert(MInterPhi - Cmp == 24,
|
|
377
|
-
"The number of VFGNodeKinds has changed, make sure the "
|
|
378
|
-
"range is correct");
|
|
379
|
-
return n <= MInterPhi && n >= Cmp;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
static inline bool isArgumentVFGNodeKinds(GNodeK n)
|
|
383
|
-
{
|
|
384
|
-
static_assert(FParm - FRet == 3,
|
|
385
|
-
"The number of ArgumentVFGNodeKinds has changed, make "
|
|
386
|
-
"sure the range is correct");
|
|
387
|
-
return n <= FParm && n >= FRet;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
static inline bool isStmtVFGNodeKinds(GNodeK n)
|
|
391
|
-
{
|
|
392
|
-
static_assert(Load - Addr == 4,
|
|
393
|
-
"The number of StmtVFGNodeKinds has changed, make sure "
|
|
394
|
-
"the range is correct");
|
|
395
|
-
return n <= Load && n >= Addr;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
static inline bool isPHIVFGNodeKinds(GNodeK n)
|
|
399
|
-
{
|
|
400
|
-
static_assert(TInterPhi - TPhi == 2,
|
|
401
|
-
"The number of PHIVFGNodeKinds has changed, make sure "
|
|
402
|
-
"the range is correct");
|
|
403
|
-
return n <= TInterPhi && n >= TPhi;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
static inline bool isMRSVFGNodeKinds(GNodeK n)
|
|
407
|
-
{
|
|
408
|
-
static_assert(MInterPhi - FPIN == 6,
|
|
409
|
-
"The number of MRSVFGNodeKinds has changed, make sure "
|
|
410
|
-
"the range is correct");
|
|
411
|
-
return n <= MInterPhi && n >= FPIN;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
static inline bool isMSSAPHISVFGNodeKinds(GNodeK n)
|
|
415
|
-
{
|
|
416
|
-
static_assert(MInterPhi - MPhi == 2,
|
|
417
|
-
"The number of MSSAPHISVFGNodeKinds has changed, make "
|
|
418
|
-
"sure the range is correct");
|
|
419
|
-
return n <= MInterPhi && n >= MPhi;
|
|
420
|
-
}
|
|
421
|
-
//@}
|
|
422
|
-
};
|
|
423
138
|
|
|
424
139
|
/*!
|
|
425
140
|
* Generic node on the graph as base class
|
package/svf/include/MTA/MTA.h
CHANGED
|
@@ -67,11 +67,11 @@ public:
|
|
|
67
67
|
/// We start the pass here
|
|
68
68
|
virtual bool runOnModule(SVFIR* module);
|
|
69
69
|
/// Compute MHP
|
|
70
|
-
virtual MHP* computeMHP(
|
|
70
|
+
virtual MHP* computeMHP();
|
|
71
71
|
/// Compute locksets
|
|
72
72
|
virtual LockAnalysis* computeLocksets(TCT* tct);
|
|
73
73
|
/// Perform detection
|
|
74
|
-
virtual void detect(
|
|
74
|
+
virtual void detect();
|
|
75
75
|
|
|
76
76
|
// Not implemented for now
|
|
77
77
|
// void dump(Module &module, MHP *mhp, LockAnalysis *lsa);
|
package/svf/include/MTA/TCT.h
CHANGED
|
@@ -139,8 +139,6 @@ protected:
|
|
|
139
139
|
|
|
140
140
|
/// SVFIR
|
|
141
141
|
static SVFIR* pag;
|
|
142
|
-
/// Module
|
|
143
|
-
SVFModule* svfMod;
|
|
144
142
|
/// Pointer analysis Type
|
|
145
143
|
PTATY ptaTy;
|
|
146
144
|
/// PTA implementation type.
|
|
@@ -206,11 +204,7 @@ public:
|
|
|
206
204
|
{
|
|
207
205
|
return stat;
|
|
208
206
|
}
|
|
209
|
-
|
|
210
|
-
inline SVFModule* getModule() const
|
|
211
|
-
{
|
|
212
|
-
return svfMod;
|
|
213
|
-
}
|
|
207
|
+
|
|
214
208
|
/// Get all Valid Pointers for resolution
|
|
215
209
|
inline OrderedNodeSet& getAllValidPtrs()
|
|
216
210
|
{
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
#ifndef PATHALLOCATOR_H_
|
|
31
31
|
#define PATHALLOCATOR_H_
|
|
32
32
|
|
|
33
|
-
#include "SVFIR/SVFModule.h"
|
|
34
33
|
#include "SVFIR/SVFValue.h"
|
|
35
34
|
#include "Util/WorkList.h"
|
|
36
35
|
#include "Graphs/SVFG.h"
|
|
@@ -121,7 +120,7 @@ public:
|
|
|
121
120
|
Condition newCond(const ICFGNode* inst);
|
|
122
121
|
|
|
123
122
|
/// Perform path allocation
|
|
124
|
-
void allocate(
|
|
123
|
+
void allocate();
|
|
125
124
|
|
|
126
125
|
/// Get/Set instruction based on Z3 expression id
|
|
127
126
|
//{@
|
|
@@ -105,10 +105,10 @@ public:
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/// Start analysis here
|
|
108
|
-
virtual void analyze(
|
|
108
|
+
virtual void analyze();
|
|
109
109
|
|
|
110
110
|
/// Initialize analysis
|
|
111
|
-
virtual void initialize(
|
|
111
|
+
virtual void initialize();
|
|
112
112
|
|
|
113
113
|
/// Finalize analysis
|
|
114
114
|
virtual void finalize()
|
|
@@ -93,13 +93,15 @@ private:
|
|
|
93
93
|
/// Valid pointers for pointer analysis resolution connected by SVFIR edges (constraints)
|
|
94
94
|
/// this set of candidate pointers can change during pointer resolution (e.g. adding new object nodes)
|
|
95
95
|
OrderedNodeSet candidatePointers;
|
|
96
|
-
SVFModule* svfModule; /// SVF Module
|
|
97
96
|
ICFG* icfg; // ICFG
|
|
98
97
|
CommonCHGraph* chgraph; // class hierarchy graph
|
|
99
98
|
CallSiteSet callSiteSet; /// all the callsites of a program
|
|
100
99
|
CallGraph* callGraph; /// call graph
|
|
101
100
|
|
|
102
101
|
static std::unique_ptr<SVFIR> pag; ///< Singleton pattern here to enable instance of SVFIR can only be created once.
|
|
102
|
+
static std::string pagReadFromTxt;
|
|
103
|
+
|
|
104
|
+
std::string moduleIdentifier;
|
|
103
105
|
|
|
104
106
|
/// Constructor
|
|
105
107
|
SVFIR(bool buildFromFile);
|
|
@@ -152,16 +154,7 @@ public:
|
|
|
152
154
|
/// Whether to handle blackhole edge
|
|
153
155
|
static void handleBlackHole(bool b);
|
|
154
156
|
//@}
|
|
155
|
-
|
|
156
|
-
inline void setModule(SVFModule* mod)
|
|
157
|
-
{
|
|
158
|
-
svfModule = mod;
|
|
159
|
-
}
|
|
160
|
-
inline SVFModule* getModule()
|
|
161
|
-
{
|
|
162
|
-
assert(svfModule && "empty SVFModule! Build SVF IR first!");
|
|
163
|
-
return svfModule;
|
|
164
|
-
}
|
|
157
|
+
|
|
165
158
|
/// Set/Get ICFG
|
|
166
159
|
inline void setICFG(ICFG* i)
|
|
167
160
|
{
|
|
@@ -196,6 +189,40 @@ public:
|
|
|
196
189
|
|
|
197
190
|
const FunObjVar* getFunObjVar(const std::string& name);
|
|
198
191
|
|
|
192
|
+
inline const std::string& getModuleIdentifier() const
|
|
193
|
+
{
|
|
194
|
+
if (pagReadFromTxt.empty())
|
|
195
|
+
{
|
|
196
|
+
assert(!moduleIdentifier.empty() &&
|
|
197
|
+
"No module found! Reading from a file other than LLVM-IR?");
|
|
198
|
+
return moduleIdentifier;
|
|
199
|
+
}
|
|
200
|
+
else
|
|
201
|
+
{
|
|
202
|
+
return pagReadFromTxt;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
static inline std::string pagFileName()
|
|
207
|
+
{
|
|
208
|
+
return pagReadFromTxt;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
static inline bool pagReadFromTXT()
|
|
212
|
+
{
|
|
213
|
+
return !pagReadFromTxt.empty();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
static inline void setPagFromTXT(const std::string& txt)
|
|
217
|
+
{
|
|
218
|
+
pagReadFromTxt = txt;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
inline void setModuleIdentifier(const std::string& moduleIdentifier)
|
|
222
|
+
{
|
|
223
|
+
this->moduleIdentifier = moduleIdentifier;
|
|
224
|
+
}
|
|
225
|
+
|
|
199
226
|
/// Get/set methods to get SVFStmts based on their kinds and ICFGNodes
|
|
200
227
|
//@{
|
|
201
228
|
/// Get edges set according to its kind
|