svf-tools 1.0.1029 → 1.0.1031
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/CHG.h +6 -5
- package/svf/include/Graphs/GenericGraph.h +23 -5
- package/svf/include/MemoryModel/PointerAnalysis.h +1 -1
- package/svf/include/MemoryModel/PointerAnalysisImpl.h +1 -1
- package/svf/include/SVFIR/SVFIR.h +14 -3
- package/svf/include/SVFIR/SVFValue.h +1 -4
- package/svf/include/SVFIR/SVFVariables.h +211 -17
- package/svf/lib/AE/Svfexe/AEDetector.cpp +2 -4
- package/svf/lib/AE/Svfexe/AbsExtAPI.cpp +2 -2
- package/svf/lib/DDA/ContextDDA.cpp +9 -13
- package/svf/lib/DDA/DDAClient.cpp +6 -11
- package/svf/lib/Graphs/CHG.cpp +1 -1
- package/svf/lib/Graphs/ConsG.cpp +1 -1
- package/svf/lib/Graphs/ThreadCallGraph.cpp +1 -1
- package/svf/lib/Graphs/VFG.cpp +9 -24
- package/svf/lib/MemoryModel/PointerAnalysis.cpp +23 -23
- package/svf/lib/MemoryModel/PointerAnalysisImpl.cpp +1 -1
- package/svf/lib/SABER/SaberSVFGBuilder.cpp +1 -1
- package/svf/lib/SVFIR/SVFFileSystem.cpp +2 -0
- package/svf/lib/SVFIR/SVFIR.cpp +5 -11
- package/svf/lib/SVFIR/SVFVariables.cpp +35 -10
- package/svf/lib/WPA/AndersenStat.cpp +2 -2
- package/svf/lib/WPA/FlowSensitiveStat.cpp +2 -2
- package/svf/lib/WPA/WPAPass.cpp +2 -2
- package/svf-llvm/include/SVF-LLVM/DCHG.h +5 -5
- package/svf-llvm/include/SVF-LLVM/LLVMModule.h +4 -4
- package/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +1 -2
- package/svf-llvm/lib/CHGBuilder.cpp +6 -7
- package/svf-llvm/lib/DCHG.cpp +7 -4
- package/svf-llvm/lib/LLVMModule.cpp +3 -2
- package/svf-llvm/lib/LLVMUtil.cpp +19 -4
- package/svf-llvm/lib/SVFIRBuilder.cpp +42 -59
- package/svf-llvm/lib/SVFIRExtAPI.cpp +4 -1
- package/svf-llvm/tools/Example/svf-ex.cpp +1 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1031",
|
|
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": {
|
package/svf/include/Graphs/CHG.h
CHANGED
|
@@ -42,8 +42,9 @@ namespace SVF
|
|
|
42
42
|
|
|
43
43
|
class SVFModule;
|
|
44
44
|
class CHNode;
|
|
45
|
+
class GlobalObjVar;
|
|
45
46
|
|
|
46
|
-
typedef Set<const
|
|
47
|
+
typedef Set<const GlobalObjVar*> VTableSet;
|
|
47
48
|
typedef Set<const SVFFunction*> VFunSet;
|
|
48
49
|
|
|
49
50
|
/// Common base for class hierarchy graph. Only implements what PointerAnalysis needs.
|
|
@@ -127,7 +128,7 @@ public:
|
|
|
127
128
|
~CHNode()
|
|
128
129
|
{
|
|
129
130
|
}
|
|
130
|
-
std::string getName() const
|
|
131
|
+
virtual const std::string& getName() const
|
|
131
132
|
{
|
|
132
133
|
return className;
|
|
133
134
|
}
|
|
@@ -181,12 +182,12 @@ public:
|
|
|
181
182
|
}
|
|
182
183
|
void getVirtualFunctions(u32_t idx, FuncVector &virtualFunctions) const;
|
|
183
184
|
|
|
184
|
-
const
|
|
185
|
+
const GlobalObjVar *getVTable() const
|
|
185
186
|
{
|
|
186
187
|
return vtable;
|
|
187
188
|
}
|
|
188
189
|
|
|
189
|
-
void setVTable(const
|
|
190
|
+
void setVTable(const GlobalObjVar *vtbl)
|
|
190
191
|
{
|
|
191
192
|
vtable = vtbl;
|
|
192
193
|
}
|
|
@@ -210,7 +211,7 @@ public:
|
|
|
210
211
|
//@}
|
|
211
212
|
|
|
212
213
|
private:
|
|
213
|
-
const
|
|
214
|
+
const GlobalObjVar* vtable;
|
|
214
215
|
std::string className;
|
|
215
216
|
size_t flags;
|
|
216
217
|
/*
|
|
@@ -160,12 +160,13 @@ public:
|
|
|
160
160
|
RetNode, // ├──Represents a return value node
|
|
161
161
|
VarargNode, // ├──Represents a variadic argument node
|
|
162
162
|
GlobalValNode, // ├──Represents a global variable node
|
|
163
|
+
ConstantAggValNode, // ├──Represents a constant aggregate value node
|
|
163
164
|
ConstantDataValNode, // ├──Represents a constant data variable
|
|
164
165
|
BlackHoleNode, // ├──Represents a black hole node
|
|
165
166
|
ConstantFPValNode, // ├──Represents a constant float-point value node
|
|
166
167
|
ConstantIntValNode, // ├── Represents a constant integer value node
|
|
167
168
|
ConstantNullptrValNode, // ├── Represents a constant nullptr value node
|
|
168
|
-
DummyValNode, // ├──
|
|
169
|
+
DummyValNode, // ├──Represents a dummy node for uninitialized values
|
|
169
170
|
// │ └── ObjVar: Classes of object variable nodes
|
|
170
171
|
ObjNode, // ├──Represents an object variable
|
|
171
172
|
GepObjNode, // ├──Represents a GEP object variable
|
|
@@ -175,6 +176,7 @@ public:
|
|
|
175
176
|
HeapObjNode, // ├──Types of heap object
|
|
176
177
|
StackObjNode, // ├──Types of stack object
|
|
177
178
|
GlobalObjNode, // ├──Types of global object
|
|
179
|
+
ConstantAggObjNode, // ├──Types of constant aggregate object
|
|
178
180
|
ConstantDataObjNode, // ├──Types of constant data object
|
|
179
181
|
ConstantFPObjNode, // ├──Types of constant float-point object
|
|
180
182
|
ConstantIntObjNode, // ├──Types of constant integer object
|
|
@@ -250,6 +252,21 @@ public:
|
|
|
250
252
|
return type;
|
|
251
253
|
}
|
|
252
254
|
|
|
255
|
+
inline virtual void setName(const std::string& nameInfo)
|
|
256
|
+
{
|
|
257
|
+
name = nameInfo;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
inline virtual void setName(std::string&& nameInfo)
|
|
261
|
+
{
|
|
262
|
+
name = std::move(nameInfo);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
virtual const std::string& getName() const
|
|
266
|
+
{
|
|
267
|
+
return name;
|
|
268
|
+
}
|
|
269
|
+
|
|
253
270
|
inline virtual void setSourceLoc(const std::string& sourceCodeInfo)
|
|
254
271
|
{
|
|
255
272
|
sourceLoc = sourceCodeInfo;
|
|
@@ -268,6 +285,7 @@ protected:
|
|
|
268
285
|
GNodeK nodeKind; ///< Node kind
|
|
269
286
|
const SVFType* type; ///< SVF type
|
|
270
287
|
|
|
288
|
+
std::string name;
|
|
271
289
|
std::string sourceLoc; ///< Source code information of this value
|
|
272
290
|
|
|
273
291
|
/// Helper functions to check node kinds
|
|
@@ -290,7 +308,7 @@ protected:
|
|
|
290
308
|
|
|
291
309
|
static inline bool isSVFVarKind(GNodeK n)
|
|
292
310
|
{
|
|
293
|
-
static_assert(DummyObjNode - ValNode ==
|
|
311
|
+
static_assert(DummyObjNode - ValNode == 26,
|
|
294
312
|
"The number of SVFVarKinds has changed, make sure the "
|
|
295
313
|
"range is correct");
|
|
296
314
|
|
|
@@ -299,7 +317,7 @@ protected:
|
|
|
299
317
|
|
|
300
318
|
static inline bool isValVarKinds(GNodeK n)
|
|
301
319
|
{
|
|
302
|
-
static_assert(DummyValNode - ValNode ==
|
|
320
|
+
static_assert(DummyValNode - ValNode == 13,
|
|
303
321
|
"The number of ValVarKinds has changed, make sure the "
|
|
304
322
|
"range is correct");
|
|
305
323
|
return n <= DummyValNode && n >= ValNode;
|
|
@@ -316,7 +334,7 @@ protected:
|
|
|
316
334
|
|
|
317
335
|
static inline bool isObjVarKinds(GNodeK n)
|
|
318
336
|
{
|
|
319
|
-
static_assert(DummyObjNode - ObjNode ==
|
|
337
|
+
static_assert(DummyObjNode - ObjNode == 12,
|
|
320
338
|
"The number of ObjVarKinds has changed, make sure the "
|
|
321
339
|
"range is correct");
|
|
322
340
|
return n <= DummyObjNode && n >= ObjNode;
|
|
@@ -324,7 +342,7 @@ protected:
|
|
|
324
342
|
|
|
325
343
|
static inline bool isBaseObjVarKinds(GNodeK n)
|
|
326
344
|
{
|
|
327
|
-
static_assert(DummyObjNode - BaseObjNode ==
|
|
345
|
+
static_assert(DummyObjNode - BaseObjNode == 10,
|
|
328
346
|
"The number of BaseObjVarKinds has changed, make sure the "
|
|
329
347
|
"range is correct");
|
|
330
348
|
return n <= DummyObjNode && n >= BaseObjNode;
|
|
@@ -104,7 +104,7 @@ public:
|
|
|
104
104
|
typedef Set<const SVFFunction*> FunctionSet;
|
|
105
105
|
typedef OrderedMap<const CallICFGNode*, FunctionSet> CallEdgeMap;
|
|
106
106
|
typedef SCCDetection<PTACallGraph*> CallGraphSCC;
|
|
107
|
-
typedef Set<const
|
|
107
|
+
typedef Set<const GlobalObjVar*> VTableSet;
|
|
108
108
|
typedef Set<const SVFFunction*> VFunSet;
|
|
109
109
|
//@}
|
|
110
110
|
|
|
@@ -570,7 +570,7 @@ public:
|
|
|
570
570
|
}
|
|
571
571
|
else if (!SVFUtil::isa<DummyValVar>(node))
|
|
572
572
|
{
|
|
573
|
-
SVFUtil::outs() << "##<" << node->
|
|
573
|
+
SVFUtil::outs() << "##<" << node->toString() << "> ";
|
|
574
574
|
//SVFUtil::outs() << "Source Loc: " << SVFUtil::getSourceLoc(node->getValue());
|
|
575
575
|
}
|
|
576
576
|
|
|
@@ -407,8 +407,7 @@ public:
|
|
|
407
407
|
{
|
|
408
408
|
const SVFVar* node = getGNode(id);
|
|
409
409
|
if(const GepValVar* gepVar = SVFUtil::dyn_cast<GepValVar>(node))
|
|
410
|
-
return
|
|
411
|
-
getGNode(gepVar->getBaseNode()));
|
|
410
|
+
return gepVar->getBaseNode();
|
|
412
411
|
else
|
|
413
412
|
return SVFUtil::dyn_cast<ValVar>(node);
|
|
414
413
|
}
|
|
@@ -590,6 +589,12 @@ private:
|
|
|
590
589
|
return addNode(node);
|
|
591
590
|
}
|
|
592
591
|
|
|
592
|
+
inline NodeID addConstantAggValNode(const SVFValue* curInst, const NodeID i, const ICFGNode* icfgNode)
|
|
593
|
+
{
|
|
594
|
+
SVFVar* node = new ConstantAggValVar(curInst, i, icfgNode);
|
|
595
|
+
return addNode(node);
|
|
596
|
+
}
|
|
597
|
+
|
|
593
598
|
inline NodeID addConstantDataValNode(const SVFValue* curInst, const NodeID i, const ICFGNode* icfgNode)
|
|
594
599
|
{
|
|
595
600
|
SVFVar* node = new ConstantDataValVar(curInst, i, icfgNode);
|
|
@@ -661,7 +666,13 @@ private:
|
|
|
661
666
|
GlobalObjVar* gObj = new GlobalObjVar(curInst, i, ti);
|
|
662
667
|
return addObjNode(curInst, gObj);
|
|
663
668
|
}
|
|
664
|
-
|
|
669
|
+
inline NodeID addConstantAggObjNode(const SVFValue* curInst,
|
|
670
|
+
const NodeID i, ObjTypeInfo* ti)
|
|
671
|
+
{
|
|
672
|
+
memToFieldsMap[i].set(i);
|
|
673
|
+
ConstantAggObjVar* conObj = new ConstantAggObjVar(curInst, i, ti);
|
|
674
|
+
return addObjNode(curInst, conObj);
|
|
675
|
+
}
|
|
665
676
|
inline NodeID addConstantDataObjNode(const SVFValue* curInst, const NodeID i, ObjTypeInfo* ti)
|
|
666
677
|
{
|
|
667
678
|
memToFieldsMap[i].set(i);
|
|
@@ -46,6 +46,7 @@ class SVFVar : public GenericPAGNodeTy
|
|
|
46
46
|
{
|
|
47
47
|
friend class SVFIRWriter;
|
|
48
48
|
friend class SVFIRReader;
|
|
49
|
+
friend class SVFIRBuilder;
|
|
49
50
|
friend class IRGraph;
|
|
50
51
|
friend class SVFIR;
|
|
51
52
|
friend class VFG;
|
|
@@ -68,11 +69,13 @@ protected:
|
|
|
68
69
|
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap;
|
|
69
70
|
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap;
|
|
70
71
|
bool isPtr; /// whether it is a pointer (top-level or address-taken)
|
|
72
|
+
|
|
71
73
|
const SVFFunction* func; /// function containing this variable
|
|
72
74
|
|
|
73
75
|
/// Constructor to create an empty object (for deserialization)
|
|
74
76
|
SVFVar(NodeID i, PNODEK k) : GenericPAGNodeTy(i, k), value{} {}
|
|
75
77
|
|
|
78
|
+
|
|
76
79
|
public:
|
|
77
80
|
/// Constructor
|
|
78
81
|
SVFVar(const SVFValue* val, NodeID i, PNODEK k);
|
|
@@ -109,7 +112,10 @@ public:
|
|
|
109
112
|
}
|
|
110
113
|
/// Whether it is constant data, i.e., "0", "1.001", "str"
|
|
111
114
|
/// or llvm's metadata, i.e., metadata !4087
|
|
112
|
-
bool isConstDataOrAggDataButNotNullPtr() const
|
|
115
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
116
|
+
{
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
113
119
|
|
|
114
120
|
/// Whether this is an isolated node on the SVFIR graph
|
|
115
121
|
virtual bool isIsolatedNode() const;
|
|
@@ -216,6 +222,24 @@ public:
|
|
|
216
222
|
return isSVFVarKind(node->getNodeKind());
|
|
217
223
|
}
|
|
218
224
|
|
|
225
|
+
inline virtual bool ptrInUncalledFunction() const
|
|
226
|
+
{
|
|
227
|
+
if (const SVFFunction* fun = getFunction())
|
|
228
|
+
{
|
|
229
|
+
return fun->isUncalledFunction();
|
|
230
|
+
}
|
|
231
|
+
else
|
|
232
|
+
{
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
virtual bool isConstDataOrAggData() const
|
|
238
|
+
{
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
|
219
243
|
private:
|
|
220
244
|
/// add methods of the components
|
|
221
245
|
//@{
|
|
@@ -465,7 +489,7 @@ class GepValVar: public ValVar
|
|
|
465
489
|
|
|
466
490
|
private:
|
|
467
491
|
AccessPath ap; // AccessPath
|
|
468
|
-
|
|
492
|
+
ValVar* base; // base node
|
|
469
493
|
const SVFType* gepValType;
|
|
470
494
|
|
|
471
495
|
/// Constructor to create empty GeValVar (for SVFIRReader/deserialization)
|
|
@@ -490,14 +514,15 @@ public:
|
|
|
490
514
|
{
|
|
491
515
|
return node->getNodeKind() == SVFVar::GepValNode;
|
|
492
516
|
}
|
|
517
|
+
static inline bool classof(const SVFBaseNode* node)
|
|
518
|
+
{
|
|
519
|
+
return node->getNodeKind() == SVFVar::GepValNode;
|
|
520
|
+
}
|
|
493
521
|
//@}
|
|
494
522
|
|
|
495
523
|
/// Constructor
|
|
496
|
-
GepValVar(
|
|
497
|
-
const SVFType* ty)
|
|
498
|
-
: ValVar(val, i, GepValNode), ap(ap), base(baseID), gepValType(ty)
|
|
499
|
-
{
|
|
500
|
-
}
|
|
524
|
+
GepValVar(ValVar* baseNode, const SVFValue* val, NodeID i, const AccessPath& ap,
|
|
525
|
+
const SVFType* ty);
|
|
501
526
|
|
|
502
527
|
/// offset of the base value variable
|
|
503
528
|
inline APOffset getConstantFieldIdx() const
|
|
@@ -506,7 +531,7 @@ public:
|
|
|
506
531
|
}
|
|
507
532
|
|
|
508
533
|
/// Return the base object from which this GEP node came from.
|
|
509
|
-
inline
|
|
534
|
+
inline ValVar* getBaseNode(void) const
|
|
510
535
|
{
|
|
511
536
|
return base;
|
|
512
537
|
}
|
|
@@ -526,11 +551,24 @@ public:
|
|
|
526
551
|
}
|
|
527
552
|
|
|
528
553
|
virtual const std::string toString() const;
|
|
554
|
+
|
|
555
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
556
|
+
{
|
|
557
|
+
return base->isConstDataOrAggDataButNotNullPtr();
|
|
558
|
+
}
|
|
559
|
+
virtual inline bool ptrInUncalledFunction() const
|
|
560
|
+
{
|
|
561
|
+
return base->ptrInUncalledFunction();
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
virtual inline bool isConstDataOrAggData() const
|
|
565
|
+
{
|
|
566
|
+
return base->isConstDataOrAggData();
|
|
567
|
+
}
|
|
529
568
|
};
|
|
530
569
|
|
|
531
570
|
/*
|
|
532
|
-
*
|
|
533
|
-
* Each field-insensitive gep obj node represents all fields of a MemObj (base)
|
|
571
|
+
* Base memory object variable (address-taken variables in LLVM-based languages)
|
|
534
572
|
*/
|
|
535
573
|
class BaseObjVar : public ObjVar
|
|
536
574
|
{
|
|
@@ -540,7 +578,7 @@ class BaseObjVar : public ObjVar
|
|
|
540
578
|
private:
|
|
541
579
|
ObjTypeInfo* typeInfo;
|
|
542
580
|
|
|
543
|
-
const
|
|
581
|
+
const ICFGNode* icfgNode; /// ICFGNode related to the creation of this object
|
|
544
582
|
|
|
545
583
|
protected:
|
|
546
584
|
/// Constructor to create empty ObjVar (for SVFIRReader/deserialization)
|
|
@@ -571,7 +609,7 @@ public:
|
|
|
571
609
|
}
|
|
572
610
|
//@}
|
|
573
611
|
|
|
574
|
-
///
|
|
612
|
+
/// Constructor
|
|
575
613
|
BaseObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, PNODEK ty = BaseObjNode)
|
|
576
614
|
: ObjVar(val, i, ty), typeInfo(ti)
|
|
577
615
|
{
|
|
@@ -582,10 +620,10 @@ public:
|
|
|
582
620
|
return this;
|
|
583
621
|
}
|
|
584
622
|
|
|
585
|
-
/// Get the
|
|
586
|
-
inline const
|
|
623
|
+
/// Get the ICFGNode related to the creation of this object
|
|
624
|
+
inline const ICFGNode* getICFGNode() const
|
|
587
625
|
{
|
|
588
|
-
return
|
|
626
|
+
return icfgNode;
|
|
589
627
|
}
|
|
590
628
|
|
|
591
629
|
/// Return name of a LLVM value
|
|
@@ -717,7 +755,7 @@ public:
|
|
|
717
755
|
{
|
|
718
756
|
return typeInfo->isConstDataOrConstGlobal();
|
|
719
757
|
}
|
|
720
|
-
bool isConstDataOrAggData() const
|
|
758
|
+
virtual inline bool isConstDataOrAggData() const
|
|
721
759
|
{
|
|
722
760
|
return typeInfo->isConstDataOrAggData();
|
|
723
761
|
}
|
|
@@ -782,7 +820,6 @@ public:
|
|
|
782
820
|
const APOffset& apOffset, PNODEK ty = GepObjNode)
|
|
783
821
|
: ObjVar(baseObj->hasValue()? baseObj->getValue(): nullptr, i, ty), apOffset(apOffset), base(baseObj)
|
|
784
822
|
{
|
|
785
|
-
|
|
786
823
|
}
|
|
787
824
|
|
|
788
825
|
/// offset of the mem object
|
|
@@ -817,6 +854,21 @@ public:
|
|
|
817
854
|
}
|
|
818
855
|
|
|
819
856
|
virtual const std::string toString() const;
|
|
857
|
+
|
|
858
|
+
virtual inline bool ptrInUncalledFunction() const
|
|
859
|
+
{
|
|
860
|
+
return base->ptrInUncalledFunction();
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
virtual inline bool isConstDataOrAggData() const
|
|
864
|
+
{
|
|
865
|
+
return base->isConstDataOrAggData();
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
869
|
+
{
|
|
870
|
+
return base->isConstDataOrAggDataButNotNullPtr();
|
|
871
|
+
}
|
|
820
872
|
};
|
|
821
873
|
|
|
822
874
|
|
|
@@ -1094,6 +1146,58 @@ public:
|
|
|
1094
1146
|
virtual const std::string toString() const;
|
|
1095
1147
|
};
|
|
1096
1148
|
|
|
1149
|
+
class ConstantAggValVar: public ValVar
|
|
1150
|
+
{
|
|
1151
|
+
friend class SVFIRWriter;
|
|
1152
|
+
friend class SVFIRReader;
|
|
1153
|
+
|
|
1154
|
+
public:
|
|
1155
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
1156
|
+
//@{
|
|
1157
|
+
static inline bool classof(const ConstantAggValVar*)
|
|
1158
|
+
{
|
|
1159
|
+
return true;
|
|
1160
|
+
}
|
|
1161
|
+
static inline bool classof(const ValVar* node)
|
|
1162
|
+
{
|
|
1163
|
+
return node->getNodeKind() == ConstantAggValNode;
|
|
1164
|
+
}
|
|
1165
|
+
static inline bool classof(const SVFVar* node)
|
|
1166
|
+
{
|
|
1167
|
+
return node->getNodeKind() == ConstantAggValNode;
|
|
1168
|
+
}
|
|
1169
|
+
static inline bool classof(const GenericPAGNodeTy* node)
|
|
1170
|
+
{
|
|
1171
|
+
return node->getNodeKind() == ConstantAggValNode;
|
|
1172
|
+
}
|
|
1173
|
+
static inline bool classof(const SVFBaseNode* node)
|
|
1174
|
+
{
|
|
1175
|
+
return node->getNodeKind() == ConstantAggValNode;
|
|
1176
|
+
}
|
|
1177
|
+
//@}
|
|
1178
|
+
|
|
1179
|
+
/// Constructor
|
|
1180
|
+
ConstantAggValVar(const SVFValue* val, NodeID i, const ICFGNode* icn,
|
|
1181
|
+
PNODEK ty = ConstantAggValNode)
|
|
1182
|
+
: ValVar(val, i, ty, icn)
|
|
1183
|
+
{
|
|
1184
|
+
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
virtual bool isConstDataOrAggData() const
|
|
1188
|
+
{
|
|
1189
|
+
return true;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1193
|
+
{
|
|
1194
|
+
return true;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
virtual const std::string toString() const;
|
|
1198
|
+
};
|
|
1199
|
+
|
|
1200
|
+
|
|
1097
1201
|
class ConstantDataValVar: public ValVar
|
|
1098
1202
|
{
|
|
1099
1203
|
friend class SVFIRWriter;
|
|
@@ -1132,6 +1236,16 @@ public:
|
|
|
1132
1236
|
|
|
1133
1237
|
}
|
|
1134
1238
|
|
|
1239
|
+
virtual bool isConstDataOrAggData() const
|
|
1240
|
+
{
|
|
1241
|
+
return true;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1245
|
+
{
|
|
1246
|
+
return true;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1135
1249
|
virtual const std::string toString() const;
|
|
1136
1250
|
};
|
|
1137
1251
|
|
|
@@ -1176,6 +1290,11 @@ public:
|
|
|
1176
1290
|
|
|
1177
1291
|
}
|
|
1178
1292
|
|
|
1293
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1294
|
+
{
|
|
1295
|
+
return false;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1179
1298
|
virtual const std::string toString() const
|
|
1180
1299
|
{
|
|
1181
1300
|
return "BlackHoleVar";
|
|
@@ -1334,6 +1453,11 @@ public:
|
|
|
1334
1453
|
|
|
1335
1454
|
}
|
|
1336
1455
|
|
|
1456
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1457
|
+
{
|
|
1458
|
+
return false;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1337
1461
|
virtual const std::string toString() const;
|
|
1338
1462
|
};
|
|
1339
1463
|
|
|
@@ -1386,6 +1510,62 @@ public:
|
|
|
1386
1510
|
virtual const std::string toString() const;
|
|
1387
1511
|
};
|
|
1388
1512
|
|
|
1513
|
+
class ConstantAggObjVar: public BaseObjVar
|
|
1514
|
+
{
|
|
1515
|
+
friend class SVFIRWriter;
|
|
1516
|
+
friend class SVFIRReader;
|
|
1517
|
+
|
|
1518
|
+
public:
|
|
1519
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
1520
|
+
//@{
|
|
1521
|
+
static inline bool classof(const ConstantAggObjVar*)
|
|
1522
|
+
{
|
|
1523
|
+
return true;
|
|
1524
|
+
}
|
|
1525
|
+
static inline bool classof(const BaseObjVar* node)
|
|
1526
|
+
{
|
|
1527
|
+
return node->getNodeKind() == ConstantAggObjNode;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
static inline bool classof(const ObjVar* node)
|
|
1531
|
+
{
|
|
1532
|
+
return node->getNodeKind() == ConstantAggObjNode;
|
|
1533
|
+
}
|
|
1534
|
+
static inline bool classof(const SVFVar* node)
|
|
1535
|
+
{
|
|
1536
|
+
return node->getNodeKind() == ConstantAggObjNode;
|
|
1537
|
+
}
|
|
1538
|
+
static inline bool classof(const GenericPAGNodeTy* node)
|
|
1539
|
+
{
|
|
1540
|
+
return node->getNodeKind() == ConstantAggObjNode;
|
|
1541
|
+
}
|
|
1542
|
+
static inline bool classof(const SVFBaseNode* node)
|
|
1543
|
+
{
|
|
1544
|
+
return node->getNodeKind() == ConstantAggObjNode;
|
|
1545
|
+
}
|
|
1546
|
+
//@}
|
|
1547
|
+
|
|
1548
|
+
/// Constructor
|
|
1549
|
+
ConstantAggObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti,
|
|
1550
|
+
PNODEK ty = ConstantAggObjNode)
|
|
1551
|
+
: BaseObjVar(val, i, ti, ty)
|
|
1552
|
+
{
|
|
1553
|
+
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
virtual bool isConstDataOrAggData() const
|
|
1557
|
+
{
|
|
1558
|
+
return true;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1562
|
+
{
|
|
1563
|
+
return true;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
virtual const std::string toString() const;
|
|
1567
|
+
};
|
|
1568
|
+
|
|
1389
1569
|
class ConstantDataObjVar: public BaseObjVar
|
|
1390
1570
|
{
|
|
1391
1571
|
friend class SVFIRWriter;
|
|
@@ -1430,6 +1610,16 @@ public:
|
|
|
1430
1610
|
{
|
|
1431
1611
|
}
|
|
1432
1612
|
|
|
1613
|
+
virtual bool isConstDataOrAggData() const
|
|
1614
|
+
{
|
|
1615
|
+
return true;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1619
|
+
{
|
|
1620
|
+
return true;
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1433
1623
|
virtual const std::string toString() const;
|
|
1434
1624
|
};
|
|
1435
1625
|
|
|
@@ -1617,6 +1807,10 @@ public:
|
|
|
1617
1807
|
{
|
|
1618
1808
|
}
|
|
1619
1809
|
|
|
1810
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1811
|
+
{
|
|
1812
|
+
return false;
|
|
1813
|
+
}
|
|
1620
1814
|
|
|
1621
1815
|
virtual const std::string toString() const;
|
|
1622
1816
|
};
|
|
@@ -70,8 +70,7 @@ void BufOverflowDetector::detect(AbstractState& as, const ICFGNode* node)
|
|
|
70
70
|
}
|
|
71
71
|
else
|
|
72
72
|
{
|
|
73
|
-
const ICFGNode* addrNode =
|
|
74
|
-
svfir->getBaseObject(objId)->getGNode());
|
|
73
|
+
const ICFGNode* addrNode = svfir->getBaseObject(objId)->getICFGNode();
|
|
75
74
|
for (const SVFStmt* stmt2 : addrNode->getSVFStmts())
|
|
76
75
|
{
|
|
77
76
|
if (const AddrStmt* addrStmt = SVFUtil::dyn_cast<AddrStmt>(stmt2))
|
|
@@ -472,8 +471,7 @@ bool BufOverflowDetector::canSafelyAccessMemory(AbstractState& as, const SVF::SV
|
|
|
472
471
|
else
|
|
473
472
|
{
|
|
474
473
|
// if the object is not a constant size object, get the size from the addrStmt
|
|
475
|
-
const ICFGNode* addrNode =
|
|
476
|
-
svfir->getBaseObject(objId)->getGNode());
|
|
474
|
+
const ICFGNode* addrNode = svfir->getBaseObject(objId)->getICFGNode();
|
|
477
475
|
for (const SVFStmt* stmt2 : addrNode->getSVFStmts())
|
|
478
476
|
{
|
|
479
477
|
if (const AddrStmt* addrStmt = SVFUtil::dyn_cast<AddrStmt>(stmt2))
|
|
@@ -284,7 +284,7 @@ void AbsExtAPI::initExtFunMap()
|
|
|
284
284
|
}
|
|
285
285
|
else
|
|
286
286
|
{
|
|
287
|
-
const ICFGNode* addrNode =
|
|
287
|
+
const ICFGNode* addrNode = svfir->getBaseObject(objId)->getICFGNode();
|
|
288
288
|
for (const SVFStmt* stmt2: addrNode->getSVFStmts())
|
|
289
289
|
{
|
|
290
290
|
if (const AddrStmt* addrStmt = SVFUtil::dyn_cast<AddrStmt>(stmt2))
|
|
@@ -478,7 +478,7 @@ IntervalValue AbsExtAPI::getStrlen(AbstractState& as, const SVF::SVFVar *strValu
|
|
|
478
478
|
}
|
|
479
479
|
else
|
|
480
480
|
{
|
|
481
|
-
const ICFGNode* icfgNode =
|
|
481
|
+
const ICFGNode* icfgNode = svfir->getBaseObject(objId)->getICFGNode();
|
|
482
482
|
for (const SVFStmt* stmt2: icfgNode->getSVFStmts())
|
|
483
483
|
{
|
|
484
484
|
if (const AddrStmt* addrStmt = SVFUtil::dyn_cast<AddrStmt>(stmt2))
|
|
@@ -340,7 +340,7 @@ bool ContextDDA::isHeapCondMemObj(const CxtVar& var, const StoreSVFGNode*)
|
|
|
340
340
|
assert(baseVar && "base object is null??");
|
|
341
341
|
if (SVFUtil::isa<HeapObjVar, DummyObjVar>(baseVar))
|
|
342
342
|
{
|
|
343
|
-
if (!
|
|
343
|
+
if (!isa<DummyObjVar>(baseVar))
|
|
344
344
|
{
|
|
345
345
|
PAGNode *pnode = _pag->getGNode(getPtrNodeID(var));
|
|
346
346
|
GepObjVar* gepobj = SVFUtil::dyn_cast<GepObjVar>(pnode);
|
|
@@ -356,19 +356,15 @@ bool ContextDDA::isHeapCondMemObj(const CxtVar& var, const StoreSVFGNode*)
|
|
|
356
356
|
}
|
|
357
357
|
return true;
|
|
358
358
|
}
|
|
359
|
-
else if(const
|
|
359
|
+
else if(const ICFGNode* node = obj->getICFGNode())
|
|
360
360
|
{
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
return true;
|
|
369
|
-
if(_pag->getICFG()->isInLoop(node))
|
|
370
|
-
return true;
|
|
371
|
-
}
|
|
361
|
+
const SVFFunction* svfFun = node->getFun();
|
|
362
|
+
if(_ander->isInRecursion(svfFun))
|
|
363
|
+
return true;
|
|
364
|
+
if(var.get_cond().isConcreteCxt() == false)
|
|
365
|
+
return true;
|
|
366
|
+
if(_pag->getICFG()->isInLoop(node))
|
|
367
|
+
return true;
|
|
372
368
|
}
|
|
373
369
|
}
|
|
374
370
|
return false;
|