svf-tools 1.0.1030 → 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 +205 -10
- package/svf/lib/DDA/ContextDDA.cpp +1 -1
- 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/VFG.cpp +9 -24
- package/svf/lib/MemoryModel/PointerAnalysis.cpp +23 -23
- 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/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 +1 -0
- package/svf-llvm/lib/LLVMUtil.cpp +19 -4
- package/svf-llvm/lib/SVFIRBuilder.cpp +27 -15
- 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,6 +551,20 @@ 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
|
/*
|
|
@@ -716,7 +755,7 @@ public:
|
|
|
716
755
|
{
|
|
717
756
|
return typeInfo->isConstDataOrConstGlobal();
|
|
718
757
|
}
|
|
719
|
-
bool isConstDataOrAggData() const
|
|
758
|
+
virtual inline bool isConstDataOrAggData() const
|
|
720
759
|
{
|
|
721
760
|
return typeInfo->isConstDataOrAggData();
|
|
722
761
|
}
|
|
@@ -781,7 +820,6 @@ public:
|
|
|
781
820
|
const APOffset& apOffset, PNODEK ty = GepObjNode)
|
|
782
821
|
: ObjVar(baseObj->hasValue()? baseObj->getValue(): nullptr, i, ty), apOffset(apOffset), base(baseObj)
|
|
783
822
|
{
|
|
784
|
-
|
|
785
823
|
}
|
|
786
824
|
|
|
787
825
|
/// offset of the mem object
|
|
@@ -816,6 +854,21 @@ public:
|
|
|
816
854
|
}
|
|
817
855
|
|
|
818
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
|
+
}
|
|
819
872
|
};
|
|
820
873
|
|
|
821
874
|
|
|
@@ -1093,6 +1146,58 @@ public:
|
|
|
1093
1146
|
virtual const std::string toString() const;
|
|
1094
1147
|
};
|
|
1095
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
|
+
|
|
1096
1201
|
class ConstantDataValVar: public ValVar
|
|
1097
1202
|
{
|
|
1098
1203
|
friend class SVFIRWriter;
|
|
@@ -1131,6 +1236,16 @@ public:
|
|
|
1131
1236
|
|
|
1132
1237
|
}
|
|
1133
1238
|
|
|
1239
|
+
virtual bool isConstDataOrAggData() const
|
|
1240
|
+
{
|
|
1241
|
+
return true;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1245
|
+
{
|
|
1246
|
+
return true;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1134
1249
|
virtual const std::string toString() const;
|
|
1135
1250
|
};
|
|
1136
1251
|
|
|
@@ -1175,6 +1290,11 @@ public:
|
|
|
1175
1290
|
|
|
1176
1291
|
}
|
|
1177
1292
|
|
|
1293
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1294
|
+
{
|
|
1295
|
+
return false;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1178
1298
|
virtual const std::string toString() const
|
|
1179
1299
|
{
|
|
1180
1300
|
return "BlackHoleVar";
|
|
@@ -1333,6 +1453,11 @@ public:
|
|
|
1333
1453
|
|
|
1334
1454
|
}
|
|
1335
1455
|
|
|
1456
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1457
|
+
{
|
|
1458
|
+
return false;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1336
1461
|
virtual const std::string toString() const;
|
|
1337
1462
|
};
|
|
1338
1463
|
|
|
@@ -1385,6 +1510,62 @@ public:
|
|
|
1385
1510
|
virtual const std::string toString() const;
|
|
1386
1511
|
};
|
|
1387
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
|
+
|
|
1388
1569
|
class ConstantDataObjVar: public BaseObjVar
|
|
1389
1570
|
{
|
|
1390
1571
|
friend class SVFIRWriter;
|
|
@@ -1429,6 +1610,16 @@ public:
|
|
|
1429
1610
|
{
|
|
1430
1611
|
}
|
|
1431
1612
|
|
|
1613
|
+
virtual bool isConstDataOrAggData() const
|
|
1614
|
+
{
|
|
1615
|
+
return true;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1619
|
+
{
|
|
1620
|
+
return true;
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1432
1623
|
virtual const std::string toString() const;
|
|
1433
1624
|
};
|
|
1434
1625
|
|
|
@@ -1616,6 +1807,10 @@ public:
|
|
|
1616
1807
|
{
|
|
1617
1808
|
}
|
|
1618
1809
|
|
|
1810
|
+
virtual bool isConstDataOrAggDataButNotNullPtr() const
|
|
1811
|
+
{
|
|
1812
|
+
return false;
|
|
1813
|
+
}
|
|
1619
1814
|
|
|
1620
1815
|
virtual const std::string toString() const;
|
|
1621
1816
|
};
|
|
@@ -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);
|
|
@@ -213,17 +213,12 @@ void AliasDDAClient::performStat(PointerAnalysis* pta)
|
|
|
213
213
|
{
|
|
214
214
|
const PAGNode* node1 = *lit;
|
|
215
215
|
const PAGNode* node2 = *sit;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
outs() << node2->getValue()->toString() << ") \n";
|
|
223
|
-
outs() << "[NodeID:" << node1->getId() << ", NodeID:" << node2->getId() << " " << result << "]\n";
|
|
224
|
-
outs() << "=================================================\n";
|
|
225
|
-
|
|
226
|
-
}
|
|
216
|
+
AliasResult result = pta->alias(node1->getId(), node2->getId());
|
|
217
|
+
outs() << "\n=================================================\n";
|
|
218
|
+
outs() << "Alias Query for (" << node1->valueOnlyToString() << ",";
|
|
219
|
+
outs() << node2->valueOnlyToString() << ") \n";
|
|
220
|
+
outs() << "[NodeID:" << node1->getId() << ", NodeID:" << node2->getId() << " " << result << "]\n";
|
|
221
|
+
outs() << "=================================================\n";
|
|
227
222
|
}
|
|
228
223
|
}
|
|
229
224
|
}
|
package/svf/lib/Graphs/CHG.cpp
CHANGED
|
@@ -127,7 +127,7 @@ void CHGraph::getVFnsFromVtbls(const CallICFGNode* callsite, const VTableSet &vt
|
|
|
127
127
|
size_t idx = callsite->getFunIdxInVtable();
|
|
128
128
|
/// get the function name of the virtual callsite
|
|
129
129
|
string funName = callsite->getFunNameOfVirtualCall();
|
|
130
|
-
for (const
|
|
130
|
+
for (const GlobalObjVar *vt : vtbls)
|
|
131
131
|
{
|
|
132
132
|
const CHNode *child = getNode(vt->getName());
|
|
133
133
|
if (child == nullptr)
|
package/svf/lib/Graphs/ConsG.cpp
CHANGED
|
@@ -775,7 +775,7 @@ struct DOTGraphTraits<ConstraintGraph*> : public DOTGraphTraits<SVFIR*>
|
|
|
775
775
|
if (SVFUtil::isa<ValVar>(node))
|
|
776
776
|
{
|
|
777
777
|
if (nameDisplay)
|
|
778
|
-
rawstr << node->getId() << ":" << node->
|
|
778
|
+
rawstr << node->getId() << ":" << node->getName();
|
|
779
779
|
else
|
|
780
780
|
rawstr << node->getId();
|
|
781
781
|
}
|
package/svf/lib/Graphs/VFG.cpp
CHANGED
|
@@ -125,10 +125,7 @@ const std::string CmpVFGNode::toString() const
|
|
|
125
125
|
it != eit; it++)
|
|
126
126
|
rawstr << it->second->getId() << ", ";
|
|
127
127
|
rawstr << ")]\n";
|
|
128
|
-
|
|
129
|
-
{
|
|
130
|
-
rawstr << " " << res->getValue()->toString();
|
|
131
|
-
}
|
|
128
|
+
rawstr << " " << res->valueOnlyToString();
|
|
132
129
|
return rawstr.str();
|
|
133
130
|
}
|
|
134
131
|
|
|
@@ -149,10 +146,7 @@ const std::string BinaryOPVFGNode::toString() const
|
|
|
149
146
|
it != eit; it++)
|
|
150
147
|
rawstr << it->second->getId() << ", ";
|
|
151
148
|
rawstr << ")]\t";
|
|
152
|
-
|
|
153
|
-
{
|
|
154
|
-
rawstr << " " << res->getValue()->toString();
|
|
155
|
-
}
|
|
149
|
+
rawstr << " " << res->valueOnlyToString();
|
|
156
150
|
return rawstr.str();
|
|
157
151
|
}
|
|
158
152
|
|
|
@@ -173,10 +167,7 @@ const std::string UnaryOPVFGNode::toString() const
|
|
|
173
167
|
it != eit; it++)
|
|
174
168
|
rawstr << it->second->getId() << ", ";
|
|
175
169
|
rawstr << ")]\t";
|
|
176
|
-
|
|
177
|
-
{
|
|
178
|
-
rawstr << " " << res->getValue()->toString();
|
|
179
|
-
}
|
|
170
|
+
rawstr << " " << res->valueOnlyToString();
|
|
180
171
|
return rawstr.str();
|
|
181
172
|
}
|
|
182
173
|
|
|
@@ -227,10 +218,7 @@ const std::string PHIVFGNode::toString() const
|
|
|
227
218
|
it != eit; it++)
|
|
228
219
|
rawstr << it->second->getId() << ", ";
|
|
229
220
|
rawstr << ")]\t";
|
|
230
|
-
|
|
231
|
-
{
|
|
232
|
-
rawstr << " " << res->getValue()->toString();
|
|
233
|
-
}
|
|
221
|
+
rawstr << " " << res->valueOnlyToString();
|
|
234
222
|
return rawstr.str();
|
|
235
223
|
}
|
|
236
224
|
|
|
@@ -245,10 +233,7 @@ const std::string IntraPHIVFGNode::toString() const
|
|
|
245
233
|
it != eit; it++)
|
|
246
234
|
rawstr << it->second->getId() << ", ";
|
|
247
235
|
rawstr << ")]\t";
|
|
248
|
-
|
|
249
|
-
{
|
|
250
|
-
rawstr << " " << res->getValue()->toString();
|
|
251
|
-
}
|
|
236
|
+
rawstr << " " << res->valueOnlyToString();
|
|
252
237
|
return rawstr.str();
|
|
253
238
|
}
|
|
254
239
|
|
|
@@ -353,9 +338,9 @@ const std::string InterPHIVFGNode::toString() const
|
|
|
353
338
|
std::string str;
|
|
354
339
|
std::stringstream rawstr(str);
|
|
355
340
|
if(isFormalParmPHI())
|
|
356
|
-
rawstr << "FormalParmPHI ID: " << getId() << " PAGNode ID: " << res->getId() << "\n" << res->
|
|
341
|
+
rawstr << "FormalParmPHI ID: " << getId() << " PAGNode ID: " << res->getId() << "\n" << res->valueOnlyToString();
|
|
357
342
|
else
|
|
358
|
-
rawstr << "ActualRetPHI ID: " << getId() << " PAGNode ID: " << res->getId() << "\n" << res->
|
|
343
|
+
rawstr << "ActualRetPHI ID: " << getId() << " PAGNode ID: " << res->getId() << "\n" << res->valueOnlyToString();
|
|
359
344
|
return rawstr.str();
|
|
360
345
|
}
|
|
361
346
|
|
|
@@ -1090,12 +1075,12 @@ const SVFVar* BinaryOPVFGNode::getValue() const
|
|
|
1090
1075
|
|
|
1091
1076
|
const SVFVar* PHIVFGNode::getValue() const
|
|
1092
1077
|
{
|
|
1093
|
-
return getRes()
|
|
1078
|
+
return getRes();
|
|
1094
1079
|
}
|
|
1095
1080
|
|
|
1096
1081
|
const SVFVar* ArgumentVFGNode::getValue() const
|
|
1097
1082
|
{
|
|
1098
|
-
return param
|
|
1083
|
+
return param;
|
|
1099
1084
|
}
|
|
1100
1085
|
|
|
1101
1086
|
/*!
|
|
@@ -239,11 +239,11 @@ void PointerAnalysis::dumpAllTypes()
|
|
|
239
239
|
if (SVFUtil::isa<DummyObjVar, DummyValVar>(node))
|
|
240
240
|
continue;
|
|
241
241
|
|
|
242
|
-
outs() << "##<" << node->
|
|
243
|
-
outs() << "Source Loc: " << node->
|
|
242
|
+
outs() << "##<" << node->getName() << "> ";
|
|
243
|
+
outs() << "Source Loc: " << node->getSourceLoc();
|
|
244
244
|
outs() << "\nNodeID " << node->getId() << "\n";
|
|
245
245
|
|
|
246
|
-
const SVFType* type = node->
|
|
246
|
+
const SVFType* type = node->getType();
|
|
247
247
|
pag->getSymbolInfo()->printFlattenFields(type);
|
|
248
248
|
}
|
|
249
249
|
}
|
|
@@ -262,11 +262,8 @@ void PointerAnalysis::dumpPts(NodeID ptr, const PointsTo& pts)
|
|
|
262
262
|
}
|
|
263
263
|
else if (!SVFUtil::isa<DummyValVar>(node) && !SVFModule::pagReadFromTXT())
|
|
264
264
|
{
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
outs() << "##<" << node->getValue()->getName() << "> ";
|
|
268
|
-
outs() << "Source Loc: " << node->getValue()->getSourceLoc();
|
|
269
|
-
}
|
|
265
|
+
outs() << "##<" << node->getName() << "> ";
|
|
266
|
+
outs() << "Source Loc: " << node->getSourceLoc();
|
|
270
267
|
}
|
|
271
268
|
outs() << "\nPtr " << node->getId() << " ";
|
|
272
269
|
|
|
@@ -301,12 +298,9 @@ void PointerAnalysis::dumpPts(NodeID ptr, const PointsTo& pts)
|
|
|
301
298
|
{
|
|
302
299
|
if (!SVFModule::pagReadFromTXT())
|
|
303
300
|
{
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
outs() << "Source Loc: "
|
|
308
|
-
<< pagNode->getValue()->getSourceLoc() << "] \n";
|
|
309
|
-
}
|
|
301
|
+
outs() << "<" << pagNode->getName() << "> ";
|
|
302
|
+
outs() << "Source Loc: "
|
|
303
|
+
<< pagNode->getSourceLoc() << "] \n";
|
|
310
304
|
}
|
|
311
305
|
}
|
|
312
306
|
}
|
|
@@ -439,22 +433,28 @@ void PointerAnalysis::getVFnsFromPts(const CallICFGNode* cs, const PointsTo &tar
|
|
|
439
433
|
|
|
440
434
|
if (chgraph->csHasVtblsBasedonCHA(cs))
|
|
441
435
|
{
|
|
442
|
-
Set<const
|
|
436
|
+
Set<const GlobalObjVar*> vtbls;
|
|
443
437
|
const VTableSet &chaVtbls = chgraph->getCSVtblsBasedonCHA(cs);
|
|
444
438
|
for (PointsTo::iterator it = target.begin(), eit = target.end(); it != eit; ++it)
|
|
445
439
|
{
|
|
446
440
|
const PAGNode *ptdnode = pag->getGNode(*it);
|
|
447
|
-
|
|
441
|
+
const GlobalObjVar* pVar = nullptr;
|
|
442
|
+
if (isa<ObjVar>(ptdnode) && isa<GlobalObjVar>(pag->getBaseObject(ptdnode->getId())))
|
|
448
443
|
{
|
|
449
|
-
|
|
450
|
-
|| (isa<ValVar>(ptdnode) && isa<GlobalValVar>(pag->getBaseValVar(ptdnode->getId()))))
|
|
451
|
-
{
|
|
452
|
-
const SVFGlobalValue* globalValue = SVFUtil::dyn_cast<SVFGlobalValue>(ptdnode->getValue());
|
|
453
|
-
if (chaVtbls.find(globalValue) != chaVtbls.end())
|
|
454
|
-
vtbls.insert(globalValue);
|
|
455
|
-
}
|
|
444
|
+
pVar = cast<GlobalObjVar>(pag->getBaseObject(ptdnode->getId()));
|
|
456
445
|
|
|
457
446
|
}
|
|
447
|
+
else if (isa<ValVar>(ptdnode) &&
|
|
448
|
+
isa<GlobalValVar>(
|
|
449
|
+
pag->getBaseValVar(ptdnode->getId())))
|
|
450
|
+
{
|
|
451
|
+
pVar = cast<GlobalObjVar>(
|
|
452
|
+
SVFUtil::getObjVarOfValVar(cast<GlobalValVar>(
|
|
453
|
+
pag->getBaseValVar(ptdnode->getId()))));
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (pVar && chaVtbls.find(pVar) != chaVtbls.end())
|
|
457
|
+
vtbls.insert(pVar);
|
|
458
458
|
}
|
|
459
459
|
chgraph->getVFnsFromVtbls(cs, vtbls, vfns);
|
|
460
460
|
}
|
|
@@ -133,7 +133,7 @@ PointsTo& SaberSVFGBuilder::CollectPtsChain(BVDataPTAImpl* pta, NodeID id, NodeT
|
|
|
133
133
|
// base object
|
|
134
134
|
if (!Options::CollectExtRetGlobals())
|
|
135
135
|
{
|
|
136
|
-
if(pta->isFIObjNode(baseId)
|
|
136
|
+
if(pta->isFIObjNode(baseId))
|
|
137
137
|
{
|
|
138
138
|
ValVar* valVar = SVFUtil::dyn_cast<ValVar>(pag->getGNode(baseId));
|
|
139
139
|
if(valVar && valVar->getICFGNode() && SVFUtil::isExtCall(valVar->getICFGNode()))
|
|
@@ -181,12 +181,14 @@ cJSON* SVFIRWriter::virtToJson(const SVFVar* var)
|
|
|
181
181
|
CASE(HeapObjNode, HeapObjVar);
|
|
182
182
|
CASE(StackObjNode, StackObjVar);
|
|
183
183
|
CASE(ConstantDataValNode, ConstantDataValVar);
|
|
184
|
+
CASE(ConstantAggValNode, ConstantAggValVar);
|
|
184
185
|
CASE(GlobalValNode, GlobalValVar);
|
|
185
186
|
CASE(BlackHoleNode, BlackHoleVar);
|
|
186
187
|
CASE(ConstantFPValNode, ConstantFPValVar);
|
|
187
188
|
CASE(ConstantIntValNode, ConstantIntValVar);
|
|
188
189
|
CASE(ConstantNullptrValNode, ConstantNullPtrValVar);
|
|
189
190
|
CASE(ConstantDataObjNode, ConstantDataObjVar);
|
|
191
|
+
CASE(ConstantAggObjNode, ConstantAggObjVar);
|
|
190
192
|
CASE(GlobalObjNode, GlobalObjVar);
|
|
191
193
|
CASE(ConstantFPObjNode, ConstantFPObjVar);
|
|
192
194
|
CASE(ConstantIntObjNode, ConstantIntObjVar);
|
package/svf/lib/SVFIR/SVFIR.cpp
CHANGED
|
@@ -391,7 +391,7 @@ NodeID SVFIR::addGepValNode(const SVFValue* curInst,const SVFValue* gepVal, cons
|
|
|
391
391
|
assert(0==GepValObjMap[curInst].count(std::make_pair(base, ap))
|
|
392
392
|
&& "this node should not be created before");
|
|
393
393
|
GepValObjMap[curInst][std::make_pair(base, ap)] = i;
|
|
394
|
-
GepValVar *node = new GepValVar(base, gepVal, i, ap, type);
|
|
394
|
+
GepValVar *node = new GepValVar(cast<ValVar>(getGNode(base)), gepVal, i, ap, type);
|
|
395
395
|
return addValNode(gepVal, node);
|
|
396
396
|
}
|
|
397
397
|
|
|
@@ -645,13 +645,11 @@ bool SVFIR::isValidPointer(NodeID nodeId) const
|
|
|
645
645
|
{
|
|
646
646
|
SVFVar* node = pag->getGNode(nodeId);
|
|
647
647
|
|
|
648
|
-
if
|
|
649
|
-
{
|
|
648
|
+
if(node->isPointer())
|
|
650
649
|
if (const ValVar* pVar = pag->getBaseValVar(nodeId))
|
|
651
650
|
if (const ArgValVar* arg = SVFUtil::dyn_cast<ArgValVar>(pVar))
|
|
652
651
|
if (!(arg->getParent()->isDeclaration()))
|
|
653
652
|
return true;
|
|
654
|
-
}
|
|
655
653
|
|
|
656
654
|
if ((node->getInEdges().empty() && node->getOutEdges().empty()))
|
|
657
655
|
return false;
|
|
@@ -664,13 +662,9 @@ bool SVFIR::isValidTopLevelPtr(const SVFVar* node)
|
|
|
664
662
|
{
|
|
665
663
|
if (isValidPointer(node->getId()))
|
|
666
664
|
{
|
|
667
|
-
|
|
668
|
-
if
|
|
669
|
-
|
|
670
|
-
return true;
|
|
671
|
-
}
|
|
672
|
-
else if(node->hasValue())
|
|
673
|
-
return !SVFUtil::isArgOfUncalledFunction(node);
|
|
665
|
+
const ValVar* baseVar = pag->getBaseValVar(node->getId());
|
|
666
|
+
if(!SVFUtil::isa<DummyValVar, BlackHoleVar>(baseVar))
|
|
667
|
+
return !SVFUtil::isArgOfUncalledFunction(baseVar);
|
|
674
668
|
}
|
|
675
669
|
}
|
|
676
670
|
return false;
|
|
@@ -48,6 +48,7 @@ SVFVar::SVFVar(const SVFValue* val, NodeID i, PNODEK k) :
|
|
|
48
48
|
case ValNode:
|
|
49
49
|
case ArgNode:
|
|
50
50
|
case ConstantDataValNode:
|
|
51
|
+
case ConstantAggValNode:
|
|
51
52
|
case GlobalValNode:
|
|
52
53
|
case BlackHoleNode:
|
|
53
54
|
case ConstantFPValNode:
|
|
@@ -69,6 +70,7 @@ SVFVar::SVFVar(const SVFValue* val, NodeID i, PNODEK k) :
|
|
|
69
70
|
case ObjNode:
|
|
70
71
|
case GepObjNode:
|
|
71
72
|
case BaseObjNode:
|
|
73
|
+
case ConstantAggObjNode:
|
|
72
74
|
case ConstantDataObjNode:
|
|
73
75
|
case GlobalObjNode:
|
|
74
76
|
case ConstantFPObjNode:
|
|
@@ -178,6 +180,13 @@ const std::string ArgValVar::toString() const
|
|
|
178
180
|
return rawstr.str();
|
|
179
181
|
}
|
|
180
182
|
|
|
183
|
+
GepValVar::GepValVar(ValVar* baseNode, const SVFValue* val, NodeID i,
|
|
184
|
+
const AccessPath& ap, const SVFType* ty)
|
|
185
|
+
: ValVar(val, i, GepValNode), ap(ap), base(baseNode), gepValType(ty)
|
|
186
|
+
{
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
|
|
181
190
|
const std::string GepValVar::toString() const
|
|
182
191
|
{
|
|
183
192
|
std::string str;
|
|
@@ -191,6 +200,8 @@ const std::string GepValVar::toString() const
|
|
|
191
200
|
return rawstr.str();
|
|
192
201
|
}
|
|
193
202
|
|
|
203
|
+
|
|
204
|
+
|
|
194
205
|
RetPN::RetPN(NodeID i, const CallGraphNode* node) : ValVar(i, RetNode), callGraphNode(node)
|
|
195
206
|
{
|
|
196
207
|
isPtr = node->getFunction()->getReturnType()->isPointerTy();
|
|
@@ -280,6 +291,18 @@ const std::string FunValVar::toString() const
|
|
|
280
291
|
return rawstr.str();
|
|
281
292
|
}
|
|
282
293
|
|
|
294
|
+
const std::string ConstantAggValVar::toString() const
|
|
295
|
+
{
|
|
296
|
+
std::string str;
|
|
297
|
+
std::stringstream rawstr(str);
|
|
298
|
+
rawstr << "ConstantAggValNode ID: " << getId();
|
|
299
|
+
if (Options::ShowSVFIRValue())
|
|
300
|
+
{
|
|
301
|
+
rawstr << "\n";
|
|
302
|
+
rawstr << valueOnlyToString();
|
|
303
|
+
}
|
|
304
|
+
return rawstr.str();
|
|
305
|
+
}
|
|
283
306
|
const std::string ConstantDataValVar::toString() const
|
|
284
307
|
{
|
|
285
308
|
std::string str;
|
|
@@ -357,7 +380,18 @@ const std::string GlobalObjVar::toString() const
|
|
|
357
380
|
}
|
|
358
381
|
return rawstr.str();
|
|
359
382
|
}
|
|
360
|
-
|
|
383
|
+
const std::string ConstantAggObjVar::toString() const
|
|
384
|
+
{
|
|
385
|
+
std::string str;
|
|
386
|
+
std::stringstream rawstr(str);
|
|
387
|
+
rawstr << "ConstantAggObjVar ID: " << getId();
|
|
388
|
+
if (Options::ShowSVFIRValue())
|
|
389
|
+
{
|
|
390
|
+
rawstr << "\n";
|
|
391
|
+
rawstr << valueOnlyToString();
|
|
392
|
+
}
|
|
393
|
+
return rawstr.str();
|
|
394
|
+
}
|
|
361
395
|
const std::string ConstantDataObjVar::toString() const
|
|
362
396
|
{
|
|
363
397
|
std::string str;
|
|
@@ -482,12 +516,3 @@ const std::string DummyObjVar::toString() const
|
|
|
482
516
|
return rawstr.str();
|
|
483
517
|
}
|
|
484
518
|
|
|
485
|
-
/// Whether it is constant data, i.e., "0", "1.001", "str"
|
|
486
|
-
/// or llvm's metadata, i.e., metadata !4087
|
|
487
|
-
bool SVFVar::isConstDataOrAggDataButNotNullPtr() const
|
|
488
|
-
{
|
|
489
|
-
if (hasValue())
|
|
490
|
-
return value->isConstDataOrAggData() && (!SVFUtil::isa<SVFConstantNullPtr>(value)) && (!SVFUtil::isa<SVFBlackHoleValue>(value));
|
|
491
|
-
else
|
|
492
|
-
return false;
|
|
493
|
-
}
|
|
@@ -237,11 +237,11 @@ void AndersenStat::statNullPtr()
|
|
|
237
237
|
if (!SVFUtil::isa<DummyValVar>(pagNode) && !SVFUtil::isa<DummyObjVar>(pagNode) )
|
|
238
238
|
{
|
|
239
239
|
// if a pointer is in dead function, we do not care
|
|
240
|
-
if(pagNode->
|
|
240
|
+
if(pagNode->ptrInUncalledFunction() == false)
|
|
241
241
|
{
|
|
242
242
|
_NumOfNullPtr++;
|
|
243
243
|
rawstr << "##Null Pointer : (NodeID " << pagNode->getId()
|
|
244
|
-
<< ") PtrName:" << pagNode->
|
|
244
|
+
<< ") PtrName:" << pagNode->getName();
|
|
245
245
|
writeWrnMsg(rawstr.str());
|
|
246
246
|
//pagNode->getValue()->dump();
|
|
247
247
|
}
|
|
@@ -296,11 +296,11 @@ void FlowSensitiveStat::statNullPtr()
|
|
|
296
296
|
if (!SVFUtil::isa<DummyValVar>(pagNode) && !SVFUtil::isa<DummyObjVar>(pagNode))
|
|
297
297
|
{
|
|
298
298
|
// if a pointer is in dead function, we do not care
|
|
299
|
-
if(pagNode->
|
|
299
|
+
if(pagNode->ptrInUncalledFunction() == false)
|
|
300
300
|
{
|
|
301
301
|
_NumOfNullPtr++;
|
|
302
302
|
rawstr << "##Null Pointer : (NodeID " << pagNode->getId()
|
|
303
|
-
<< ") PtrName:" << pagNode->
|
|
303
|
+
<< ") PtrName:" << pagNode->getName();
|
|
304
304
|
writeWrnMsg(rawstr.str());
|
|
305
305
|
}
|
|
306
306
|
}
|
package/svf/lib/WPA/WPAPass.cpp
CHANGED
|
@@ -146,9 +146,9 @@ void WPAPass::PrintAliasPairs(PointerAnalysis* pta)
|
|
|
146
146
|
const SVFFunction* fun2 = node2->getFunction();
|
|
147
147
|
AliasResult result = pta->alias(node1->getId(), node2->getId());
|
|
148
148
|
SVFUtil::outs() << (result == AliasResult::NoAlias ? "NoAlias" : "MayAlias")
|
|
149
|
-
<< " var" << node1->getId() << "[" << node1->
|
|
149
|
+
<< " var" << node1->getId() << "[" << node1->getName()
|
|
150
150
|
<< "@" << (fun1==nullptr?"":fun1->getName()) << "] --"
|
|
151
|
-
<< " var" << node2->getId() << "[" << node2->
|
|
151
|
+
<< " var" << node2->getId() << "[" << node2->getName()
|
|
152
152
|
<< "@" << (fun2==nullptr?"":fun2->getName()) << "]\n";
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -98,7 +98,7 @@ public:
|
|
|
98
98
|
return diType;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
std::string getName() const
|
|
101
|
+
virtual const std::string& getName() const
|
|
102
102
|
{
|
|
103
103
|
return typeName;
|
|
104
104
|
}
|
|
@@ -161,12 +161,12 @@ public:
|
|
|
161
161
|
return typedefs;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
void setVTable(const
|
|
164
|
+
void setVTable(const GlobalObjVar *vtbl)
|
|
165
165
|
{
|
|
166
166
|
vtable = vtbl;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
const
|
|
169
|
+
const GlobalObjVar *getVTable() const
|
|
170
170
|
{
|
|
171
171
|
return vtable;
|
|
172
172
|
}
|
|
@@ -193,7 +193,7 @@ private:
|
|
|
193
193
|
const DIType *diType;
|
|
194
194
|
/// Typedefs which map to this type.
|
|
195
195
|
Set<const DIDerivedType *> typedefs;
|
|
196
|
-
const
|
|
196
|
+
const GlobalObjVar* vtable;
|
|
197
197
|
std::string typeName;
|
|
198
198
|
size_t flags;
|
|
199
199
|
/// The virtual functions which this class actually defines/overrides.
|
|
@@ -365,7 +365,7 @@ protected:
|
|
|
365
365
|
/// Maps DITypes to their nodes.
|
|
366
366
|
Map<const DIType*, DCHNode*> diTypeToNodeMap;
|
|
367
367
|
/// Maps VTables to the DIType associated with them.
|
|
368
|
-
Map<const
|
|
368
|
+
Map<const GlobalObjVar*, const DIType*> vtblToTypeMap;
|
|
369
369
|
/// Maps types to all children (i.e. CHA).
|
|
370
370
|
Map<const DIType*, NodeBS> chaMap;
|
|
371
371
|
/// Maps types to all children but also considering first field.
|
|
@@ -273,8 +273,7 @@ protected:
|
|
|
273
273
|
LLVMContext& cxt = llvmModuleSet()->getContext();
|
|
274
274
|
ConstantPointerNull* constNull = ConstantPointerNull::get(PointerType::getUnqual(cxt));
|
|
275
275
|
NodeID nullPtr = pag->addConstantNullPtrValNode(llvmModuleSet()->getSVFValue(constNull),pag->getNullPtr(), nullptr);
|
|
276
|
-
llvmModuleSet()->addToSVFVar2LLVMValueMap(
|
|
277
|
-
constNull, pag->getGNode(pag->getNullPtr()));
|
|
276
|
+
llvmModuleSet()->addToSVFVar2LLVMValueMap(constNull, pag->getGNode(pag->getNullPtr()));
|
|
278
277
|
setCurrentLocation(constNull, nullptr);
|
|
279
278
|
addBlackHoleAddrEdge(pag->getBlkPtr());
|
|
280
279
|
return nullPtr;
|
|
@@ -377,12 +377,11 @@ void CHGBuilder::analyzeVTables(const Module &M)
|
|
|
377
377
|
string vtblClassName = getClassNameFromVtblObj(globalvalue->getName().str());
|
|
378
378
|
CHNode *node = chg->getNode(vtblClassName);
|
|
379
379
|
assert(node && "node not found?");
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
node->setVTable(pValue);
|
|
380
|
+
SymID i = SymbolTableInfo::SymbolInfo()->getObjSym(llvmModuleSet()->getSVFGlobalValue(globalvalue));
|
|
381
|
+
SVFVar* pVar = PAG::getPAG()->getGNode(i);
|
|
382
|
+
GlobalObjVar* globalObjVar = SVFUtil::cast<GlobalObjVar>(pVar);
|
|
383
|
+
globalObjVar->setName(vtblClassName);
|
|
384
|
+
node->setVTable(globalObjVar);
|
|
386
385
|
|
|
387
386
|
for (unsigned int ei = 0; ei < vtblStruct->getNumOperands(); ++ei)
|
|
388
387
|
{
|
|
@@ -675,7 +674,7 @@ void CHGBuilder::buildCSToCHAVtblsAndVfnsMap()
|
|
|
675
674
|
for (CHNodeSetTy::const_iterator it = chClasses.begin(), eit = chClasses.end(); it != eit; ++it)
|
|
676
675
|
{
|
|
677
676
|
const CHNode *child = *it;
|
|
678
|
-
const
|
|
677
|
+
const GlobalObjVar *vtbl = child->getVTable();
|
|
679
678
|
if (vtbl != nullptr)
|
|
680
679
|
{
|
|
681
680
|
vtbls.insert(vtbl);
|
package/svf-llvm/lib/DCHG.cpp
CHANGED
|
@@ -178,8 +178,11 @@ void DCHGraph::buildVTables(const SVFModule &module)
|
|
|
178
178
|
assert(type && "DCHG::buildVTables: bad metadata for ctir.vt");
|
|
179
179
|
DCHNode *node = getOrCreateNode(type);
|
|
180
180
|
const SVFGlobalValue* svfgv = LLVMModuleSet::getLLVMModuleSet()->getSVFGlobalValue(gv);
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
SymID i = SymbolTableInfo::SymbolInfo()->getObjSym(svfgv);
|
|
182
|
+
GlobalObjVar* globalObjVar =
|
|
183
|
+
SVFUtil::cast<GlobalObjVar>(PAG::getPAG()->getGNode(i));
|
|
184
|
+
node->setVTable(globalObjVar);
|
|
185
|
+
vtblToTypeMap[globalObjVar] = getCanonicalType(type);
|
|
183
186
|
|
|
184
187
|
const ConstantStruct *vtbls = cppUtil::getVtblStruct(gv);
|
|
185
188
|
for (unsigned nthVtbl = 0; nthVtbl < vtbls->getNumOperands(); ++nthVtbl)
|
|
@@ -575,7 +578,7 @@ const VTableSet &DCHGraph::getCSVtblsBasedonCHA(const CallICFGNode* cs)
|
|
|
575
578
|
for (NodeID childId : children)
|
|
576
579
|
{
|
|
577
580
|
DCHNode *child = getGNode(childId);
|
|
578
|
-
const
|
|
581
|
+
const GlobalObjVar *vtbl = child->getVTable();
|
|
579
582
|
// TODO: what if it is null?
|
|
580
583
|
if (vtbl != nullptr)
|
|
581
584
|
{
|
|
@@ -593,7 +596,7 @@ void DCHGraph::getVFnsFromVtbls(const CallICFGNode* callsite, const VTableSet &v
|
|
|
593
596
|
{
|
|
594
597
|
size_t idx = callsite->getFunIdxInVtable();
|
|
595
598
|
std::string funName = callsite->getFunNameOfVirtualCall();
|
|
596
|
-
for (const
|
|
599
|
+
for (const GlobalObjVar *vtbl : vtbls)
|
|
597
600
|
{
|
|
598
601
|
assert(vtblToTypeMap.find(vtbl) != vtblToTypeMap.end() && "floating vtbl");
|
|
599
602
|
const DIType *type = vtblToTypeMap[vtbl];
|
|
@@ -1258,6 +1258,7 @@ void LLVMModuleSet::addToSVFVar2LLVMValueMap(const Value* val,
|
|
|
1258
1258
|
{
|
|
1259
1259
|
SVFBaseNode2LLVMValue[svfBaseNode] = val;
|
|
1260
1260
|
svfBaseNode->setSourceLoc(LLVMUtil::getSourceLoc(val));
|
|
1261
|
+
svfBaseNode->setName(val->getName().str());
|
|
1261
1262
|
}
|
|
1262
1263
|
|
|
1263
1264
|
SVFConstantData* LLVMModuleSet::getSVFConstantData(const ConstantData* cd)
|
|
@@ -753,11 +753,26 @@ const std::string SVFBaseNode::valueOnlyToString() const
|
|
|
753
753
|
}
|
|
754
754
|
else
|
|
755
755
|
{
|
|
756
|
-
|
|
757
|
-
if (
|
|
758
|
-
|
|
756
|
+
const SVFBaseNode* baseNode = this;
|
|
757
|
+
if (const GepValVar* valVar = SVFUtil::dyn_cast<GepValVar>(this))
|
|
758
|
+
{
|
|
759
|
+
baseNode = valVar->getBaseNode();
|
|
760
|
+
}
|
|
761
|
+
else if (const GepObjVar* objVar = SVFUtil::dyn_cast<GepObjVar>(this))
|
|
762
|
+
{
|
|
763
|
+
baseNode = objVar->getBaseObj();
|
|
764
|
+
}
|
|
765
|
+
if (SVFUtil::isa<DummyObjVar, DummyValVar, BlackHoleVar>(baseNode))
|
|
766
|
+
rawstr << "";
|
|
759
767
|
else
|
|
760
|
-
|
|
768
|
+
{
|
|
769
|
+
auto llvmVal =
|
|
770
|
+
LLVMModuleSet::getLLVMModuleSet()->getLLVMValue(baseNode);
|
|
771
|
+
if (llvmVal)
|
|
772
|
+
rawstr << " " << *llvmVal << " ";
|
|
773
|
+
else
|
|
774
|
+
rawstr << "";
|
|
775
|
+
}
|
|
761
776
|
}
|
|
762
777
|
rawstr << getSourceLoc();
|
|
763
778
|
return rawstr.str();
|
|
@@ -67,11 +67,6 @@ SVFIR* SVFIRBuilder::build()
|
|
|
67
67
|
// Set callgraph
|
|
68
68
|
pag->setCallGraph(llvmModuleSet()->callgraph);
|
|
69
69
|
|
|
70
|
-
CHGraph* chg = new CHGraph(pag->getModule());
|
|
71
|
-
CHGBuilder chgbuilder(chg);
|
|
72
|
-
chgbuilder.buildCHG();
|
|
73
|
-
pag->setCHG(chg);
|
|
74
|
-
|
|
75
70
|
// We read SVFIR from a user-defined txt instead of parsing SVFIR from LLVM IR
|
|
76
71
|
if (SVFModule::pagReadFromTXT())
|
|
77
72
|
{
|
|
@@ -91,6 +86,11 @@ SVFIR* SVFIRBuilder::build()
|
|
|
91
86
|
visitGlobal(svfModule);
|
|
92
87
|
///// collect exception vals in the program
|
|
93
88
|
|
|
89
|
+
CHGraph* chg = new CHGraph(pag->getModule());
|
|
90
|
+
CHGBuilder chgbuilder(chg);
|
|
91
|
+
chgbuilder.buildCHG();
|
|
92
|
+
pag->setCHG(chg);
|
|
93
|
+
|
|
94
94
|
/// handle functions
|
|
95
95
|
for (Module& M : llvmModuleSet()->getLLVMModules())
|
|
96
96
|
{
|
|
@@ -249,16 +249,21 @@ void SVFIRBuilder::initialiseNodes()
|
|
|
249
249
|
{
|
|
250
250
|
pag->addGlobalValueValNode(iter->first, iter->second, icfgNode);
|
|
251
251
|
}
|
|
252
|
-
else if (SVFUtil::isa<ConstantData>(llvmValue))
|
|
252
|
+
else if (SVFUtil::isa<ConstantData, MetadataAsValue, BlockAddress>(llvmValue))
|
|
253
253
|
{
|
|
254
254
|
pag->addConstantDataValNode(iter->first, iter->second, icfgNode);
|
|
255
255
|
}
|
|
256
|
+
else if (SVFUtil::isa<ConstantAggregate>(llvmValue))
|
|
257
|
+
{
|
|
258
|
+
pag->addConstantAggValNode(iter->first, iter->second, icfgNode);
|
|
259
|
+
}
|
|
256
260
|
else
|
|
257
261
|
{
|
|
258
262
|
// Add value node to PAG
|
|
259
263
|
pag->addValNode(iter->first, iter->second, icfgNode);
|
|
260
264
|
}
|
|
261
|
-
llvmModuleSet()->addToSVFVar2LLVMValueMap(llvmValue,
|
|
265
|
+
llvmModuleSet()->addToSVFVar2LLVMValueMap(llvmValue,
|
|
266
|
+
pag->getGNode(iter->second));
|
|
262
267
|
}
|
|
263
268
|
|
|
264
269
|
// Iterate over all object symbols in the symbol table
|
|
@@ -325,16 +330,22 @@ void SVFIRBuilder::initialiseNodes()
|
|
|
325
330
|
NodeID id = symTable->getObjSym(iter->first);
|
|
326
331
|
pag->addGlobalValueObjNode(iter->first, iter->second, symTable->getObjTypeInfo(id));
|
|
327
332
|
}
|
|
328
|
-
else if (SVFUtil::isa<ConstantData>(llvmValue))
|
|
333
|
+
else if (SVFUtil::isa<ConstantData, MetadataAsValue, BlockAddress>(llvmValue))
|
|
329
334
|
{
|
|
330
335
|
NodeID id = symTable->getObjSym(iter->first);
|
|
331
336
|
pag->addConstantDataObjNode(iter->first, iter->second, symTable->getObjTypeInfo(id));
|
|
332
337
|
}
|
|
338
|
+
else if (SVFUtil::isa<ConstantAggregate>(llvmValue))
|
|
339
|
+
{
|
|
340
|
+
NodeID id = symTable->getObjSym(iter->first);
|
|
341
|
+
pag->addConstantAggObjNode(iter->first, iter->second, symTable->getObjTypeInfo(id));
|
|
342
|
+
}
|
|
333
343
|
// Add a generic object node for other types of values
|
|
334
344
|
else
|
|
335
345
|
{
|
|
336
346
|
NodeID id = symTable->getObjSym(iter->first);
|
|
337
|
-
pag->addObjNode(iter->first, iter->second,
|
|
347
|
+
pag->addObjNode(iter->first, iter->second,
|
|
348
|
+
symTable->getObjTypeInfo(id));
|
|
338
349
|
}
|
|
339
350
|
llvmModuleSet()->addToSVFVar2LLVMValueMap(llvmValue, pag->getGNode(iter->second));
|
|
340
351
|
|
|
@@ -349,22 +360,23 @@ void SVFIRBuilder::initialiseNodes()
|
|
|
349
360
|
symTable->retSyms().begin(); iter != symTable->retSyms().end();
|
|
350
361
|
++iter)
|
|
351
362
|
{
|
|
363
|
+
const Value* llvmValue = llvmModuleSet()->getLLVMValue(iter->first);
|
|
352
364
|
DBOUT(DPAGBuild, outs() << "add ret node " << iter->second << "\n");
|
|
353
365
|
pag->addRetNode(iter->second,
|
|
354
|
-
llvmModuleSet()->getCallGraphNode(SVFUtil::cast<Function>(
|
|
355
|
-
|
|
356
|
-
llvmModuleSet()->addToSVFVar2LLVMValueMap(llvmModuleSet()->getLLVMValue(iter->first), pag->getGNode(iter->second));
|
|
366
|
+
llvmModuleSet()->getCallGraphNode(SVFUtil::cast<Function>(llvmValue)));
|
|
367
|
+
llvmModuleSet()->addToSVFVar2LLVMValueMap(llvmValue, pag->getGNode(iter->second));
|
|
357
368
|
}
|
|
358
369
|
|
|
359
370
|
for (SymbolTableInfo::FunToIDMapTy::iterator iter =
|
|
360
371
|
symTable->varargSyms().begin();
|
|
361
372
|
iter != symTable->varargSyms().end(); ++iter)
|
|
362
373
|
{
|
|
374
|
+
const Value* llvmValue = llvmModuleSet()->getLLVMValue(iter->first);
|
|
363
375
|
DBOUT(DPAGBuild, outs() << "add vararg node " << iter->second << "\n");
|
|
364
376
|
pag->addVarargNode(iter->second,
|
|
365
|
-
llvmModuleSet()->getCallGraphNode(SVFUtil::cast<Function>(
|
|
366
|
-
|
|
367
|
-
|
|
377
|
+
llvmModuleSet()->getCallGraphNode(SVFUtil::cast<Function>(llvmValue)));
|
|
378
|
+
llvmModuleSet()->addToSVFVar2LLVMValueMap(llvmValue, pag->getGNode(iter->second));
|
|
379
|
+
|
|
368
380
|
}
|
|
369
381
|
|
|
370
382
|
/// add address edges for constant nodes.
|
|
@@ -65,7 +65,10 @@ const Type* SVFIRBuilder::getBaseTypeAndFlattenedFields(const Value* V, std::vec
|
|
|
65
65
|
{
|
|
66
66
|
SymbolTableBuilder builder(pag->getSymbolInfo());
|
|
67
67
|
builder.collectSym(offset);
|
|
68
|
-
|
|
68
|
+
SymID id = pag->getSymbolInfo()->getValSym(svfOffset);
|
|
69
|
+
pag->addConstantIntValNode(svfOffset, id, LLVMUtil::getIntegerValue(offset), nullptr);
|
|
70
|
+
llvmModuleSet()->addToSVFVar2LLVMValueMap(offset,
|
|
71
|
+
pag->getGNode(id));
|
|
69
72
|
}
|
|
70
73
|
ls.addOffsetVarAndGepTypePair(getPAG()->getGNode(getPAG()->getValueNode(svfOffset)), nullptr);
|
|
71
74
|
fields.push_back(ls);
|
|
@@ -62,10 +62,7 @@ std::string printPts(PointerAnalysis* pta, const SVFVar* svfval)
|
|
|
62
62
|
{
|
|
63
63
|
rawstr << " " << *ii << " ";
|
|
64
64
|
PAGNode* targetObj = pta->getPAG()->getGNode(*ii);
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
rawstr << "(" << targetObj->getValue()->toString() << ")\t ";
|
|
68
|
-
}
|
|
65
|
+
rawstr << "(" << targetObj->valueOnlyToString() << ")\t ";
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
return rawstr.str();
|