svf-lib 1.0.1621 → 1.0.1623
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/include/Util/config.h +1 -0
- package/SVF-linux/Release-build/include/Util/extapi.bc +2084 -0
- 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/ConsExeState.h +1 -1
- package/SVF-linux/svf/include/AbstractExecution/IntervalExeState.h +1 -1
- package/SVF-linux/svf/include/AbstractExecution/IntervalValue.h +1 -1
- package/SVF-linux/svf/include/AbstractExecution/SymState.h +1 -1
- package/SVF-linux/svf/include/CFL/CFGrammar.h +1 -1
- package/SVF-linux/svf/include/CFL/GrammarBuilder.h +3 -3
- package/SVF-linux/svf/include/FastCluster/fastcluster.h +4 -4
- package/SVF-linux/svf/include/Graphs/CHG.h +1 -1
- package/SVF-linux/svf/include/Graphs/ConsG.h +3 -3
- package/SVF-linux/svf/include/Graphs/GenericGraph.h +2 -2
- package/SVF-linux/svf/include/Graphs/GraphTraits.h +1 -1
- package/SVF-linux/svf/include/Graphs/GraphWriter.h +1 -1
- package/SVF-linux/svf/include/Graphs/IRGraph.h +1 -1
- package/SVF-linux/svf/include/Graphs/PTACallGraph.h +1 -1
- package/SVF-linux/svf/include/Graphs/VFGNode.h +2 -2
- package/SVF-linux/svf/include/MSSA/MSSAMuChi.h +2 -2
- package/SVF-linux/svf/include/MSSA/MemRegion.h +1 -1
- package/SVF-linux/svf/include/MSSA/MemSSA.h +1 -1
- package/SVF-linux/svf/include/MTA/FSMPTA.h +1 -1
- package/SVF-linux/svf/include/MTA/MHP.h +1 -1
- package/SVF-linux/svf/include/MTA/TCT.h +1 -1
- package/SVF-linux/svf/include/MemoryModel/ConditionalPT.h +1 -1
- package/SVF-linux/svf/include/MemoryModel/MutablePointsToDS.h +2 -2
- package/SVF-linux/svf/include/MemoryModel/PersistentPointsToDS.h +1 -1
- package/SVF-linux/svf/include/MemoryModel/PointerAnalysis.h +1 -1
- package/SVF-linux/svf/include/MemoryModel/PointsTo.h +1 -1
- package/SVF-linux/svf/include/SABER/SaberCondAllocator.h +1 -1
- package/SVF-linux/svf/include/SABER/SrcSnkDDA.h +1 -1
- package/SVF-linux/svf/include/SVFIR/SVFFileSystem.h +3 -3
- package/SVF-linux/svf/include/SVFIR/SVFIR.h +1 -1
- package/SVF-linux/svf/include/SVFIR/SVFModule.h +0 -1
- package/SVF-linux/svf/include/SVFIR/SVFStatements.h +19 -19
- package/SVF-linux/svf/include/SVFIR/SVFType.h +5 -5
- package/SVF-linux/svf/include/SVFIR/SVFValue.h +8 -2
- package/SVF-linux/svf/include/SVFIR/SVFVariables.h +3 -3
- package/SVF-linux/svf/include/SVFIR/SymbolTableInfo.h +3 -3
- package/SVF-linux/svf/include/Util/Casting.h +1 -1
- package/SVF-linux/svf/include/Util/CoreBitVector.h +2 -2
- package/SVF-linux/svf/include/Util/DPItem.h +1 -1
- package/SVF-linux/svf/include/Util/ExtAPI.h +11 -457
- package/SVF-linux/svf/include/Util/NodeIDAllocator.h +1 -1
- package/SVF-linux/svf/include/Util/Options.h +1 -1
- package/SVF-linux/svf/include/Util/SVFBugReport.h +1 -1
- package/SVF-linux/svf/include/Util/SVFUtil.h +11 -26
- package/SVF-linux/svf/include/Util/WorkList.h +1 -1
- package/SVF-linux/svf/include/Util/cJSON.h +1 -1
- package/SVF-linux/svf/include/WPA/Andersen.h +1 -1
- package/SVF-linux/svf/include/WPA/FlowSensitive.h +1 -1
- package/SVF-linux/svf/include/WPA/WPASolver.h +1 -1
- package/SVF-linux/svf-llvm/include/SVF-LLVM/GEPTypeBridgeIterator.h +1 -1
- package/SVF-linux/svf-llvm/include/SVF-LLVM/LLVMModule.h +17 -0
- package/SVF-linux/svf-llvm/include/SVF-LLVM/LLVMUtil.h +14 -1
- package/SVF-linux/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +5 -14
- package/SVF-linux/svf-llvm/include/SVF-LLVM/SymbolTableBuilder.h +1 -1
- package/package.json +1 -1
|
@@ -202,7 +202,7 @@ inline CallSite getSVFCallSite(const SVFInstruction* inst)
|
|
|
202
202
|
|
|
203
203
|
/// Match arguments for callsite at caller and callee
|
|
204
204
|
/// if the arg size does not match then we do not need to connect this parameter
|
|
205
|
-
/// unless the callee is a variadic function (the first parameter of variadic function is its
|
|
205
|
+
/// unless the callee is a variadic function (the first parameter of variadic function is its parameter number)
|
|
206
206
|
bool matchArgs(const SVFInstruction* cs, const SVFFunction* callee);
|
|
207
207
|
|
|
208
208
|
/// Return LLVM callsite given a value
|
|
@@ -304,17 +304,21 @@ bool startAnalysisLimitTimer(unsigned timeLimit);
|
|
|
304
304
|
void stopAnalysisLimitTimer(bool limitTimerSet);
|
|
305
305
|
|
|
306
306
|
/// Return true if the call is an external call (external library in function summary table)
|
|
307
|
-
/// If the
|
|
307
|
+
/// If the library function is redefined in the application code (e.g., memcpy), it will return false and will not be treated as an external call.
|
|
308
308
|
//@{
|
|
309
309
|
inline bool isExtCall(const SVFFunction* fun)
|
|
310
310
|
{
|
|
311
311
|
return fun && ExtAPI::getExtAPI()->is_ext(fun);
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
|
|
315
|
-
inline bool isMemSetOrCpyExtFun(const SVFFunction* fun)
|
|
314
|
+
inline bool isMemcpyExtFun(const SVFFunction* fun)
|
|
316
315
|
{
|
|
317
|
-
return fun && ExtAPI::getExtAPI()->
|
|
316
|
+
return fun && ExtAPI::getExtAPI()->is_memcpy(fun);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
inline bool isMemsetExtFun(const SVFFunction* fun)
|
|
320
|
+
{
|
|
321
|
+
return fun && ExtAPI::getExtAPI()->is_memset(fun);
|
|
318
322
|
}
|
|
319
323
|
|
|
320
324
|
/// Return true if the call is a heap allocator/reallocator
|
|
@@ -346,14 +350,6 @@ inline bool isReallocExtFun(const SVFFunction* fun)
|
|
|
346
350
|
return fun && (ExtAPI::getExtAPI()->is_realloc(fun));
|
|
347
351
|
}
|
|
348
352
|
|
|
349
|
-
/// Return true if the call is a heap dealloc or not
|
|
350
|
-
//@{
|
|
351
|
-
/// note that this function is not suppose to be used externally
|
|
352
|
-
inline bool isDeallocExtFun(const SVFFunction* fun)
|
|
353
|
-
{
|
|
354
|
-
return fun && (ExtAPI::getExtAPI()->is_dealloc(fun));
|
|
355
|
-
}
|
|
356
|
-
|
|
357
353
|
/// Return true if the call is a static global call
|
|
358
354
|
//@{
|
|
359
355
|
/// note that this function is not suppose to be used externally
|
|
@@ -498,17 +494,6 @@ inline bool isReallocExtCall(const SVFInstruction *inst)
|
|
|
498
494
|
}
|
|
499
495
|
//@}
|
|
500
496
|
|
|
501
|
-
inline bool isDeallocExtCall(const CallSite cs)
|
|
502
|
-
{
|
|
503
|
-
return isDeallocExtFun(getCallee(cs));
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
inline bool isDeallocExtCall(const SVFInstruction *inst)
|
|
507
|
-
{
|
|
508
|
-
return isDeallocExtFun(getCallee(inst));
|
|
509
|
-
}
|
|
510
|
-
//@}
|
|
511
|
-
|
|
512
497
|
inline bool isStaticExtCall(const CallSite cs)
|
|
513
498
|
{
|
|
514
499
|
bool isPtrTy = cs.getInstruction()->getType()->isPointerTy();
|
|
@@ -643,7 +628,7 @@ inline const SVFValue* getTaskFuncAtHareParForSite(const SVFInstruction *inst)
|
|
|
643
628
|
}
|
|
644
629
|
//@}
|
|
645
630
|
|
|
646
|
-
/// Return the task data argument of the parallel_for
|
|
631
|
+
/// Return the task data argument of the parallel_for routine
|
|
647
632
|
//@{
|
|
648
633
|
inline const SVFValue* getTaskDataAtHareParForSite(const CallSite cs)
|
|
649
634
|
{
|
|
@@ -672,7 +657,7 @@ move(T &&t) noexcept
|
|
|
672
657
|
return std::move(t);
|
|
673
658
|
}
|
|
674
659
|
|
|
675
|
-
/// void_t is not
|
|
660
|
+
/// void_t is not available until C++17. We define it here for C++11/14.
|
|
676
661
|
template <typename... Ts> struct make_void
|
|
677
662
|
{
|
|
678
663
|
typedef void type;
|
|
@@ -221,7 +221,7 @@ private:
|
|
|
221
221
|
};
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
|
-
*
|
|
224
|
+
* Worklist with "first in last out" order.
|
|
225
225
|
* New nodes will be pushed at back and popped from back.
|
|
226
226
|
* Elements in the list are unique as they're recorded by Set.
|
|
227
227
|
*/
|
|
@@ -111,7 +111,7 @@ typedef struct cJSON
|
|
|
111
111
|
/* The type of the item, as above. */
|
|
112
112
|
int type;
|
|
113
113
|
|
|
114
|
-
/* The item's string, if type==cJSON_String
|
|
114
|
+
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
|
|
115
115
|
char *valuestring;
|
|
116
116
|
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
|
|
117
117
|
int valueint;
|
|
@@ -327,7 +327,7 @@ protected:
|
|
|
327
327
|
void mergeSccNodes(NodeID repNodeId, const NodeBS& subNodes);
|
|
328
328
|
void mergeSccCycle();
|
|
329
329
|
//@}
|
|
330
|
-
/// Collapse a field object into its base for field insensitive
|
|
330
|
+
/// Collapse a field object into its base for field insensitive analysis
|
|
331
331
|
//@{
|
|
332
332
|
virtual void collapsePWCNode(NodeID nodeId);
|
|
333
333
|
void collapseFields();
|
|
@@ -75,7 +75,7 @@ public:
|
|
|
75
75
|
/// Destructor
|
|
76
76
|
~FlowSensitive() override = default;
|
|
77
77
|
|
|
78
|
-
/// Create
|
|
78
|
+
/// Create single instance of flow-sensitive pointer analysis
|
|
79
79
|
static FlowSensitive* createFSWPA(SVFIR* _pag)
|
|
80
80
|
{
|
|
81
81
|
if (fspta == nullptr)
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
#include "Util/CppUtil.h"
|
|
35
35
|
#include "SVFIR/SVFValue.h"
|
|
36
36
|
#include "SVFIR/SVFModule.h"
|
|
37
|
+
#include "Util/Options.h"
|
|
37
38
|
|
|
38
39
|
namespace SVF
|
|
39
40
|
{
|
|
@@ -74,6 +75,8 @@ private:
|
|
|
74
75
|
FunDeclToDefMapTy FunDeclToDefMap;
|
|
75
76
|
/// Function definition to function declaration map
|
|
76
77
|
FunDefToDeclsMapTy FunDefToDeclsMap;
|
|
78
|
+
/// Record some "sse_" function declarations used in other ext function definition, e.g., svf_ext_foo(), and svf_ext_foo() used in app functions
|
|
79
|
+
FunctionSetType ExtFuncsVec;
|
|
77
80
|
/// Global definition to a rep definition map
|
|
78
81
|
GlobalDefToRepMapTy GlobalDefToRepMap;
|
|
79
82
|
|
|
@@ -233,6 +236,20 @@ public:
|
|
|
233
236
|
|
|
234
237
|
SVFOtherValue* getSVFOtherValue(const Value* ov);
|
|
235
238
|
|
|
239
|
+
/// Remove unused function in extapi.bc module
|
|
240
|
+
bool isUsedExtFunction(Function* func)
|
|
241
|
+
{
|
|
242
|
+
/// if this function func defined in extapi.bc but never used in application code (without any corresponding declared functions).
|
|
243
|
+
if (func->getParent()->getName().str() == Options::ExtAPIInput()
|
|
244
|
+
&& func->getName().str() != "svf__main"
|
|
245
|
+
&& FunDefToDeclsMap.find(func) == FunDefToDeclsMap.end()
|
|
246
|
+
&& std::find(ExtFuncsVec.begin(), ExtFuncsVec.end(), func) == ExtFuncsVec.end())
|
|
247
|
+
{
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
|
|
236
253
|
/// Get the corresponding Function based on its name
|
|
237
254
|
inline const SVFFunction* getSVFFunction(const std::string& name)
|
|
238
255
|
{
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
#include "SVF-LLVM/BasicTypes.h"
|
|
35
35
|
#include "SVF-LLVM/LLVMModule.h"
|
|
36
36
|
#include "SVFIR/SVFValue.h"
|
|
37
|
-
#include "Util/ExtAPI.h"
|
|
38
37
|
#include "Util/ThreadAPI.h"
|
|
39
38
|
|
|
40
39
|
namespace SVF
|
|
@@ -373,6 +372,20 @@ const std::string getSourceLocOfFunction(const Function* F);
|
|
|
373
372
|
bool isIntrinsicInst(const Instruction* inst);
|
|
374
373
|
bool isIntrinsicFun(const Function* func);
|
|
375
374
|
|
|
375
|
+
/// Get all called funcions in a parent function
|
|
376
|
+
std::vector<const Function *> getCalledFunctions(const Function *F);
|
|
377
|
+
std::vector<std::string> getFunAnnotations(const Function* fun);
|
|
378
|
+
void removeFunAnnotations(std::vector<Function*>& removedFuncList);
|
|
379
|
+
|
|
380
|
+
inline void removeUnusedFuncsAndAnnotations(std::vector<Function*> removedFuncList)
|
|
381
|
+
{
|
|
382
|
+
/// Remove unused function annotations in extapi.bc
|
|
383
|
+
LLVMUtil::removeFunAnnotations(removedFuncList);
|
|
384
|
+
/// Remove unused function in extapi.bc
|
|
385
|
+
for (Function* func : removedFuncList)
|
|
386
|
+
func->eraseFromParent();
|
|
387
|
+
}
|
|
388
|
+
|
|
376
389
|
/// Get the corresponding Function based on its name
|
|
377
390
|
inline const SVFFunction* getFunction(const std::string& name)
|
|
378
391
|
{
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
#define PAGBUILDER_H_
|
|
32
32
|
|
|
33
33
|
#include "SVFIR/SVFIR.h"
|
|
34
|
-
#include "Util/ExtAPI.h"
|
|
35
34
|
#include "SVF-LLVM/BasicTypes.h"
|
|
36
35
|
#include "SVF-LLVM/ICFGBuilder.h"
|
|
37
36
|
#include "SVF-LLVM/LLVMModule.h"
|
|
37
|
+
#include "SVF-LLVM/LLVMUtil.h"
|
|
38
38
|
|
|
39
39
|
namespace SVF
|
|
40
40
|
{
|
|
@@ -232,18 +232,9 @@ protected:
|
|
|
232
232
|
|
|
233
233
|
/// Handle external call
|
|
234
234
|
//@{
|
|
235
|
-
virtual
|
|
236
|
-
virtual void
|
|
237
|
-
virtual
|
|
238
|
-
virtual void extFuncAtomaticOperation(ExtAPI::Operand& atomicOp, const SVFCallInst* svfInst);
|
|
239
|
-
virtual SVFBasicBlock* extFuncInitialization(const SVFCallInst* svfInst, SVFFunction* svfCaller);
|
|
240
|
-
virtual void handleExtCallStat(ExtAPI::ExtFunctionOps &extFunctionOps, const SVFCallInst* svfInst);
|
|
241
|
-
virtual NodeID getExtID(ExtAPI::OperationType operationType, const std::string &s, const SVFCallInst* svfCall);
|
|
242
|
-
virtual void parseAtomaticOp(SVF::ExtAPI::Operand &atomaticOp, const SVFCallInst* svfCall, std::map<std::string, NodeID> &nodeIDMap);
|
|
243
|
-
virtual void parseExtFunctionOps(ExtAPI::ExtFunctionOps &extFunctionOps, const SVFCallInst* svfCall);
|
|
244
|
-
virtual void preProcessExtCall(CallBase* cs);
|
|
245
|
-
virtual void handleExtCall(const SVFInstruction* svfInst, const SVFFunction* svfCallee);
|
|
246
|
-
void addComplexConsForExt(const SVFValue* D, const SVFValue* S, const SVFValue* sz);
|
|
235
|
+
virtual const Type *getBaseTypeAndFlattenedFields(const Value *V, std::vector<AccessPath> &fields, const Value* szValue);
|
|
236
|
+
virtual void addComplexConsForExt(Value *D, Value *S, const Value* sz);
|
|
237
|
+
virtual void handleExtCall(const CallBase* cs, const SVFFunction* svfCallee);
|
|
247
238
|
//@}
|
|
248
239
|
|
|
249
240
|
/// Set current basic block in order to keep track of control flow information
|
|
@@ -287,7 +278,7 @@ protected:
|
|
|
287
278
|
return nullPtr;
|
|
288
279
|
}
|
|
289
280
|
|
|
290
|
-
NodeID getGepValVar(const
|
|
281
|
+
NodeID getGepValVar(const Value* val, const AccessPath& ap, const SVFType* elementType);
|
|
291
282
|
|
|
292
283
|
void setCurrentBBAndValueForPAGEdge(PAGEdge* edge);
|
|
293
284
|
|
|
@@ -94,7 +94,7 @@ protected:
|
|
|
94
94
|
void analyzeStaticObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
95
95
|
|
|
96
96
|
///Get a reference to the components of struct_info.
|
|
97
|
-
/// Number of
|
|
97
|
+
/// Number of flattened elements of an array or struct
|
|
98
98
|
u32_t getNumOfFlattenElements(const Type* T);
|
|
99
99
|
|
|
100
100
|
///Get a reference to StructInfo.
|