svf-lib 1.0.2161 → 1.0.2163
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/DDA/DDAVFSolver.h +5 -4
- package/SVF-linux/Release-build/include/Graphs/GenericGraph.h +62 -101
- package/SVF-linux/Release-build/include/MemoryModel/PointerAnalysis.h +2 -4
- package/SVF-linux/Release-build/include/SVF-LLVM/LLVMUtil.h +3 -0
- package/SVF-linux/Release-build/include/SVFIR/SVFFileSystem.h +3 -3
- package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +35 -0
- package/SVF-linux/Release-build/include/SVFIR/SVFVariables.h +153 -22
- package/SVF-linux/Release-build/include/Util/SVFUtil.h +0 -2
- 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/lib/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -471,9 +471,11 @@ protected:
|
|
|
471
471
|
virtual inline bool isLocalCVarInRecursion(const CVar& var) const
|
|
472
472
|
{
|
|
473
473
|
NodeID id = getPtrNodeID(var);
|
|
474
|
+
const BaseObjVar* baseObj = _pag->getBaseObject(id);
|
|
475
|
+
assert(baseObj && "base object is null??");
|
|
474
476
|
const MemObj* obj = _pag->getObject(id);
|
|
475
477
|
assert(obj && "object not found!!");
|
|
476
|
-
if(
|
|
478
|
+
if(SVFUtil::isa<StackObjVar>(baseObj))
|
|
477
479
|
{
|
|
478
480
|
if(const SVFFunction* svffun = _pag->getGNode(id)->getFunction())
|
|
479
481
|
{
|
|
@@ -637,9 +639,8 @@ protected:
|
|
|
637
639
|
//@{
|
|
638
640
|
virtual inline bool isHeapCondMemObj(const CVar& var, const StoreSVFGNode*)
|
|
639
641
|
{
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
return mem->isHeap();
|
|
642
|
+
const BaseObjVar* pVar = _pag->getBaseObject(getPtrNodeID(var));
|
|
643
|
+
return pVar && SVFUtil::isa<HeapObjVar, DummyObjVar>(pVar);
|
|
643
644
|
}
|
|
644
645
|
|
|
645
646
|
inline bool isArrayCondMemObj(const CVar& var) const
|
|
@@ -141,105 +141,66 @@ public:
|
|
|
141
141
|
|
|
142
142
|
enum GNodeK
|
|
143
143
|
{
|
|
144
|
-
// ┌──
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
// │
|
|
148
|
-
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
// │ ├── Exit point of a function
|
|
153
|
-
FunExitBlock,
|
|
154
|
-
// │ ├── Call site in the function
|
|
155
|
-
FunCallBlock,
|
|
156
|
-
// │ └── Return site in the function
|
|
157
|
-
FunRetBlock,
|
|
144
|
+
// ┌── ICFGNode: Classes of inter-procedural and intra-procedural control flow graph nodes
|
|
145
|
+
IntraBlock, // ├──Represents a node within a single procedure
|
|
146
|
+
GlobalBlock, // ├──Represents a global-level block
|
|
147
|
+
// │ └─ InterICFGNode: Classes of inter-procedural control flow graph nodes
|
|
148
|
+
FunEntryBlock, // ├──Entry point of a function
|
|
149
|
+
FunExitBlock, // ├──Exit point of a function
|
|
150
|
+
FunCallBlock, // ├──Call site in the function
|
|
151
|
+
FunRetBlock, // ├──Return site in the function
|
|
158
152
|
// └────────
|
|
159
153
|
|
|
160
|
-
// ┌──
|
|
161
|
-
// │
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
//
|
|
165
|
-
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
// │
|
|
169
|
-
|
|
170
|
-
//
|
|
171
|
-
|
|
172
|
-
//
|
|
173
|
-
|
|
174
|
-
//
|
|
175
|
-
//
|
|
176
|
-
|
|
177
|
-
// │ ├── GepObjNode: Represents a GEP object variable
|
|
178
|
-
GepObjNode,
|
|
179
|
-
// │ └── FIObjNode: Represents a flow-insensitive object node
|
|
180
|
-
FIObjNode,
|
|
181
|
-
// │ ├──FunObjNode: Types of function object
|
|
182
|
-
FunObjNode,
|
|
183
|
-
// │ └── DummyObjNode: Dummy node for uninitialized objects
|
|
184
|
-
DummyObjNode,
|
|
154
|
+
// ┌── SVFVar: Classes of top-level variables (ValVar) and address-taken variables (ObjVar)
|
|
155
|
+
// │ └── ValVar: Classes of top-level variable nodes
|
|
156
|
+
ValNode, // ├──Represents a standard value variable
|
|
157
|
+
FunValNode, // ├──Represents a Function value variable
|
|
158
|
+
GepValNode, // ├──Represents a GEP value variable
|
|
159
|
+
RetNode, // ├──Represents a return value node
|
|
160
|
+
VarargNode, // ├──Represents a variadic argument node
|
|
161
|
+
DummyValNode, // ├──Dummy node for uninitialized values
|
|
162
|
+
// │ └── ObjVar: Classes of object variable nodes
|
|
163
|
+
ObjNode, // ├──Represents an object variable
|
|
164
|
+
GepObjNode, // ├──Represents a GEP object variable
|
|
165
|
+
// │ └── BaseObjVar: Classes of base object nodes
|
|
166
|
+
BaseObjNode, // ├──Represents a base object node
|
|
167
|
+
FunObjNode, // ├──Types of function object
|
|
168
|
+
HeapObjNode, // ├──Types of heap object
|
|
169
|
+
StackObjNode, // ├──Types of stack object
|
|
170
|
+
DummyObjNode, // ├──Dummy node for uninitialized objects
|
|
185
171
|
// └────────
|
|
186
172
|
|
|
187
|
-
// ┌──
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
//
|
|
193
|
-
|
|
194
|
-
// │
|
|
195
|
-
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
//
|
|
199
|
-
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
|
|
203
|
-
//
|
|
204
|
-
|
|
205
|
-
// │
|
|
206
|
-
|
|
207
|
-
//
|
|
208
|
-
|
|
209
|
-
// │ └──
|
|
210
|
-
//
|
|
211
|
-
|
|
212
|
-
//
|
|
213
|
-
|
|
214
|
-
// │
|
|
215
|
-
|
|
216
|
-
//
|
|
217
|
-
|
|
218
|
-
// │ └── Represents a load operation
|
|
219
|
-
Load,
|
|
220
|
-
// │ └── PHIVFGNodeKinds: Types of PHI nodes in VFG
|
|
221
|
-
// │ ├── Represents a type-based PHI node
|
|
222
|
-
TPhi,
|
|
223
|
-
// │ ├── Represents an intra-procedural PHI node
|
|
224
|
-
TIntraPhi,
|
|
225
|
-
// │ └── Represents an inter-procedural PHI node
|
|
226
|
-
TInterPhi,
|
|
227
|
-
// │ └── MRSVFGNodeKinds: Memory-related SVFG nodes
|
|
228
|
-
// │ ├── Function parameter input
|
|
229
|
-
FPIN,
|
|
230
|
-
// │ ├── Function parameter output
|
|
231
|
-
FPOUT,
|
|
232
|
-
// │ ├── Argument parameter input
|
|
233
|
-
APIN,
|
|
234
|
-
// │ └── Argument parameter output
|
|
235
|
-
APOUT,
|
|
236
|
-
// │ └── MSSAPHISVFGNodeKinds: Mem SSA PHI nodes for SVFG
|
|
237
|
-
// │ ├── Memory PHI node
|
|
238
|
-
MPhi,
|
|
239
|
-
// │ ├── Intra-procedural memory PHI node
|
|
240
|
-
MIntraPhi,
|
|
241
|
-
// │ └── MInterPhi: Inter-procedural memory PHI node
|
|
242
|
-
MInterPhi,
|
|
173
|
+
// ┌── VFGNode: Classes of Value Flow Graph (VFG) node kinds with operations
|
|
174
|
+
Cmp, // ├──Represents a comparison operation
|
|
175
|
+
BinaryOp, // ├──Represents a binary operation
|
|
176
|
+
UnaryOp, // ├──Represents a unary operation
|
|
177
|
+
Branch, // ├──Represents a branch operation
|
|
178
|
+
DummyVProp, // ├──Dummy node for value propagation
|
|
179
|
+
NPtr, // ├──Represents a null pointer operation
|
|
180
|
+
// │ └── ArgumentVFGNode: Classes of argument nodes in VFG
|
|
181
|
+
FRet, // ├──Represents a function return value
|
|
182
|
+
ARet, // ├──Represents an argument return value
|
|
183
|
+
AParm, // ├──Represents an argument parameter
|
|
184
|
+
FParm, // ├──Represents a function parameter
|
|
185
|
+
// │ └── StmtVFGNode: Classes of statement nodes in VFG
|
|
186
|
+
Addr, // ├──Represents an address operation
|
|
187
|
+
Copy, // ├──Represents a copy operation
|
|
188
|
+
Gep, // ├──Represents a GEP operation
|
|
189
|
+
Store, // ├──Represents a store operation
|
|
190
|
+
Load, // ├──Represents a load operation
|
|
191
|
+
// │ └── PHIVFGNode: Classes of PHI nodes in VFG
|
|
192
|
+
TPhi, // ├──Represents a type-based PHI node
|
|
193
|
+
TIntraPhi, // ├──Represents an intra-procedural PHI node
|
|
194
|
+
TInterPhi, // ├──Represents an inter-procedural PHI node
|
|
195
|
+
// │ └── MRSVFGNode: Classes of Memory-related SVFG nodes
|
|
196
|
+
FPIN, // ├──Function parameter input
|
|
197
|
+
FPOUT, // ├──Function parameter output
|
|
198
|
+
APIN, // ├──Argument parameter input
|
|
199
|
+
APOUT, // ├──Argument parameter output
|
|
200
|
+
// │ └── MSSAPHISVFGNode: Classes of Mem SSA PHI nodes for SVFG
|
|
201
|
+
MPhi, // ├──Memory PHI node
|
|
202
|
+
MIntraPhi, // ├──Intra-procedural memory PHI node
|
|
203
|
+
MInterPhi, // ├──Inter-procedural memory PHI node
|
|
243
204
|
// └────────
|
|
244
205
|
|
|
245
206
|
// Additional specific graph node types
|
|
@@ -317,7 +278,7 @@ protected:
|
|
|
317
278
|
|
|
318
279
|
static inline bool isSVFVarKind(GNodeK n)
|
|
319
280
|
{
|
|
320
|
-
static_assert(DummyObjNode - ValNode ==
|
|
281
|
+
static_assert(DummyObjNode - ValNode == 12,
|
|
321
282
|
"The number of SVFVarKinds has changed, make sure the "
|
|
322
283
|
"range is correct");
|
|
323
284
|
|
|
@@ -334,18 +295,18 @@ protected:
|
|
|
334
295
|
|
|
335
296
|
static inline bool isObjVarKinds(GNodeK n)
|
|
336
297
|
{
|
|
337
|
-
static_assert(DummyObjNode - ObjNode ==
|
|
298
|
+
static_assert(DummyObjNode - ObjNode == 6,
|
|
338
299
|
"The number of ObjVarKinds has changed, make sure the "
|
|
339
300
|
"range is correct");
|
|
340
301
|
return n <= DummyObjNode && n >= ObjNode;
|
|
341
302
|
}
|
|
342
303
|
|
|
343
|
-
static inline bool
|
|
304
|
+
static inline bool isBaseObjVarKinds(GNodeK n)
|
|
344
305
|
{
|
|
345
|
-
static_assert(
|
|
346
|
-
"The number of
|
|
306
|
+
static_assert(DummyObjNode - BaseObjNode == 4,
|
|
307
|
+
"The number of BaseObjVarKinds has changed, make sure the "
|
|
347
308
|
"range is correct");
|
|
348
|
-
return n <=
|
|
309
|
+
return n <= DummyObjNode && n >= BaseObjNode;
|
|
349
310
|
}
|
|
350
311
|
|
|
351
312
|
static inline bool isVFGNodeKinds(GNodeK n)
|
|
@@ -304,9 +304,7 @@ public:
|
|
|
304
304
|
//@{
|
|
305
305
|
inline bool isHeapMemObj(NodeID id) const
|
|
306
306
|
{
|
|
307
|
-
|
|
308
|
-
assert(mem && "memory object is null??");
|
|
309
|
-
return mem->isHeap();
|
|
307
|
+
return pag->getBaseObject(id) && SVFUtil::isa<HeapObjVar, DummyObjVar>(pag->getBaseObject(id));
|
|
310
308
|
}
|
|
311
309
|
|
|
312
310
|
inline bool isArrayMemObj(NodeID id) const
|
|
@@ -321,7 +319,7 @@ public:
|
|
|
321
319
|
///@{
|
|
322
320
|
inline bool isFIObjNode(NodeID id) const
|
|
323
321
|
{
|
|
324
|
-
return (SVFUtil::isa<
|
|
322
|
+
return (SVFUtil::isa<BaseObjVar>(pag->getGNode(id)));
|
|
325
323
|
}
|
|
326
324
|
inline NodeID getBaseObjVar(NodeID id)
|
|
327
325
|
{
|
|
@@ -360,6 +360,9 @@ inline bool isHeapAllocExtCall(const Instruction *inst)
|
|
|
360
360
|
return isHeapAllocExtCallViaRet(inst) || isHeapAllocExtCallViaArg(inst);
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
+
// Check if a given value represents a heap object.
|
|
364
|
+
bool isHeapObj(const Value* val);
|
|
365
|
+
|
|
363
366
|
/// Whether an instruction is a callsite in the application code, excluding llvm intrinsic calls
|
|
364
367
|
bool isNonInstricCallSite(const Instruction* inst);
|
|
365
368
|
|
|
@@ -166,7 +166,7 @@ class ValVar;
|
|
|
166
166
|
class ObjVar;
|
|
167
167
|
class GepValVar;
|
|
168
168
|
class GepObjVar;
|
|
169
|
-
class
|
|
169
|
+
class BaseObjVar;
|
|
170
170
|
class RetPN;
|
|
171
171
|
class VarArgPN;
|
|
172
172
|
class DummyValVar;
|
|
@@ -456,7 +456,7 @@ private:
|
|
|
456
456
|
cJSON* contentToJson(const ObjVar* var);
|
|
457
457
|
cJSON* contentToJson(const GepValVar* var);
|
|
458
458
|
cJSON* contentToJson(const GepObjVar* var);
|
|
459
|
-
cJSON* contentToJson(const
|
|
459
|
+
cJSON* contentToJson(const BaseObjVar* var);
|
|
460
460
|
cJSON* contentToJson(const RetPN* var);
|
|
461
461
|
cJSON* contentToJson(const VarArgPN* var);
|
|
462
462
|
cJSON* contentToJson(const DummyValVar* var);
|
|
@@ -1231,7 +1231,7 @@ private:
|
|
|
1231
1231
|
void fill(const cJSON*& fieldJson, ObjVar* var);
|
|
1232
1232
|
void fill(const cJSON*& fieldJson, GepValVar* var);
|
|
1233
1233
|
void fill(const cJSON*& fieldJson, GepObjVar* var);
|
|
1234
|
-
void fill(const cJSON*& fieldJson,
|
|
1234
|
+
void fill(const cJSON*& fieldJson, BaseObjVar* var);
|
|
1235
1235
|
void fill(const cJSON*& fieldJson, RetPN* var);
|
|
1236
1236
|
void fill(const cJSON*& fieldJson, VarArgPN* var);
|
|
1237
1237
|
void fill(const cJSON*& fieldJson, DummyValVar* var);
|
|
@@ -401,6 +401,17 @@ public:
|
|
|
401
401
|
else
|
|
402
402
|
return nullptr;
|
|
403
403
|
}
|
|
404
|
+
|
|
405
|
+
inline const BaseObjVar* getBaseObject(NodeID id) const
|
|
406
|
+
{
|
|
407
|
+
const SVFVar* node = getGNode(id);
|
|
408
|
+
if(const GepObjVar* gepObjVar = SVFUtil::dyn_cast<GepObjVar>(node))
|
|
409
|
+
return SVFUtil::dyn_cast<BaseObjVar>(
|
|
410
|
+
getGNode(gepObjVar->getBaseNode()));
|
|
411
|
+
else
|
|
412
|
+
return SVFUtil::dyn_cast<BaseObjVar>(node);
|
|
413
|
+
}
|
|
414
|
+
|
|
404
415
|
inline const MemObj*getObject(const ObjVar* node) const
|
|
405
416
|
{
|
|
406
417
|
return node->getMemObj();
|
|
@@ -565,6 +576,30 @@ private:
|
|
|
565
576
|
return addFIObjNode(mem);
|
|
566
577
|
}
|
|
567
578
|
|
|
579
|
+
/**
|
|
580
|
+
* Creates and adds a heap object node to the SVFIR
|
|
581
|
+
*/
|
|
582
|
+
inline NodeID addHeapObjNode(const SVFValue* val, const SVFFunction* f, NodeID i)
|
|
583
|
+
{
|
|
584
|
+
const MemObj* mem = getMemObj(val);
|
|
585
|
+
assert(mem->getId() == i && "not same object id?");
|
|
586
|
+
memToFieldsMap[i].set(i);
|
|
587
|
+
HeapObjVar *node = new HeapObjVar(f, val->getType(), i, mem);
|
|
588
|
+
return addObjNode(val, node, i);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Creates and adds a stack object node to the SVFIR
|
|
593
|
+
*/
|
|
594
|
+
inline NodeID addStackObjNode(const SVFValue* val, const SVFFunction* f, NodeID i)
|
|
595
|
+
{
|
|
596
|
+
const MemObj* mem = getMemObj(val);
|
|
597
|
+
assert(mem->getId() == i && "not same object id?");
|
|
598
|
+
memToFieldsMap[i].set(i);
|
|
599
|
+
StackObjVar *node = new StackObjVar(f, val->getType(), i, mem);
|
|
600
|
+
return addObjNode(val, node, i);
|
|
601
|
+
}
|
|
602
|
+
|
|
568
603
|
NodeID addFunObjNode(const CallGraphNode* callGraphNode, NodeID id);
|
|
569
604
|
/// Add a unique return node for a procedure
|
|
570
605
|
inline NodeID addRetNode(const CallGraphNode* callGraphNode, NodeID i)
|
|
@@ -58,7 +58,7 @@ public:
|
|
|
58
58
|
/// Vararg: unique node for vararg parameter
|
|
59
59
|
/// GepValNode: temporary gep value node for field sensitivity
|
|
60
60
|
/// GepValNode: temporary gep obj node for field sensitivity
|
|
61
|
-
///
|
|
61
|
+
/// BaseObjNode: for field insensitive analysis
|
|
62
62
|
/// DummyValNode and DummyObjNode: for non-llvm-value node
|
|
63
63
|
typedef GNodeK PNODEK;
|
|
64
64
|
typedef s64_t GEdgeKind;
|
|
@@ -68,6 +68,7 @@ protected:
|
|
|
68
68
|
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap;
|
|
69
69
|
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap;
|
|
70
70
|
bool isPtr; /// whether it is a pointer (top-level or address-taken)
|
|
71
|
+
const SVFFunction* func; /// function containing this variable
|
|
71
72
|
|
|
72
73
|
/// Constructor to create an empty object (for deserialization)
|
|
73
74
|
SVFVar(NodeID i, PNODEK k) : GenericPAGNodeTy(i, k), value{} {}
|
|
@@ -117,16 +118,29 @@ public:
|
|
|
117
118
|
// TODO: (Optimization) Should it return const reference instead of value?
|
|
118
119
|
virtual const std::string getValueName() const = 0;
|
|
119
120
|
|
|
120
|
-
/// Return the function
|
|
121
|
+
/// Return the function containing this SVFVar
|
|
122
|
+
/// @return The SVFFunction containing this variable, or nullptr if it's a global/constant expression
|
|
121
123
|
virtual inline const SVFFunction* getFunction() const
|
|
122
124
|
{
|
|
125
|
+
// Return cached function if available
|
|
126
|
+
if(func) return func;
|
|
127
|
+
|
|
128
|
+
// If we have an associated LLVM value, check its parent function
|
|
123
129
|
if (value)
|
|
124
130
|
{
|
|
131
|
+
// For instructions, return the function containing the parent basic block
|
|
125
132
|
if (auto inst = SVFUtil::dyn_cast<SVFInstruction>(value))
|
|
133
|
+
{
|
|
126
134
|
return inst->getParent()->getParent();
|
|
135
|
+
}
|
|
136
|
+
// For function arguments, return their parent function
|
|
127
137
|
else if (auto arg = SVFUtil::dyn_cast<SVFArgument>(value))
|
|
138
|
+
{
|
|
128
139
|
return arg->getParent();
|
|
140
|
+
}
|
|
129
141
|
}
|
|
142
|
+
|
|
143
|
+
// Return nullptr for globals/constants with no parent function
|
|
130
144
|
return nullptr;
|
|
131
145
|
}
|
|
132
146
|
|
|
@@ -532,43 +546,43 @@ public:
|
|
|
532
546
|
* Field-insensitive Gep Obj variable, this is dynamic generated for field sensitive analysis
|
|
533
547
|
* Each field-insensitive gep obj node represents all fields of a MemObj (base)
|
|
534
548
|
*/
|
|
535
|
-
class
|
|
549
|
+
class BaseObjVar : public ObjVar
|
|
536
550
|
{
|
|
537
551
|
friend class SVFIRWriter;
|
|
538
552
|
friend class SVFIRReader;
|
|
539
553
|
|
|
540
554
|
protected:
|
|
541
555
|
/// Constructor to create empty ObjVar (for SVFIRReader/deserialization)
|
|
542
|
-
|
|
556
|
+
BaseObjVar(NodeID i, PNODEK ty = BaseObjNode) : ObjVar(i, ty) {}
|
|
543
557
|
|
|
544
558
|
public:
|
|
545
559
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
546
560
|
//@{
|
|
547
|
-
static inline bool classof(const
|
|
561
|
+
static inline bool classof(const BaseObjVar*)
|
|
548
562
|
{
|
|
549
563
|
return true;
|
|
550
564
|
}
|
|
551
565
|
static inline bool classof(const ObjVar* node)
|
|
552
566
|
{
|
|
553
|
-
return
|
|
567
|
+
return isBaseObjVarKinds(node->getNodeKind());
|
|
554
568
|
}
|
|
555
569
|
static inline bool classof(const SVFVar* node)
|
|
556
570
|
{
|
|
557
|
-
return
|
|
571
|
+
return isBaseObjVarKinds(node->getNodeKind());
|
|
558
572
|
}
|
|
559
573
|
static inline bool classof(const GenericPAGNodeTy* node)
|
|
560
574
|
{
|
|
561
|
-
return
|
|
575
|
+
return isBaseObjVarKinds(node->getNodeKind());
|
|
562
576
|
}
|
|
563
577
|
static inline bool classof(const SVFBaseNode* node)
|
|
564
578
|
{
|
|
565
|
-
return
|
|
579
|
+
return isBaseObjVarKinds(node->getNodeKind());
|
|
566
580
|
}
|
|
567
581
|
//@}
|
|
568
582
|
|
|
569
583
|
/// Constructor
|
|
570
|
-
|
|
571
|
-
|
|
584
|
+
BaseObjVar(const SVFValue* val, NodeID i, const MemObj* mem,
|
|
585
|
+
PNODEK ty = BaseObjNode)
|
|
572
586
|
: ObjVar(val, i, mem, ty)
|
|
573
587
|
{
|
|
574
588
|
}
|
|
@@ -584,6 +598,127 @@ public:
|
|
|
584
598
|
virtual const std::string toString() const;
|
|
585
599
|
};
|
|
586
600
|
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* @brief Class representing a heap object variable in the SVFIR
|
|
604
|
+
*
|
|
605
|
+
* This class models heap-allocated objects in the program analysis. It extends BaseObjVar
|
|
606
|
+
* to specifically handle heap memory locations.
|
|
607
|
+
*/
|
|
608
|
+
class HeapObjVar: public BaseObjVar
|
|
609
|
+
{
|
|
610
|
+
|
|
611
|
+
friend class SVFIRWriter;
|
|
612
|
+
friend class SVFIRReader;
|
|
613
|
+
|
|
614
|
+
protected:
|
|
615
|
+
/// Constructor to create heap object var
|
|
616
|
+
HeapObjVar(NodeID i, PNODEK ty = HeapObjNode) : BaseObjVar(i, ty) {}
|
|
617
|
+
|
|
618
|
+
public:
|
|
619
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
620
|
+
//@{
|
|
621
|
+
static inline bool classof(const HeapObjVar*)
|
|
622
|
+
{
|
|
623
|
+
return true;
|
|
624
|
+
}
|
|
625
|
+
static inline bool classof(const BaseObjVar* node)
|
|
626
|
+
{
|
|
627
|
+
return node->getNodeKind() == HeapObjNode;
|
|
628
|
+
}
|
|
629
|
+
static inline bool classof(const ObjVar* node)
|
|
630
|
+
{
|
|
631
|
+
return node->getNodeKind() == HeapObjNode;
|
|
632
|
+
}
|
|
633
|
+
static inline bool classof(const SVFVar* node)
|
|
634
|
+
{
|
|
635
|
+
return node->getNodeKind() == HeapObjNode;
|
|
636
|
+
}
|
|
637
|
+
static inline bool classof(const GenericPAGNodeTy* node)
|
|
638
|
+
{
|
|
639
|
+
return node->getNodeKind() == HeapObjNode;
|
|
640
|
+
}
|
|
641
|
+
static inline bool classof(const SVFBaseNode* node)
|
|
642
|
+
{
|
|
643
|
+
return node->getNodeKind() == HeapObjNode;
|
|
644
|
+
}
|
|
645
|
+
//@}
|
|
646
|
+
|
|
647
|
+
/// Constructor
|
|
648
|
+
HeapObjVar(const SVFFunction* func, const SVFType* svfType, NodeID i,
|
|
649
|
+
const MemObj* mem, PNODEK ty = HeapObjNode);
|
|
650
|
+
|
|
651
|
+
/// Return name of a LLVM value
|
|
652
|
+
inline const std::string getValueName() const
|
|
653
|
+
{
|
|
654
|
+
return " (heap base object)";
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
virtual const std::string toString() const;
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* @brief Represents a stack-allocated object variable in the SVFIR (SVF Intermediate Representation)
|
|
663
|
+
* @inherits BaseObjVar
|
|
664
|
+
*
|
|
665
|
+
* This class models variables that are allocated on the stack in the program.
|
|
666
|
+
* It provides type checking functionality through LLVM-style RTTI (Runtime Type Information)
|
|
667
|
+
* methods like classof.
|
|
668
|
+
*/
|
|
669
|
+
class StackObjVar: public BaseObjVar
|
|
670
|
+
{
|
|
671
|
+
|
|
672
|
+
friend class SVFIRWriter;
|
|
673
|
+
friend class SVFIRReader;
|
|
674
|
+
|
|
675
|
+
protected:
|
|
676
|
+
/// Constructor to create stack object var
|
|
677
|
+
StackObjVar(NodeID i, PNODEK ty = StackObjNode) : BaseObjVar(i, ty) {}
|
|
678
|
+
|
|
679
|
+
public:
|
|
680
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
681
|
+
//@{
|
|
682
|
+
static inline bool classof(const StackObjVar*)
|
|
683
|
+
{
|
|
684
|
+
return true;
|
|
685
|
+
}
|
|
686
|
+
static inline bool classof(const BaseObjVar* node)
|
|
687
|
+
{
|
|
688
|
+
return node->getNodeKind() == StackObjNode;
|
|
689
|
+
}
|
|
690
|
+
static inline bool classof(const ObjVar* node)
|
|
691
|
+
{
|
|
692
|
+
return node->getNodeKind() == StackObjNode;
|
|
693
|
+
}
|
|
694
|
+
static inline bool classof(const SVFVar* node)
|
|
695
|
+
{
|
|
696
|
+
return node->getNodeKind() == StackObjNode;
|
|
697
|
+
}
|
|
698
|
+
static inline bool classof(const GenericPAGNodeTy* node)
|
|
699
|
+
{
|
|
700
|
+
return node->getNodeKind() == StackObjNode;
|
|
701
|
+
}
|
|
702
|
+
static inline bool classof(const SVFBaseNode* node)
|
|
703
|
+
{
|
|
704
|
+
return node->getNodeKind() == StackObjNode;
|
|
705
|
+
}
|
|
706
|
+
//@}
|
|
707
|
+
|
|
708
|
+
/// Constructor
|
|
709
|
+
StackObjVar(const SVFFunction* f, const SVFType* svfType, NodeID i,
|
|
710
|
+
const MemObj* mem, PNODEK ty = StackObjNode);
|
|
711
|
+
|
|
712
|
+
/// Return name of a LLVM value
|
|
713
|
+
inline const std::string getValueName() const
|
|
714
|
+
{
|
|
715
|
+
return " (stack base object)";
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
virtual const std::string toString() const;
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
|
|
587
722
|
class CallGraphNode;
|
|
588
723
|
|
|
589
724
|
class FunValVar : public ValVar
|
|
@@ -625,16 +760,12 @@ public:
|
|
|
625
760
|
|
|
626
761
|
/// Constructor
|
|
627
762
|
FunValVar(const CallGraphNode* cgn, NodeID i, const ICFGNode* icn,
|
|
628
|
-
PNODEK ty = FunValNode)
|
|
629
|
-
: ValVar(nullptr, i, ty, icn), callGraphNode(cgn)
|
|
630
|
-
{
|
|
631
|
-
|
|
632
|
-
}
|
|
763
|
+
PNODEK ty = FunValNode);
|
|
633
764
|
|
|
634
765
|
virtual const std::string toString() const;
|
|
635
766
|
};
|
|
636
767
|
|
|
637
|
-
class FunObjVar : public
|
|
768
|
+
class FunObjVar : public BaseObjVar
|
|
638
769
|
{
|
|
639
770
|
friend class SVFIRWriter;
|
|
640
771
|
friend class SVFIRReader;
|
|
@@ -644,7 +775,7 @@ private:
|
|
|
644
775
|
|
|
645
776
|
private:
|
|
646
777
|
/// Constructor to create empty ObjVar (for SVFIRReader/deserialization)
|
|
647
|
-
FunObjVar(NodeID i, PNODEK ty = FunObjNode) :
|
|
778
|
+
FunObjVar(NodeID i, PNODEK ty = FunObjNode) : BaseObjVar(i, ty) {}
|
|
648
779
|
|
|
649
780
|
public:
|
|
650
781
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -653,7 +784,7 @@ public:
|
|
|
653
784
|
{
|
|
654
785
|
return true;
|
|
655
786
|
}
|
|
656
|
-
static inline bool classof(const
|
|
787
|
+
static inline bool classof(const BaseObjVar* node)
|
|
657
788
|
{
|
|
658
789
|
return node->getNodeKind() == FunObjNode;
|
|
659
790
|
}
|
|
@@ -840,14 +971,14 @@ public:
|
|
|
840
971
|
/*
|
|
841
972
|
* Dummy object variable
|
|
842
973
|
*/
|
|
843
|
-
class DummyObjVar: public
|
|
974
|
+
class DummyObjVar: public BaseObjVar
|
|
844
975
|
{
|
|
845
976
|
friend class SVFIRWriter;
|
|
846
977
|
friend class SVFIRReader;
|
|
847
978
|
|
|
848
979
|
private:
|
|
849
980
|
/// Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
|
|
850
|
-
DummyObjVar(NodeID i) :
|
|
981
|
+
DummyObjVar(NodeID i) : BaseObjVar(i, DummyObjNode) {}
|
|
851
982
|
|
|
852
983
|
public:
|
|
853
984
|
//@{ Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -876,7 +1007,7 @@ public:
|
|
|
876
1007
|
|
|
877
1008
|
/// Constructor
|
|
878
1009
|
DummyObjVar(NodeID i, const MemObj* m, PNODEK ty = DummyObjNode)
|
|
879
|
-
:
|
|
1010
|
+
: BaseObjVar(nullptr, i, m, ty)
|
|
880
1011
|
{
|
|
881
1012
|
}
|
|
882
1013
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|