svf-tools 1.0.1032 → 1.0.1033
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/Graphs/GenericGraph.h +105 -91
- package/svf/include/SVFIR/SVFIR.h +71 -73
- package/svf/include/SVFIR/SVFVariables.h +270 -283
- package/svf/lib/AE/Core/AbstractState.cpp +5 -5
- package/svf/lib/CFL/CFLGraphBuilder.cpp +0 -1
- package/svf/lib/Graphs/ConsG.cpp +2 -2
- package/svf/lib/Graphs/IRGraph.cpp +2 -2
- package/svf/lib/MemoryModel/AccessPath.cpp +5 -5
- package/svf/lib/SABER/SaberCondAllocator.cpp +2 -2
- package/svf/lib/SVFIR/PAGBuilderFromFile.cpp +2 -2
- package/svf/lib/SVFIR/SVFIR.cpp +5 -5
- package/svf/lib/SVFIR/SVFStatements.cpp +1 -1
- package/svf/lib/SVFIR/SVFVariables.cpp +76 -107
- package/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/svf-llvm/lib/LLVMUtil.cpp +1 -1
- package/svf-llvm/lib/SVFIRBuilder.cpp +47 -35
- package/svf-llvm/lib/SVFIRExtAPI.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.1033",
|
|
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": {
|
|
@@ -141,96 +141,110 @@ public:
|
|
|
141
141
|
|
|
142
142
|
enum GNodeK
|
|
143
143
|
{
|
|
144
|
-
//
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
//
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// │
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
// │
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
//
|
|
186
|
-
|
|
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
|
-
//
|
|
219
|
-
|
|
220
|
-
//
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
|
225
240
|
ConstraintNodeKd, // Constraint graph node
|
|
226
|
-
TCTNodeKd,
|
|
227
|
-
DCHNodeKd,
|
|
228
|
-
OtherKd
|
|
241
|
+
TCTNodeKd, // Thread creation tree node
|
|
242
|
+
DCHNodeKd, // DCHG node
|
|
243
|
+
OtherKd // Other node kind
|
|
229
244
|
};
|
|
230
245
|
|
|
231
246
|
|
|
232
|
-
|
|
233
|
-
SVFBaseNode(NodeID i, GNodeK k, SVFType* ty = nullptr): id(i),nodeKind(k), type(ty)
|
|
247
|
+
SVFBaseNode(NodeID i, GNodeK k, const SVFType* ty = nullptr): id(i),nodeKind(k), type(ty)
|
|
234
248
|
{
|
|
235
249
|
|
|
236
250
|
}
|
|
@@ -326,10 +340,10 @@ protected:
|
|
|
326
340
|
|
|
327
341
|
static inline bool isConstantDataValVar(GNodeK n)
|
|
328
342
|
{
|
|
329
|
-
static_assert(
|
|
343
|
+
static_assert(ConstNullptrValNode - ConstDataValNode == 4,
|
|
330
344
|
"The number of ConstantDataValVarKinds has changed, make "
|
|
331
345
|
"sure the range is correct");
|
|
332
|
-
return n <=
|
|
346
|
+
return n <= ConstNullptrValNode && n >= ConstDataValNode;
|
|
333
347
|
}
|
|
334
348
|
|
|
335
349
|
static inline bool isObjVarKinds(GNodeK n)
|
|
@@ -350,10 +364,10 @@ protected:
|
|
|
350
364
|
|
|
351
365
|
static inline bool isConstantDataObjVarKinds(GNodeK n)
|
|
352
366
|
{
|
|
353
|
-
static_assert(
|
|
367
|
+
static_assert(ConstNullptrObjNode - ConstDataObjNode == 3,
|
|
354
368
|
"The number of ConstantDataObjVarKinds has changed, make "
|
|
355
369
|
"sure the range is correct");
|
|
356
|
-
return n <=
|
|
370
|
+
return n <= ConstNullptrObjNode && n >= ConstDataObjNode;
|
|
357
371
|
}
|
|
358
372
|
|
|
359
373
|
static inline bool isVFGNodeKinds(GNodeK n)
|
|
@@ -433,7 +447,7 @@ private:
|
|
|
433
447
|
|
|
434
448
|
public:
|
|
435
449
|
/// Constructor
|
|
436
|
-
GenericNode(NodeID i, GNodeK k): SVFBaseNode(i, k)
|
|
450
|
+
GenericNode(NodeID i, GNodeK k, const SVFType* svfType = nullptr): SVFBaseNode(i, k, svfType)
|
|
437
451
|
{
|
|
438
452
|
|
|
439
453
|
}
|
|
@@ -473,7 +473,7 @@ public:
|
|
|
473
473
|
//@}
|
|
474
474
|
inline NodeID addDummyValNode()
|
|
475
475
|
{
|
|
476
|
-
return addDummyValNode(NodeIDAllocator::get()->allocateValueId());
|
|
476
|
+
return addDummyValNode(NodeIDAllocator::get()->allocateValueId(), nullptr);
|
|
477
477
|
}
|
|
478
478
|
inline NodeID addDummyObjNode(const SVFType* type)
|
|
479
479
|
{
|
|
@@ -544,165 +544,164 @@ private:
|
|
|
544
544
|
/// add node into SVFIR
|
|
545
545
|
//@{
|
|
546
546
|
/// Add a value (pointer) node
|
|
547
|
-
inline NodeID addValNode(const
|
|
547
|
+
inline NodeID addValNode(NodeID i, const SVFType* type, const ICFGNode* icfgNode)
|
|
548
548
|
{
|
|
549
|
-
SVFVar *node = new ValVar(
|
|
550
|
-
return addValNode(
|
|
549
|
+
SVFVar *node = new ValVar(i, type, icfgNode, ValVar::ValNode);
|
|
550
|
+
return addValNode(node);
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
NodeID addFunValNode(NodeID i, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode)
|
|
553
|
+
NodeID addFunValNode(NodeID i, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode, const SVFType* type)
|
|
554
554
|
{
|
|
555
|
-
FunValVar* node = new FunValVar(i, icfgNode, callGraphNode);
|
|
556
|
-
return addValNode(
|
|
555
|
+
FunValVar* node = new FunValVar(i, icfgNode, callGraphNode, type);
|
|
556
|
+
return addValNode(node);
|
|
557
557
|
}
|
|
558
558
|
|
|
559
|
-
NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode, bool isUncalled = false)
|
|
559
|
+
NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode, const SVFType* type, bool isUncalled = false)
|
|
560
560
|
{
|
|
561
561
|
ArgValVar* node =
|
|
562
|
-
new ArgValVar(i, argNo, icfgNode, callGraphNode, isUncalled);
|
|
563
|
-
return addValNode(
|
|
562
|
+
new ArgValVar(i, argNo, icfgNode, callGraphNode, type, isUncalled);
|
|
563
|
+
return addValNode(node);
|
|
564
564
|
}
|
|
565
565
|
|
|
566
|
-
inline NodeID addConstantFPValNode(const
|
|
567
|
-
const ICFGNode* icfgNode)
|
|
566
|
+
inline NodeID addConstantFPValNode(const NodeID i, double dval,
|
|
567
|
+
const ICFGNode* icfgNode, const SVFType* type)
|
|
568
568
|
{
|
|
569
|
-
SVFVar* node = new
|
|
569
|
+
SVFVar* node = new ConstFPValVar(i, dval, icfgNode, type);
|
|
570
570
|
return addNode(node);
|
|
571
571
|
}
|
|
572
572
|
|
|
573
|
-
inline NodeID addConstantIntValNode(
|
|
574
|
-
const ICFGNode* icfgNode)
|
|
573
|
+
inline NodeID addConstantIntValNode(NodeID i, const std::pair<s64_t, u64_t>& intValue,
|
|
574
|
+
const ICFGNode* icfgNode, const SVFType* type)
|
|
575
575
|
{
|
|
576
|
-
SVFVar* node = new
|
|
576
|
+
SVFVar* node = new ConstIntValVar(i, intValue.first, intValue.second, icfgNode, type);
|
|
577
577
|
return addNode(node);
|
|
578
578
|
}
|
|
579
579
|
|
|
580
|
-
inline NodeID addConstantNullPtrValNode(const
|
|
580
|
+
inline NodeID addConstantNullPtrValNode(const NodeID i, const ICFGNode* icfgNode, const SVFType* type)
|
|
581
581
|
{
|
|
582
|
-
SVFVar* node = new
|
|
582
|
+
SVFVar* node = new ConstNullPtrValVar(i, icfgNode, type);
|
|
583
583
|
return addNode(node);
|
|
584
584
|
}
|
|
585
585
|
|
|
586
|
-
inline NodeID
|
|
586
|
+
inline NodeID addGlobalValNode(const NodeID i, const ICFGNode* icfgNode, const SVFType* svfType)
|
|
587
587
|
{
|
|
588
|
-
SVFVar* node = new GlobalValVar(
|
|
588
|
+
SVFVar* node = new GlobalValVar(i, icfgNode, svfType);
|
|
589
589
|
return addNode(node);
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
-
inline NodeID addConstantAggValNode(const
|
|
592
|
+
inline NodeID addConstantAggValNode(const NodeID i, const ICFGNode* icfgNode, const SVFType* svfType)
|
|
593
593
|
{
|
|
594
|
-
SVFVar* node = new
|
|
594
|
+
SVFVar* node = new ConstAggValVar(i, icfgNode, svfType);
|
|
595
595
|
return addNode(node);
|
|
596
596
|
}
|
|
597
597
|
|
|
598
|
-
inline NodeID addConstantDataValNode(const
|
|
598
|
+
inline NodeID addConstantDataValNode(const NodeID i, const ICFGNode* icfgNode, const SVFType* type)
|
|
599
599
|
{
|
|
600
|
-
SVFVar* node = new
|
|
600
|
+
SVFVar* node = new ConstDataValVar(i, icfgNode, type);
|
|
601
601
|
return addNode(node);
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
|
|
605
605
|
/// Add a memory obj node
|
|
606
|
-
inline NodeID addObjNode(
|
|
606
|
+
inline NodeID addObjNode(NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node)
|
|
607
607
|
{
|
|
608
|
-
return addFIObjNode(
|
|
608
|
+
return addFIObjNode( i, ti, type, node);
|
|
609
609
|
}
|
|
610
610
|
|
|
611
611
|
/**
|
|
612
612
|
* Creates and adds a heap object node to the SVFIR
|
|
613
613
|
*/
|
|
614
|
-
inline NodeID addHeapObjNode(
|
|
614
|
+
inline NodeID addHeapObjNode(NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node)
|
|
615
615
|
{
|
|
616
616
|
memToFieldsMap[i].set(i);
|
|
617
|
-
HeapObjVar *heapObj = new HeapObjVar(
|
|
618
|
-
return addObjNode(
|
|
617
|
+
HeapObjVar *heapObj = new HeapObjVar(i, ti, type, node);
|
|
618
|
+
return addObjNode(heapObj);
|
|
619
619
|
}
|
|
620
620
|
|
|
621
621
|
/**
|
|
622
622
|
* Creates and adds a stack object node to the SVFIR
|
|
623
623
|
*/
|
|
624
|
-
inline NodeID addStackObjNode(
|
|
624
|
+
inline NodeID addStackObjNode(NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node)
|
|
625
625
|
{
|
|
626
626
|
memToFieldsMap[i].set(i);
|
|
627
|
-
StackObjVar *stackObj = new StackObjVar(
|
|
628
|
-
return addObjNode(
|
|
627
|
+
StackObjVar *stackObj = new StackObjVar(i, ti, type, node);
|
|
628
|
+
return addObjNode(stackObj);
|
|
629
629
|
}
|
|
630
630
|
|
|
631
|
-
NodeID addFunObjNode(
|
|
631
|
+
NodeID addFunObjNode(NodeID id, ObjTypeInfo* ti, const CallGraphNode* callGraphNode, const SVFType* type, const ICFGNode* node)
|
|
632
632
|
{
|
|
633
633
|
memToFieldsMap[id].set(id);
|
|
634
|
-
FunObjVar* funObj = new FunObjVar(
|
|
635
|
-
return addObjNode(
|
|
634
|
+
FunObjVar* funObj = new FunObjVar(id, ti, callGraphNode, type, node);
|
|
635
|
+
return addObjNode(funObj);
|
|
636
636
|
}
|
|
637
637
|
|
|
638
638
|
|
|
639
|
-
inline NodeID addConstantFPObjNode(
|
|
639
|
+
inline NodeID addConstantFPObjNode(NodeID i, ObjTypeInfo* ti, double dval, const SVFType* type, const ICFGNode* node)
|
|
640
640
|
{
|
|
641
641
|
memToFieldsMap[i].set(i);
|
|
642
|
-
|
|
643
|
-
return addObjNode(
|
|
642
|
+
ConstFPObjVar* conObj = new ConstFPObjVar(i, dval, ti, type, node);
|
|
643
|
+
return addObjNode(conObj);
|
|
644
644
|
}
|
|
645
645
|
|
|
646
646
|
|
|
647
|
-
inline NodeID addConstantIntObjNode(
|
|
647
|
+
inline NodeID addConstantIntObjNode(NodeID i, ObjTypeInfo* ti, const std::pair<s64_t, u64_t>& intValue, const SVFType* type, const ICFGNode* node)
|
|
648
648
|
{
|
|
649
649
|
memToFieldsMap[i].set(i);
|
|
650
|
-
|
|
651
|
-
new
|
|
652
|
-
return addObjNode(
|
|
650
|
+
ConstIntObjVar* conObj =
|
|
651
|
+
new ConstIntObjVar(i, intValue.first, intValue.second, ti, type, node);
|
|
652
|
+
return addObjNode(conObj);
|
|
653
653
|
}
|
|
654
654
|
|
|
655
655
|
|
|
656
|
-
inline NodeID addConstantNullPtrObjNode(const
|
|
656
|
+
inline NodeID addConstantNullPtrObjNode(const NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node)
|
|
657
657
|
{
|
|
658
658
|
memToFieldsMap[i].set(i);
|
|
659
|
-
|
|
660
|
-
return addObjNode(
|
|
659
|
+
ConstNullPtrObjVar* conObj = new ConstNullPtrObjVar(i, ti, type, node);
|
|
660
|
+
return addObjNode(conObj);
|
|
661
661
|
}
|
|
662
662
|
|
|
663
|
-
inline NodeID
|
|
663
|
+
inline NodeID addGlobalObjNode(const NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node)
|
|
664
664
|
{
|
|
665
665
|
memToFieldsMap[i].set(i);
|
|
666
|
-
GlobalObjVar* gObj = new GlobalObjVar(
|
|
667
|
-
return addObjNode(
|
|
666
|
+
GlobalObjVar* gObj = new GlobalObjVar(i, ti, type, node);
|
|
667
|
+
return addObjNode(gObj);
|
|
668
668
|
}
|
|
669
|
-
inline NodeID addConstantAggObjNode(const
|
|
670
|
-
const NodeID i, ObjTypeInfo* ti)
|
|
669
|
+
inline NodeID addConstantAggObjNode(const NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node)
|
|
671
670
|
{
|
|
672
671
|
memToFieldsMap[i].set(i);
|
|
673
|
-
|
|
674
|
-
return addObjNode(
|
|
672
|
+
ConstAggObjVar* conObj = new ConstAggObjVar(i, ti, type, node);
|
|
673
|
+
return addObjNode(conObj);
|
|
675
674
|
}
|
|
676
|
-
inline NodeID addConstantDataObjNode(const
|
|
675
|
+
inline NodeID addConstantDataObjNode(const NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node)
|
|
677
676
|
{
|
|
678
677
|
memToFieldsMap[i].set(i);
|
|
679
|
-
|
|
680
|
-
return addObjNode(
|
|
678
|
+
ConstDataObjVar* conObj = new ConstDataObjVar(i, ti, type, node);
|
|
679
|
+
return addObjNode(conObj);
|
|
681
680
|
}
|
|
682
681
|
|
|
683
682
|
/// Add a unique return node for a procedure
|
|
684
|
-
inline NodeID addRetNode(NodeID i, const CallGraphNode* callGraphNode)
|
|
683
|
+
inline NodeID addRetNode(NodeID i, const CallGraphNode* callGraphNode, const SVFType* type, const ICFGNode* icn)
|
|
685
684
|
{
|
|
686
|
-
SVFVar *node = new
|
|
685
|
+
SVFVar *node = new RetValPN(i, callGraphNode, type, icn);
|
|
687
686
|
return addRetNode(callGraphNode, node);
|
|
688
687
|
}
|
|
689
688
|
/// Add a unique vararg node for a procedure
|
|
690
|
-
inline NodeID addVarargNode(NodeID i, const CallGraphNode* val)
|
|
689
|
+
inline NodeID addVarargNode(NodeID i, const CallGraphNode* val, const SVFType* type, const ICFGNode* n)
|
|
691
690
|
{
|
|
692
|
-
SVFVar *node = new
|
|
691
|
+
SVFVar *node = new VarArgValPN(i, val, type, n);
|
|
693
692
|
return addNode(node);
|
|
694
693
|
}
|
|
695
694
|
|
|
696
695
|
/// Add a temp field value node, this method can only invoked by getGepValVar
|
|
697
|
-
NodeID addGepValNode(const SVFValue* curInst,const SVFValue* val, const AccessPath& ap, NodeID i, const SVFType* type);
|
|
696
|
+
NodeID addGepValNode(const SVFValue* curInst,const SVFValue* val, const AccessPath& ap, NodeID i, const SVFType* type, const ICFGNode* node);
|
|
698
697
|
/// Add a field obj node, this method can only invoked by getGepObjVar
|
|
699
698
|
NodeID addGepObjNode(const BaseObjVar* baseObj, const APOffset& apOffset, const NodeID gepId);
|
|
700
699
|
/// Add a field-insensitive node, this method can only invoked by getFIGepObjNode
|
|
701
|
-
NodeID addFIObjNode(
|
|
700
|
+
NodeID addFIObjNode(NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node)
|
|
702
701
|
{
|
|
703
702
|
memToFieldsMap[i].set(i);
|
|
704
|
-
BaseObjVar* baseObj = new BaseObjVar(
|
|
705
|
-
return addObjNode(
|
|
703
|
+
BaseObjVar* baseObj = new BaseObjVar(i, ti, type, node);
|
|
704
|
+
return addObjNode(baseObj);
|
|
706
705
|
}
|
|
707
706
|
|
|
708
707
|
|
|
@@ -710,9 +709,9 @@ private:
|
|
|
710
709
|
|
|
711
710
|
/// Add a dummy value/object node according to node ID (llvm value is null)
|
|
712
711
|
//@{
|
|
713
|
-
inline NodeID addDummyValNode(NodeID i)
|
|
712
|
+
inline NodeID addDummyValNode(NodeID i, const ICFGNode* node)
|
|
714
713
|
{
|
|
715
|
-
return addValNode(
|
|
714
|
+
return addValNode(new DummyValVar(i, node));
|
|
716
715
|
}
|
|
717
716
|
inline NodeID addDummyObjNode(NodeID i, const SVFType* type)
|
|
718
717
|
{
|
|
@@ -720,31 +719,30 @@ private:
|
|
|
720
719
|
{
|
|
721
720
|
ObjTypeInfo* ti = symInfo->createObjTypeInfo(type);
|
|
722
721
|
symInfo->idToObjTypeInfoMap()[i] = ti;
|
|
723
|
-
return addObjNode(
|
|
722
|
+
return addObjNode(new DummyObjVar(i, ti, nullptr, type));
|
|
724
723
|
}
|
|
725
724
|
else
|
|
726
725
|
{
|
|
727
|
-
return addObjNode(
|
|
726
|
+
return addObjNode(new DummyObjVar(i, symInfo->getObjTypeInfo(i), nullptr, type));
|
|
728
727
|
}
|
|
729
728
|
}
|
|
730
729
|
|
|
731
730
|
inline NodeID addBlackholeObjNode()
|
|
732
731
|
{
|
|
733
|
-
return addObjNode(
|
|
734
|
-
nullptr, new DummyObjVar(getBlackHoleNode(), symInfo->getObjTypeInfo(getBlackHoleNode())));
|
|
732
|
+
return addObjNode(new DummyObjVar(getBlackHoleNode(), symInfo->getObjTypeInfo(getBlackHoleNode()), nullptr));
|
|
735
733
|
}
|
|
736
734
|
inline NodeID addConstantObjNode()
|
|
737
735
|
{
|
|
738
|
-
return addObjNode(
|
|
736
|
+
return addObjNode(new DummyObjVar(getConstantNode(), symInfo->getObjTypeInfo(getConstantNode()), nullptr));
|
|
739
737
|
}
|
|
740
738
|
inline NodeID addBlackholePtrNode()
|
|
741
739
|
{
|
|
742
|
-
return addDummyValNode(getBlkPtr());
|
|
740
|
+
return addDummyValNode(getBlkPtr(), nullptr);
|
|
743
741
|
}
|
|
744
742
|
//@}
|
|
745
743
|
|
|
746
744
|
/// Add a value (pointer) node
|
|
747
|
-
inline NodeID addValNode(
|
|
745
|
+
inline NodeID addValNode(SVFVar *node)
|
|
748
746
|
{
|
|
749
747
|
assert(node && "node cannot be nullptr.");
|
|
750
748
|
assert(hasGNode(node->getId()) == false &&
|
|
@@ -753,7 +751,7 @@ private:
|
|
|
753
751
|
return addNode(node);
|
|
754
752
|
}
|
|
755
753
|
/// Add a memory obj node
|
|
756
|
-
inline NodeID addObjNode(
|
|
754
|
+
inline NodeID addObjNode(SVFVar *node)
|
|
757
755
|
{
|
|
758
756
|
assert(node && "node cannot be nullptr.");
|
|
759
757
|
assert(hasGNode(node->getId()) == false &&
|