svf-lib 1.0.1697 → 1.0.1699
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SVF-linux/Release-build/svf/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-linux/svf/include/AbstractExecution/SVFIR2ItvExeState.h +5 -5
- package/SVF-linux/svf/include/MemoryModel/AccessPath.h +24 -6
- package/SVF-linux/svf/include/SVFIR/SVFStatements.h +2 -2
- package/SVF-linux/svf/include/SVFIR/SVFType.h +19 -0
- package/SVF-osx/Release-build/svf/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-osx/svf/include/AbstractExecution/SVFIR2ItvExeState.h +5 -5
- package/SVF-osx/svf/include/AbstractExecution/WTO.h +1 -1
- package/SVF-osx/svf/include/CFL/CFGrammar.h +1 -1
- package/SVF-osx/svf/include/MemoryModel/AccessPath.h +24 -6
- package/SVF-osx/svf/include/SVFIR/SVFStatements.h +2 -2
- package/SVF-osx/svf/include/SVFIR/SVFType.h +18 -0
- package/SVF-osx/svf/include/Util/iterator.h +2 -2
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -74,17 +74,17 @@ public:
|
|
|
74
74
|
VAddrs getGepObjAddress(u32_t pointer, APOffset offset);
|
|
75
75
|
|
|
76
76
|
/// Return the byte offset from one gep param offset
|
|
77
|
-
std::pair<APOffset, APOffset> getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep
|
|
77
|
+
std::pair<APOffset, APOffset> getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
|
|
78
78
|
|
|
79
79
|
/// Return the Index offset from one gep param offset
|
|
80
80
|
std::pair<APOffset, APOffset> getIndexfromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
|
|
81
81
|
|
|
82
82
|
/// Return the byte offset expression of a GepStmt
|
|
83
83
|
/// elemBytesize is the element byte size of an static alloc or heap alloc array
|
|
84
|
-
/// e.g. GepStmt* gep =
|
|
85
|
-
/// s32_t
|
|
86
|
-
///
|
|
87
|
-
std::pair<APOffset, APOffset> getGepByteOffset(const GepStmt *gep
|
|
84
|
+
/// e.g. GepStmt* gep = [i32*10], x, and x is [0,3]
|
|
85
|
+
/// std::pair<s32_t, s32_t> byteOffset = getGepByteOffset(gep);
|
|
86
|
+
/// byteOffset should be [0, 12] since i32 is 4 bytes.
|
|
87
|
+
std::pair<APOffset, APOffset> getGepByteOffset(const GepStmt *gep);
|
|
88
88
|
|
|
89
89
|
/// Return the offset expression of a GepStmt
|
|
90
90
|
std::pair<APOffset, APOffset> getGepOffset(const GepStmt *gep);
|
|
@@ -109,13 +109,31 @@ public:
|
|
|
109
109
|
}
|
|
110
110
|
//@}
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Computes the total constant byte offset of an access path.
|
|
114
|
+
* This function iterates over the offset-variable-type pairs in reverse order,
|
|
115
|
+
* accumulating the total byte offset for constant offsets. For each pair,
|
|
116
|
+
* it retrieves the corresponding SVFValue and determines the type of offset
|
|
117
|
+
* (whether it's an array, pointer, or structure). If the offset corresponds
|
|
118
|
+
* to a structure, it further resolves the actual element type based on the
|
|
119
|
+
* offset value. It then multiplies the offset value by the size of the type
|
|
120
|
+
* to compute the byte offset. This is used to handle composite types where
|
|
121
|
+
* offsets are derived from the type's internal structure, such as arrays
|
|
122
|
+
* or structures with fields of various types and sizes. The function asserts
|
|
123
|
+
* that the access path must have a constant offset, and it is intended to be
|
|
124
|
+
* used when the offset is known to be constant at compile time.
|
|
125
|
+
*
|
|
126
|
+
* @return APOffset representing the computed total constant byte offset.
|
|
127
|
+
*/
|
|
128
|
+
/// e.g. GepStmt* gep = [i32*4], 2
|
|
129
|
+
/// APOffset byteOffset = gep->accumulateConstantByteOffset();
|
|
130
|
+
/// byteOffset should be 8 since i32 is 4 bytes and index is 2.
|
|
131
|
+
APOffset computeConstantByteOffset() const;
|
|
118
132
|
/// Return accumulated constant offset given OffsetVarVec
|
|
133
|
+
/// compard to computeConstantByteOffset, it is field offset rather than byte offset
|
|
134
|
+
/// e.g. GepStmt* gep = [i32*4], 2
|
|
135
|
+
/// APOffset byteOffset = gep->computeConstantOffset();
|
|
136
|
+
/// byteOffset should be 2 since it is field offset.
|
|
119
137
|
APOffset computeConstantOffset() const;
|
|
120
138
|
|
|
121
139
|
/// Return element number of a type.
|
|
@@ -505,9 +505,9 @@ public:
|
|
|
505
505
|
/// e.g. GepStmt* gep = **,
|
|
506
506
|
/// s32_t elemBytesize = LLVMUtil::SVFType2ByteSize(gep->getRHSVar()->getValue()->getType());
|
|
507
507
|
/// APOffset byteOffset = gep->accumulateConstantByteOffset(elemBytesize);
|
|
508
|
-
inline APOffset accumulateConstantByteOffset(
|
|
508
|
+
inline APOffset accumulateConstantByteOffset() const
|
|
509
509
|
{
|
|
510
|
-
return getAccessPath().computeConstantByteOffset(
|
|
510
|
+
return getAccessPath().computeConstantByteOffset();
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
/// Return accumulated constant offset (when accessing array or struct) if this offset is a constant.
|
|
@@ -299,6 +299,8 @@ public:
|
|
|
299
299
|
return getPointerToTy;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
u32_t getLLVMByteSize() const;
|
|
303
|
+
|
|
302
304
|
inline void setTypeInfo(StInfo* ti)
|
|
303
305
|
{
|
|
304
306
|
typeinfo = ti;
|
|
@@ -321,6 +323,16 @@ public:
|
|
|
321
323
|
return kind == SVFPointerTy;
|
|
322
324
|
}
|
|
323
325
|
|
|
326
|
+
inline bool isArrayTy() const
|
|
327
|
+
{
|
|
328
|
+
return kind == SVFArrayTy;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
inline bool isStructTy() const
|
|
332
|
+
{
|
|
333
|
+
return kind == SVFStructTy;
|
|
334
|
+
}
|
|
335
|
+
|
|
324
336
|
inline bool isSingleValueType() const
|
|
325
337
|
{
|
|
326
338
|
return isSingleValTy;
|
|
@@ -462,6 +474,11 @@ public:
|
|
|
462
474
|
|
|
463
475
|
void print(std::ostream& os) const override;
|
|
464
476
|
|
|
477
|
+
const SVFType* getTypeOfElement() const
|
|
478
|
+
{
|
|
479
|
+
return typeOfElement;
|
|
480
|
+
}
|
|
481
|
+
|
|
465
482
|
void setTypeOfElement(const SVFType* elemType)
|
|
466
483
|
{
|
|
467
484
|
typeOfElement = elemType;
|
|
@@ -471,6 +488,8 @@ public:
|
|
|
471
488
|
{
|
|
472
489
|
numOfElement = elemNum;
|
|
473
490
|
}
|
|
491
|
+
|
|
492
|
+
|
|
474
493
|
};
|
|
475
494
|
|
|
476
495
|
class SVFOtherType : public SVFType
|
|
Binary file
|
|
Binary file
|
|
@@ -74,17 +74,17 @@ public:
|
|
|
74
74
|
VAddrs getGepObjAddress(u32_t pointer, APOffset offset);
|
|
75
75
|
|
|
76
76
|
/// Return the byte offset from one gep param offset
|
|
77
|
-
std::pair<APOffset, APOffset> getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep
|
|
77
|
+
std::pair<APOffset, APOffset> getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
|
|
78
78
|
|
|
79
79
|
/// Return the Index offset from one gep param offset
|
|
80
80
|
std::pair<APOffset, APOffset> getIndexfromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
|
|
81
81
|
|
|
82
82
|
/// Return the byte offset expression of a GepStmt
|
|
83
83
|
/// elemBytesize is the element byte size of an static alloc or heap alloc array
|
|
84
|
-
/// e.g. GepStmt* gep =
|
|
85
|
-
/// s32_t
|
|
86
|
-
///
|
|
87
|
-
std::pair<APOffset, APOffset> getGepByteOffset(const GepStmt *gep
|
|
84
|
+
/// e.g. GepStmt* gep = [i32*10], x, and x is [0,3]
|
|
85
|
+
/// std::pair<s32_t, s32_t> byteOffset = getGepByteOffset(gep);
|
|
86
|
+
/// byteOffset should be [0, 12] since i32 is 4 bytes.
|
|
87
|
+
std::pair<APOffset, APOffset> getGepByteOffset(const GepStmt *gep);
|
|
88
88
|
|
|
89
89
|
/// Return the offset expression of a GepStmt
|
|
90
90
|
std::pair<APOffset, APOffset> getGepOffset(const GepStmt *gep);
|
|
@@ -635,7 +635,7 @@ protected:
|
|
|
635
635
|
void visit(const CFBasicBlockGWTONode &node) override
|
|
636
636
|
{
|
|
637
637
|
_nodeToWTOCycleDepth.insert(
|
|
638
|
-
|
|
638
|
+
std::make_pair(node.node(), _wtoCycleDepth));
|
|
639
639
|
}
|
|
640
640
|
|
|
641
641
|
}; // end class WTOCycleDepthBuilder
|
|
@@ -146,7 +146,7 @@ public:
|
|
|
146
146
|
template<typename Key, typename Value, typename Hash = SymbolHash,
|
|
147
147
|
typename KeyEqual = std::equal_to<Key>,
|
|
148
148
|
typename Allocator = std::allocator<std::pair<const Key, Value>>>
|
|
149
|
-
|
|
149
|
+
using SymbolMap = std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>;
|
|
150
150
|
|
|
151
151
|
template <typename Key, typename Hash = SymbolVectorHash, typename KeyEqual = std::equal_to<Key>,
|
|
152
152
|
typename Allocator = std::allocator<Key>>
|
|
@@ -105,13 +105,31 @@ public:
|
|
|
105
105
|
}
|
|
106
106
|
//@}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Computes the total constant byte offset of an access path.
|
|
110
|
+
* This function iterates over the offset-variable-type pairs in reverse order,
|
|
111
|
+
* accumulating the total byte offset for constant offsets. For each pair,
|
|
112
|
+
* it retrieves the corresponding SVFValue and determines the type of offset
|
|
113
|
+
* (whether it's an array, pointer, or structure). If the offset corresponds
|
|
114
|
+
* to a structure, it further resolves the actual element type based on the
|
|
115
|
+
* offset value. It then multiplies the offset value by the size of the type
|
|
116
|
+
* to compute the byte offset. This is used to handle composite types where
|
|
117
|
+
* offsets are derived from the type's internal structure, such as arrays
|
|
118
|
+
* or structures with fields of various types and sizes. The function asserts
|
|
119
|
+
* that the access path must have a constant offset, and it is intended to be
|
|
120
|
+
* used when the offset is known to be constant at compile time.
|
|
121
|
+
*
|
|
122
|
+
* @return APOffset representing the computed total constant byte offset.
|
|
123
|
+
*/
|
|
124
|
+
/// e.g. GepStmt* gep = [i32*4], 2
|
|
125
|
+
/// APOffset byteOffset = gep->accumulateConstantByteOffset();
|
|
126
|
+
/// byteOffset should be 8 since i32 is 4 bytes and index is 2.
|
|
127
|
+
APOffset computeConstantByteOffset() const;
|
|
114
128
|
/// Return accumulated constant offset given OffsetVarVec
|
|
129
|
+
/// compard to computeConstantByteOffset, it is field offset rather than byte offset
|
|
130
|
+
/// e.g. GepStmt* gep = [i32*4], 2
|
|
131
|
+
/// APOffset byteOffset = gep->computeConstantOffset();
|
|
132
|
+
/// byteOffset should be 2 since it is field offset.
|
|
115
133
|
APOffset computeConstantOffset() const;
|
|
116
134
|
|
|
117
135
|
/// Return element number of a type.
|
|
@@ -504,9 +504,9 @@ public:
|
|
|
504
504
|
/// e.g. GepStmt* gep = **,
|
|
505
505
|
/// s32_t elemBytesize = LLVMUtil::SVFType2ByteSize(gep->getRHSVar()->getValue()->getType());
|
|
506
506
|
/// APOffset byteOffset = gep->accumulateConstantByteOffset(elemBytesize);
|
|
507
|
-
inline APOffset accumulateConstantByteOffset(
|
|
507
|
+
inline APOffset accumulateConstantByteOffset() const
|
|
508
508
|
{
|
|
509
|
-
return getAccessPath().computeConstantByteOffset(
|
|
509
|
+
return getAccessPath().computeConstantByteOffset();
|
|
510
510
|
}
|
|
511
511
|
|
|
512
512
|
/// Return accumulated constant offset (when accessing array or struct) if this offset is a constant.
|
|
@@ -299,6 +299,8 @@ public:
|
|
|
299
299
|
return getPointerToTy;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
u32_t getLLVMByteSize() const;
|
|
303
|
+
|
|
302
304
|
inline void setTypeInfo(StInfo* ti)
|
|
303
305
|
{
|
|
304
306
|
typeinfo = ti;
|
|
@@ -321,6 +323,16 @@ public:
|
|
|
321
323
|
return kind == SVFPointerTy;
|
|
322
324
|
}
|
|
323
325
|
|
|
326
|
+
inline bool isArrayTy() const
|
|
327
|
+
{
|
|
328
|
+
return kind == SVFArrayTy;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
inline bool isStructTy() const
|
|
332
|
+
{
|
|
333
|
+
return kind == SVFStructTy;
|
|
334
|
+
}
|
|
335
|
+
|
|
324
336
|
inline bool isSingleValueType() const
|
|
325
337
|
{
|
|
326
338
|
return isSingleValTy;
|
|
@@ -462,6 +474,11 @@ public:
|
|
|
462
474
|
|
|
463
475
|
void print(std::ostream& os) const override;
|
|
464
476
|
|
|
477
|
+
const SVFType* getTypeOfElement() const
|
|
478
|
+
{
|
|
479
|
+
return typeOfElement;
|
|
480
|
+
}
|
|
481
|
+
|
|
465
482
|
void setTypeOfElement(const SVFType* elemType)
|
|
466
483
|
{
|
|
467
484
|
typeOfElement = elemType;
|
|
@@ -471,6 +488,7 @@ public:
|
|
|
471
488
|
{
|
|
472
489
|
numOfElement = elemNum;
|
|
473
490
|
}
|
|
491
|
+
|
|
474
492
|
};
|
|
475
493
|
|
|
476
494
|
class SVFOtherType : public SVFType
|
|
@@ -331,7 +331,7 @@ public:
|
|
|
331
331
|
/// \endcode
|
|
332
332
|
template <typename WrappedIteratorT,
|
|
333
333
|
typename T = std::remove_reference_t<decltype(
|
|
334
|
-
|
|
334
|
+
**std::declval<WrappedIteratorT>())>>
|
|
335
335
|
struct pointee_iter
|
|
336
336
|
: iter_adaptor_base<
|
|
337
337
|
pointee_iter<WrappedIteratorT, T>, WrappedIteratorT,
|
|
@@ -397,7 +397,7 @@ iter_range<pointer_iterator<WrappedIteratorT>>
|
|
|
397
397
|
|
|
398
398
|
template <typename WrappedIteratorT,
|
|
399
399
|
typename T1 = std::remove_reference_t<decltype(
|
|
400
|
-
|
|
400
|
+
**std::declval<WrappedIteratorT>())>,
|
|
401
401
|
typename T2 = std::add_pointer_t<T1>>
|
|
402
402
|
using raw_pointer_iterator =
|
|
403
403
|
pointer_iterator<pointee_iter<WrappedIteratorT, T1>, T2>;
|