svf-tools 1.0.1057 → 1.0.1058
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 +0 -1
- package/svf/include/Graphs/CallGraph.h +0 -1
- package/svf/include/Graphs/ThreadCallGraph.h +0 -1
- package/svf/include/MTA/MTA.h +0 -1
- package/svf/include/MemoryModel/PointerAnalysis.h +0 -1
- package/svf/include/SVFIR/SVFVariables.h +10 -3
- package/svf/include/Util/CallGraphBuilder.h +0 -1
- package/svf/include/Util/ThreadAPI.h +0 -1
- package/svf/include/WPA/Andersen.h +0 -1
- package/svf/include/WPA/FlowSensitive.h +0 -1
- package/svf/include/WPA/VersionedFlowSensitive.h +0 -1
- package/svf/include/WPA/WPAPass.h +0 -1
- package/svf/lib/SVFIR/SVFValue.cpp +9 -7
- package/svf/lib/SVFIR/SVFVariables.cpp +1 -1
- package/svf-llvm/include/SVF-LLVM/BreakConstantExpr.h +0 -1
- package/svf-llvm/include/SVF-LLVM/CppUtil.h +1 -1
- package/svf-llvm/include/SVF-LLVM/DCHG.h +3 -7
- package/svf-llvm/include/SVF-LLVM/LLVMModule.h +63 -139
- package/svf-llvm/include/SVF-LLVM/LLVMUtil.h +4 -9
- package/svf-llvm/include/SVF-LLVM/ObjTypeInference.h +0 -1
- package/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +21 -18
- package/svf-llvm/include/SVF-LLVM/SymbolTableBuilder.h +1 -1
- package/svf-llvm/lib/BreakConstantExpr.cpp +2 -0
- package/svf-llvm/lib/CHGBuilder.cpp +1 -2
- package/svf-llvm/lib/DCHG.cpp +3 -4
- package/svf-llvm/lib/ICFGBuilder.cpp +2 -3
- package/svf-llvm/lib/LLVMModule.cpp +46 -342
- package/svf-llvm/lib/LLVMUtil.cpp +11 -42
- package/svf-llvm/lib/ObjTypeInference.cpp +6 -5
- package/svf-llvm/lib/SVFIRBuilder.cpp +258 -143
- package/svf-llvm/lib/SVFIRExtAPI.cpp +19 -21
- package/svf-llvm/lib/SymbolTableBuilder.cpp +14 -24
- package/svf-llvm/tools/AE/ae.cpp +2 -2
- package/svf-llvm/tools/CFL/cfl.cpp +2 -2
- package/svf-llvm/tools/DDA/dda.cpp +2 -2
- package/svf-llvm/tools/Example/svf-ex.cpp +2 -2
- package/svf-llvm/tools/MTA/mta.cpp +2 -2
- package/svf-llvm/tools/SABER/saber.cpp +2 -2
- package/svf-llvm/tools/WPA/wpa.cpp +2 -2
- package/SVF-doxygen/doxygen.config +0 -2548
- package/SVF-doxygen/wiki/PAG.png +0 -0
- package/SVF-doxygen/wiki/andersen.png +0 -0
- package/SVF-doxygen/wiki/callgraph.png +0 -0
- package/SVF-doxygen/wiki/consG.png +0 -0
- package/SVF-doxygen/wiki/cpu2000-flto +0 -432
- package/SVF-doxygen/wiki/cpu2006-flto +0 -417
- package/SVF-doxygen/wiki/cpu2017-wllvm.cfg +0 -999
- package/SVF-doxygen/wiki/database.png +0 -0
- package/SVF-doxygen/wiki/framework.png +0 -0
- package/SVF-doxygen/wiki/help.png +0 -0
- package/SVF-doxygen/wiki/icfg.png +0 -0
- package/SVF-doxygen/wiki/mssa-cha.png +0 -0
- package/SVF-doxygen/wiki/pagedge.png +0 -0
- package/SVF-doxygen/wiki/pagnode.png +0 -0
- package/SVF-doxygen/wiki/pt.png +0 -0
- package/SVF-doxygen/wiki/setupcmake.png +0 -0
- package/SVF-doxygen/wiki/setupconfiguration.png +0 -0
- package/SVF-doxygen/wiki/setupdashboard.png +0 -0
- package/SVF-doxygen/wiki/setupdebug.png +0 -0
- package/SVF-doxygen/wiki/setupenv.png +0 -0
- package/SVF-doxygen/wiki/startup.png +0 -0
- package/SVF-doxygen/wiki/svf-stat.pdf +0 -0
- package/SVF-doxygen/wiki/svfg-framework.png +0 -0
- package/SVF-doxygen/wiki/svfg.png +0 -0
- package/SVF-doxygen/wiki/svfg_opt.png +0 -0
- package/SVF-doxygen/wiki/svfgedge-cha.png +0 -0
- package/SVF-doxygen/wiki/svfgnode-cha.png +0 -0
- package/SVF-doxygen/wiki/svfpic/README.md +0 -6
- package/SVF-doxygen/wiki/svfpic/ass-1debug1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/ass-1debug2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/build.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/cmd.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect3.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect4.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect5.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect6.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect7.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/continue.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug-new.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug-new2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug1.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug2.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug3.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug4.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug5.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug6.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/docker_sys_requirement.png +0 -0
- package/SVF-doxygen/wiki/svfpic/docker_sys_requirements.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild4.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild5.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuildimage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercmd.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercmd2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercontainer.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb10.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb4.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb5.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb6.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb7.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb8.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb9.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerfinshbuilt.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerimage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockernameImage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerpull.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerpull2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/download.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/extension1.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/extension2.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/graphviz.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hellodb.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hellodb2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_0.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installC:C++Ext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installCMakeExt.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installRCext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installdockerext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/launch1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/openfile.png +0 -0
- package/SVF-doxygen/wiki/svfpic/pathfolder.png +0 -0
- package/SVF-doxygen/wiki/svfpic/restart.png +0 -0
- package/SVF-doxygen/wiki/svfpic/rundocker.png +0 -0
- package/SVF-doxygen/wiki/svfpic/runinCLI.png +0 -0
- package/SVF-doxygen/wiki/svfpic/screen.png +0 -0
- package/SVF-doxygen/wiki/svfpic/settings1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/settings2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/settings3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/shortlists.png +0 -0
- package/SVF-doxygen/wiki/svfpic/start.png +0 -0
- package/SVF-doxygen/wiki/svfpic/start1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/update0.png +0 -0
- package/SVF-doxygen/wiki/svfpic/verify_docker.png +0 -0
- package/SVF-doxygen/wiki/svfpic/vs_entry_window.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_3.png +0 -0
- package/SVF-doxygen/wiki/tools.png +0 -0
- package/SVF-doxygen/wiki/users.png +0 -0
- package/SVF-doxygen/wiki/vm1.png +0 -0
- package/SVF-doxygen/wiki/vm2.png +0 -0
- package/SVF-doxygen/wiki/vm3.png +0 -0
- package/SVF-doxygen/wiki/vm4.png +0 -0
- package/SVF-doxygen/wiki/vm5.png +0 -0
- package/SVF-doxygen/wiki/vscode_build_tasks.png +0 -0
- package/SVF-doxygen/wiki/vscode_cpp_extension.png +0 -0
- package/SVF-doxygen/wiki/vscode_debug_list.png +0 -0
- package/SVF-doxygen/wiki/vscode_dir_structure.png +0 -0
- package/svf-llvm/include/SVF-LLVM/SVFLLVMValue.h +0 -387
- package/svf-llvm/include/SVF-LLVM/SVFModule.h +0 -186
- package/svf-llvm/lib/SVFLLVMValue.cpp +0 -66
- package/svf-llvm/lib/SVFModule.cpp +0 -77
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1058",
|
|
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
package/svf/include/MTA/MTA.h
CHANGED
|
@@ -955,6 +955,7 @@ class FunObjVar : public BaseObjVar
|
|
|
955
955
|
friend class SVFIRWriter;
|
|
956
956
|
friend class SVFIRReader;
|
|
957
957
|
friend class SVFIRBuilder;
|
|
958
|
+
friend class LLVMModuleSet;
|
|
958
959
|
|
|
959
960
|
public:
|
|
960
961
|
typedef SVFLoopAndDomInfo::BBSet BBSet;
|
|
@@ -976,7 +977,7 @@ private:
|
|
|
976
977
|
const FunObjVar * realDefFun; /// the definition of a function across multiple modules
|
|
977
978
|
BasicBlockGraph* bbGraph; /// the basic block graph of this function
|
|
978
979
|
std::vector<const ArgValVar*> allArgs; /// all formal arguments of this function
|
|
979
|
-
SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
|
|
980
|
+
const SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
|
|
980
981
|
|
|
981
982
|
|
|
982
983
|
private:
|
|
@@ -1015,9 +1016,15 @@ public:
|
|
|
1015
1016
|
/// Constructor
|
|
1016
1017
|
FunObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node);
|
|
1017
1018
|
|
|
1019
|
+
|
|
1020
|
+
virtual ~FunObjVar() {
|
|
1021
|
+
delete loopAndDom;
|
|
1022
|
+
delete bbGraph;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1018
1025
|
void initFunObjVar(bool decl, bool intrinc, bool addr, bool uncalled, bool notret, bool vararg, const SVFFunctionType *ft,
|
|
1019
1026
|
SVFLoopAndDomInfo *ld, const FunObjVar *real, BasicBlockGraph *bbg,
|
|
1020
|
-
const std::vector<const ArgValVar *> &allarg, SVFBasicBlock *exit);
|
|
1027
|
+
const std::vector<const ArgValVar *> &allarg, const SVFBasicBlock *exit);
|
|
1021
1028
|
|
|
1022
1029
|
void setRelDefFun(const FunObjVar *real)
|
|
1023
1030
|
{
|
|
@@ -1072,7 +1079,7 @@ public:
|
|
|
1072
1079
|
return funcType->getReturnType();
|
|
1073
1080
|
}
|
|
1074
1081
|
|
|
1075
|
-
inline SVFLoopAndDomInfo* getLoopAndDomInfo()
|
|
1082
|
+
inline SVFLoopAndDomInfo* getLoopAndDomInfo() const
|
|
1076
1083
|
{
|
|
1077
1084
|
return loopAndDom;
|
|
1078
1085
|
}
|
|
@@ -7,6 +7,15 @@
|
|
|
7
7
|
using namespace SVF;
|
|
8
8
|
using namespace SVFUtil;
|
|
9
9
|
|
|
10
|
+
|
|
11
|
+
__attribute__((weak))
|
|
12
|
+
const std::string SVFValue::valueOnlyToString() const
|
|
13
|
+
{
|
|
14
|
+
assert("SVFBaseNode::valueOnlyToString should be implemented or supported by fronted" && false);
|
|
15
|
+
abort();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
10
19
|
/// Add field (index and offset) with its corresponding type
|
|
11
20
|
void StInfo::addFldWithType(u32_t fldIdx, const SVFType* type, u32_t elemIdx)
|
|
12
21
|
{
|
|
@@ -149,11 +158,4 @@ bool SVFLoopAndDomInfo::isLoopHeader(const SVFBasicBlock* bb) const
|
|
|
149
158
|
return blocks.front() == bb;
|
|
150
159
|
}
|
|
151
160
|
return false;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
__attribute__((weak))
|
|
155
|
-
const std::string SVFValue::valueOnlyToString() const
|
|
156
|
-
{
|
|
157
|
-
assert("SVFBaseNode::valueOnlyToString should be implemented or supported by fronted" && false);
|
|
158
|
-
abort();
|
|
159
161
|
}
|
|
@@ -445,7 +445,7 @@ FunObjVar::FunObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const IC
|
|
|
445
445
|
|
|
446
446
|
void FunObjVar::initFunObjVar(bool decl, bool intrinc, bool addr, bool uncalled, bool notret, bool vararg,
|
|
447
447
|
const SVFFunctionType *ft, SVFLoopAndDomInfo *ld, const FunObjVar *real, BasicBlockGraph *bbg,
|
|
448
|
-
const std::vector<const ArgValVar *> &allarg, SVFBasicBlock *exit)
|
|
448
|
+
const std::vector<const ArgValVar *> &allarg, const SVFBasicBlock *exit)
|
|
449
449
|
{
|
|
450
450
|
isDecl = decl;
|
|
451
451
|
intrinsic = intrinc;
|
|
@@ -17,14 +17,12 @@
|
|
|
17
17
|
#include "Graphs/GenericGraph.h"
|
|
18
18
|
#include "Graphs/CHG.h"
|
|
19
19
|
#include "SVF-LLVM/BasicTypes.h"
|
|
20
|
-
#include "SVF-LLVM/SVFModule.h"
|
|
21
20
|
#include "Util/SVFUtil.h"
|
|
22
21
|
#include "Util/WorkList.h"
|
|
23
22
|
|
|
24
23
|
namespace SVF
|
|
25
24
|
{
|
|
26
25
|
|
|
27
|
-
class SVFModule;
|
|
28
26
|
class DCHNode;
|
|
29
27
|
|
|
30
28
|
class DCHEdge : public GenericEdge<DCHNode>
|
|
@@ -230,8 +228,8 @@ public:
|
|
|
230
228
|
static bool isAgg(const DIType* t);
|
|
231
229
|
|
|
232
230
|
public:
|
|
233
|
-
DCHGraph(
|
|
234
|
-
:
|
|
231
|
+
DCHGraph()
|
|
232
|
+
:numTypes(0) // vfID(0), buildingCHGTime(0) {
|
|
235
233
|
{
|
|
236
234
|
this->kind = DI;
|
|
237
235
|
}
|
|
@@ -358,8 +356,6 @@ public:
|
|
|
358
356
|
bool isFirstField(const DIType* f, const DIType* b);
|
|
359
357
|
|
|
360
358
|
protected:
|
|
361
|
-
/// SVF Module this CHG is built from.
|
|
362
|
-
const SVFModule* svfModule;
|
|
363
359
|
/// Whether this CHG is an extended CHG (first-field). Set by buildCHG.
|
|
364
360
|
bool extended = false;
|
|
365
361
|
/// Maps DITypes to their nodes.
|
|
@@ -394,7 +390,7 @@ private:
|
|
|
394
390
|
void handleDISubroutineType(const DISubroutineType* subroutineType);
|
|
395
391
|
|
|
396
392
|
/// Finds all defined virtual functions and attaches them to nodes.
|
|
397
|
-
void buildVTables(
|
|
393
|
+
void buildVTables();
|
|
398
394
|
|
|
399
395
|
/// Returns a set of all children of type (CHA). Also gradually builds chaMap.
|
|
400
396
|
const NodeBS& cha(const DIType* type, bool firstField);
|
|
@@ -31,8 +31,6 @@
|
|
|
31
31
|
#define INCLUDE_SVF_FE_LLVMMODULE_H_
|
|
32
32
|
|
|
33
33
|
#include "SVF-LLVM/BasicTypes.h"
|
|
34
|
-
#include "SVF-LLVM/SVFLLVMValue.h"
|
|
35
|
-
#include "SVF-LLVM/SVFModule.h"
|
|
36
34
|
#include "Util/Options.h"
|
|
37
35
|
#include "Graphs/BasicBlockG.h"
|
|
38
36
|
|
|
@@ -54,14 +52,8 @@ public:
|
|
|
54
52
|
typedef Map<const Function*, FunctionSetType> FunDefToDeclsMapTy;
|
|
55
53
|
typedef Map<const GlobalVariable*, GlobalVariable*> GlobalDefToRepMapTy;
|
|
56
54
|
|
|
57
|
-
typedef Map<const Function*, SVFFunction*> LLVMFun2SVFFunMap;
|
|
58
55
|
typedef Map<const Function*, FunObjVar*> LLVMFun2FunObjVarMap;
|
|
59
56
|
typedef Map<const BasicBlock*, SVFBasicBlock*> LLVMBB2SVFBBMap;
|
|
60
|
-
typedef Map<const Instruction*, SVFLLVMValue*> LLVMInst2SVFInstMap;
|
|
61
|
-
typedef Map<const Argument*, SVFLLVMValue*> LLVMArgument2SVFArgumentMap;
|
|
62
|
-
typedef Map<const Constant*, SVFLLVMValue*> LLVMConst2SVFConstMap;
|
|
63
|
-
typedef Map<const Value*, SVFLLVMValue*> LLVMValue2SVFOtherValueMap;
|
|
64
|
-
typedef Map<const SVFLLVMValue*, const Value*> SVFValue2LLVMValueMap;
|
|
65
57
|
typedef Map<const SVFValue*, const Value*> SVFBaseNode2LLVMValueMap;
|
|
66
58
|
typedef Map<const Type*, SVFType*> LLVMType2SVFTypeMap;
|
|
67
59
|
typedef Map<const Type*, StInfo*> Type2TypeInfoMap;
|
|
@@ -75,16 +67,18 @@ public:
|
|
|
75
67
|
|
|
76
68
|
/// llvm value to sym id map
|
|
77
69
|
/// local (%) and global (@) identifiers are pointer types which have a value node id.
|
|
78
|
-
typedef OrderedMap<const
|
|
70
|
+
typedef OrderedMap<const Value*, NodeID> ValueToIDMapTy;
|
|
79
71
|
|
|
80
|
-
typedef OrderedMap<const
|
|
72
|
+
typedef OrderedMap<const Function*, NodeID> FunToIDMapTy;
|
|
81
73
|
|
|
74
|
+
typedef std::vector<const Function*> FunctionSet;
|
|
75
|
+
typedef Map<const Function*, const SVFBasicBlock*> FunToExitBBMap;
|
|
76
|
+
typedef Map<const Function*, const Function *> FunToRealDefFunMap;
|
|
82
77
|
|
|
83
78
|
private:
|
|
84
79
|
static LLVMModuleSet* llvmModuleSet;
|
|
85
80
|
static bool preProcessed;
|
|
86
81
|
SVFIR* svfir;
|
|
87
|
-
SVFModule* svfModule; ///< Borrowed from singleton SVFModule::svfModule
|
|
88
82
|
std::unique_ptr<LLVMContext> owned_ctx;
|
|
89
83
|
std::vector<std::unique_ptr<Module>> owned_modules;
|
|
90
84
|
std::vector<std::reference_wrapper<Module>> modules;
|
|
@@ -95,19 +89,13 @@ private:
|
|
|
95
89
|
Fun2AnnoMap ExtFun2Annotations;
|
|
96
90
|
|
|
97
91
|
// Map SVFFunction to its annotations
|
|
98
|
-
Map<const
|
|
92
|
+
Map<const Function*, std::vector<std::string>> func2Annotations;
|
|
99
93
|
|
|
100
94
|
/// Global definition to a rep definition map
|
|
101
95
|
GlobalDefToRepMapTy GlobalDefToRepMap;
|
|
102
96
|
|
|
103
|
-
LLVMFun2SVFFunMap LLVMFunc2SVFFunc; ///< Map an LLVM Function to an SVF Function
|
|
104
97
|
LLVMFun2FunObjVarMap LLVMFun2FunObjVar; ///< Map an LLVM Function to an SVF Funobjvar
|
|
105
98
|
LLVMBB2SVFBBMap LLVMBB2SVFBB;
|
|
106
|
-
LLVMInst2SVFInstMap LLVMInst2SVFInst;
|
|
107
|
-
LLVMArgument2SVFArgumentMap LLVMArgument2SVFArgument;
|
|
108
|
-
LLVMConst2SVFConstMap LLVMConst2SVFConst;
|
|
109
|
-
LLVMValue2SVFOtherValueMap LLVMValue2SVFOtherValue;
|
|
110
|
-
SVFValue2LLVMValueMap SVFValue2LLVMValue;
|
|
111
99
|
LLVMType2SVFTypeMap LLVMType2SVFType;
|
|
112
100
|
Type2TypeInfoMap Type2TypeInfo;
|
|
113
101
|
ObjTypeInference* typeInference;
|
|
@@ -126,6 +114,10 @@ private:
|
|
|
126
114
|
FunToIDMapTy returnSymMap; ///< return map
|
|
127
115
|
FunToIDMapTy varargSymMap; ///< vararg map
|
|
128
116
|
|
|
117
|
+
FunctionSet funSet;
|
|
118
|
+
FunToExitBBMap funToExitBB;
|
|
119
|
+
FunToRealDefFunMap funToRealDefFun;
|
|
120
|
+
|
|
129
121
|
/// Constructor
|
|
130
122
|
LLVMModuleSet();
|
|
131
123
|
|
|
@@ -148,15 +140,10 @@ public:
|
|
|
148
140
|
}
|
|
149
141
|
|
|
150
142
|
// Build an SVF module from a given LLVM Module instance (for use e.g. in a LLVM pass)
|
|
151
|
-
static
|
|
143
|
+
static void buildSVFModule(Module& mod);
|
|
152
144
|
|
|
153
145
|
// Build an SVF module from the bitcode files provided in `moduleNameVec`
|
|
154
|
-
static
|
|
155
|
-
|
|
156
|
-
inline SVFModule* getSVFModule()
|
|
157
|
-
{
|
|
158
|
-
return svfModule;
|
|
159
|
-
}
|
|
146
|
+
static void buildSVFModule(const std::vector<std::string>& moduleNameVec);
|
|
160
147
|
|
|
161
148
|
static void preProcessBCs(std::vector<std::string>& moduleNameVec);
|
|
162
149
|
|
|
@@ -186,6 +173,23 @@ public:
|
|
|
186
173
|
|
|
187
174
|
public:
|
|
188
175
|
|
|
176
|
+
inline const SVFBasicBlock* getFunExitBB(const Function* fun) const {
|
|
177
|
+
auto it = funToExitBB.find(fun);
|
|
178
|
+
if (it == funToExitBB.end()) return nullptr;
|
|
179
|
+
else return it->second;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
inline const Function* getRealDefFun(const Function* fun) const {
|
|
183
|
+
auto it = funToRealDefFun.find(fun);
|
|
184
|
+
if (it == funToRealDefFun.end()) return nullptr;
|
|
185
|
+
else return it->second;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
inline const FunctionSet& getFunctionSet() const
|
|
189
|
+
{
|
|
190
|
+
return funSet;
|
|
191
|
+
}
|
|
192
|
+
|
|
189
193
|
inline u32_t getValueNodeNum() const
|
|
190
194
|
{
|
|
191
195
|
return valSymMap.size();
|
|
@@ -208,36 +212,26 @@ public:
|
|
|
208
212
|
|
|
209
213
|
/// Get SVFIR Node according to LLVM value
|
|
210
214
|
///getNode - Return the node corresponding to the specified pointer.
|
|
211
|
-
NodeID getValueNode(const
|
|
215
|
+
NodeID getValueNode(const Value* V);
|
|
212
216
|
|
|
213
|
-
bool hasValueNode(const
|
|
217
|
+
bool hasValueNode(const Value* V);
|
|
214
218
|
|
|
215
219
|
/// getObject - Return the obj node id refer to the memory object for the
|
|
216
220
|
/// specified global, heap or alloca instruction according to llvm value.
|
|
217
|
-
NodeID getObjectNode(const
|
|
221
|
+
NodeID getObjectNode(const Value* V);
|
|
218
222
|
|
|
219
223
|
void dumpSymTable();
|
|
220
224
|
|
|
221
225
|
public:
|
|
222
|
-
inline void addFunctionMap(const Function* func, SVFFunction* svfFunc)
|
|
223
|
-
{
|
|
224
|
-
LLVMFunc2SVFFunc[func] = svfFunc;
|
|
225
|
-
setValueAttr(func,svfFunc);
|
|
226
|
-
}
|
|
227
226
|
|
|
228
227
|
// create a SVFBasicBlock according to LLVM BasicBlock, then add it to SVFFunction's BasicBlockGraph
|
|
229
|
-
inline void addBasicBlock(
|
|
228
|
+
inline void addBasicBlock(FunObjVar* fun, const BasicBlock* bb)
|
|
230
229
|
{
|
|
231
230
|
SVFBasicBlock* svfBB = fun->getBasicBlockGraph()->addBasicBlock(bb->getName().str());
|
|
232
231
|
LLVMBB2SVFBB[bb] = svfBB;
|
|
233
232
|
SVFBaseNode2LLVMValue[svfBB] = bb;
|
|
234
233
|
}
|
|
235
234
|
|
|
236
|
-
inline void addInstructionMap(const Instruction* inst, SVFLLVMValue* svfInst)
|
|
237
|
-
{
|
|
238
|
-
LLVMInst2SVFInst[inst] = svfInst;
|
|
239
|
-
setValueAttr(inst,svfInst);
|
|
240
|
-
}
|
|
241
235
|
inline void addInstructionMap(const Instruction* inst, CallICFGNode* svfInst)
|
|
242
236
|
{
|
|
243
237
|
CSToCallNodeMap[inst] = svfInst;
|
|
@@ -254,46 +248,6 @@ public:
|
|
|
254
248
|
addToSVFVar2LLVMValueMap(inst, svfInst);
|
|
255
249
|
}
|
|
256
250
|
|
|
257
|
-
inline void addArgumentMap(const Argument* arg, SVFLLVMValue* svfArg)
|
|
258
|
-
{
|
|
259
|
-
LLVMArgument2SVFArgument[arg] = svfArg;
|
|
260
|
-
setValueAttr(arg,svfArg);
|
|
261
|
-
}
|
|
262
|
-
inline void addGlobalValueMap(const GlobalValue* glob, SVFLLVMValue* svfglob)
|
|
263
|
-
{
|
|
264
|
-
if (auto glob_var = llvm::dyn_cast<llvm::GlobalVariable>(glob);
|
|
265
|
-
hasGlobalRep(glob_var))
|
|
266
|
-
{
|
|
267
|
-
glob = getGlobalRep(glob_var);
|
|
268
|
-
}
|
|
269
|
-
LLVMConst2SVFConst[glob] = svfglob;
|
|
270
|
-
setValueAttr(glob,svfglob);
|
|
271
|
-
}
|
|
272
|
-
inline void addConstantDataMap(const ConstantData* cd, SVFLLVMValue* svfcd)
|
|
273
|
-
{
|
|
274
|
-
LLVMConst2SVFConst[cd] = svfcd;
|
|
275
|
-
setValueAttr(cd,svfcd);
|
|
276
|
-
}
|
|
277
|
-
inline void addOtherConstantMap(const Constant* cons, SVFLLVMValue* svfcons)
|
|
278
|
-
{
|
|
279
|
-
LLVMConst2SVFConst[cons] = svfcons;
|
|
280
|
-
setValueAttr(cons,svfcons);
|
|
281
|
-
}
|
|
282
|
-
inline void addOtherValueMap(const Value* ov, SVFLLVMValue* svfov)
|
|
283
|
-
{
|
|
284
|
-
LLVMValue2SVFOtherValue[ov] = svfov;
|
|
285
|
-
setValueAttr(ov,svfov);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
SVFLLVMValue* getSVFValue(const Value* value);
|
|
289
|
-
|
|
290
|
-
const Value* getLLVMValue(const SVFLLVMValue* value) const
|
|
291
|
-
{
|
|
292
|
-
SVFValue2LLVMValueMap::const_iterator it = SVFValue2LLVMValue.find(value);
|
|
293
|
-
assert(it!=SVFValue2LLVMValue.end() && "can't find corresponding llvm value!");
|
|
294
|
-
return it->second;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
251
|
const Value* getLLVMValue(const SVFValue* value) const
|
|
298
252
|
{
|
|
299
253
|
SVFBaseNode2LLVMValueMap ::const_iterator it = SVFBaseNode2LLVMValue.find(value);
|
|
@@ -301,13 +255,6 @@ public:
|
|
|
301
255
|
return it->second;
|
|
302
256
|
}
|
|
303
257
|
|
|
304
|
-
inline SVFFunction* getSVFFunction(const Function* fun) const
|
|
305
|
-
{
|
|
306
|
-
LLVMFun2SVFFunMap::const_iterator it = LLVMFunc2SVFFunc.find(fun);
|
|
307
|
-
assert(it!=LLVMFunc2SVFFunc.end() && "SVF Function not found!");
|
|
308
|
-
return it->second;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
258
|
inline const FunObjVar* getFunObjVar(const Function* fun) const
|
|
312
259
|
{
|
|
313
260
|
LLVMFun2FunObjVarMap::const_iterator it = LLVMFun2FunObjVar.find(fun);
|
|
@@ -325,14 +272,14 @@ public:
|
|
|
325
272
|
return varargSymMap;
|
|
326
273
|
}
|
|
327
274
|
|
|
328
|
-
NodeID getReturnNode(const
|
|
275
|
+
NodeID getReturnNode(const Function *func) const
|
|
329
276
|
{
|
|
330
277
|
FunToIDMapTy::const_iterator iter = returnSymMap.find(func);
|
|
331
278
|
assert(iter!=returnSymMap.end() && "ret sym not found");
|
|
332
279
|
return iter->second;
|
|
333
280
|
}
|
|
334
281
|
|
|
335
|
-
NodeID getVarargNode(const
|
|
282
|
+
NodeID getVarargNode(const Function *func) const
|
|
336
283
|
{
|
|
337
284
|
FunToIDMapTy::const_iterator iter = varargSymMap.find(func);
|
|
338
285
|
assert(iter!=varargSymMap.end() && "vararg sym not found");
|
|
@@ -346,39 +293,8 @@ public:
|
|
|
346
293
|
return it->second;
|
|
347
294
|
}
|
|
348
295
|
|
|
349
|
-
inline SVFLLVMValue* getSVFInstruction(const Instruction* inst) const
|
|
350
|
-
{
|
|
351
|
-
LLVMInst2SVFInstMap::const_iterator it = LLVMInst2SVFInst.find(inst);
|
|
352
|
-
assert(it!=LLVMInst2SVFInst.end() && "SVF Instruction not found!");
|
|
353
|
-
return it->second;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
inline SVFLLVMValue* getSVFArgument(const Argument* arg) const
|
|
357
|
-
{
|
|
358
|
-
LLVMArgument2SVFArgumentMap::const_iterator it = LLVMArgument2SVFArgument.find(arg);
|
|
359
|
-
assert(it!=LLVMArgument2SVFArgument.end() && "SVF Argument not found!");
|
|
360
|
-
return it->second;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
inline SVFLLVMValue* getSVFGlobalValue(const GlobalValue* g) const
|
|
364
|
-
{
|
|
365
|
-
if (auto glob_var = llvm::dyn_cast<llvm::GlobalVariable>(g);
|
|
366
|
-
hasGlobalRep(glob_var))
|
|
367
|
-
{
|
|
368
|
-
g = getGlobalRep(glob_var);
|
|
369
|
-
}
|
|
370
|
-
LLVMConst2SVFConstMap::const_iterator it = LLVMConst2SVFConst.find(g);
|
|
371
|
-
assert(it!=LLVMConst2SVFConst.end() && "SVF Global not found!");
|
|
372
|
-
return it->second;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
SVFLLVMValue* getSVFConstantData(const ConstantData* cd);
|
|
376
|
-
SVFLLVMValue* getOtherSVFConstant(const Constant* oc);
|
|
377
|
-
|
|
378
|
-
SVFLLVMValue* getSVFOtherValue(const Value* ov);
|
|
379
|
-
|
|
380
296
|
/// Get the corresponding Function based on its name
|
|
381
|
-
inline const
|
|
297
|
+
inline const Function* getFunction(const std::string& name)
|
|
382
298
|
{
|
|
383
299
|
Function* fun = nullptr;
|
|
384
300
|
|
|
@@ -388,7 +304,7 @@ public:
|
|
|
388
304
|
fun = mod->getFunction(name);
|
|
389
305
|
if (fun)
|
|
390
306
|
{
|
|
391
|
-
return
|
|
307
|
+
return fun;
|
|
392
308
|
}
|
|
393
309
|
}
|
|
394
310
|
return nullptr;
|
|
@@ -473,45 +389,57 @@ public:
|
|
|
473
389
|
|
|
474
390
|
DominatorTree& getDomTree(const Function* fun);
|
|
475
391
|
|
|
476
|
-
std::string getExtFuncAnnotation(const
|
|
392
|
+
std::string getExtFuncAnnotation(const Function* fun, const std::string& funcAnnotation);
|
|
477
393
|
|
|
478
|
-
const std::vector<std::string>& getExtFuncAnnotations(const
|
|
394
|
+
const std::vector<std::string>& getExtFuncAnnotations(const Function* fun);
|
|
479
395
|
|
|
480
396
|
// Does (F) have some annotation?
|
|
481
|
-
bool hasExtFuncAnnotation(const
|
|
397
|
+
bool hasExtFuncAnnotation(const Function* fun, const std::string& funcAnnotation);
|
|
482
398
|
|
|
483
399
|
// Does (F) have a static var X (unavailable to us) that its return points to?
|
|
484
|
-
bool has_static(const
|
|
400
|
+
bool has_static(const Function *F);
|
|
485
401
|
|
|
486
402
|
// Does (F) have a memcpy_like operation?
|
|
487
|
-
bool is_memcpy(const
|
|
403
|
+
bool is_memcpy(const Function *F);
|
|
488
404
|
|
|
489
405
|
// Does (F) have a memset_like operation?
|
|
490
|
-
bool is_memset(const
|
|
406
|
+
bool is_memset(const Function *F);
|
|
491
407
|
|
|
492
408
|
// Does (F) allocate a new object and return it?
|
|
493
|
-
bool is_alloc(const
|
|
409
|
+
bool is_alloc(const Function *F);
|
|
494
410
|
|
|
495
411
|
// Does (F) allocate a new object and assign it to one of its arguments?
|
|
496
|
-
bool is_arg_alloc(const
|
|
412
|
+
bool is_arg_alloc(const Function *F);
|
|
497
413
|
|
|
498
414
|
// Does (F) allocate a new stack object and return it?
|
|
499
|
-
bool is_alloc_stack_ret(const
|
|
415
|
+
bool is_alloc_stack_ret(const Function *F);
|
|
500
416
|
|
|
501
417
|
// Get the position of argument which holds the new object
|
|
502
|
-
s32_t get_alloc_arg_pos(const
|
|
418
|
+
s32_t get_alloc_arg_pos(const Function *F);
|
|
503
419
|
|
|
504
420
|
// Does (F) reallocate a new object?
|
|
505
|
-
bool is_realloc(const
|
|
421
|
+
bool is_realloc(const Function *F);
|
|
506
422
|
|
|
507
423
|
// Should (F) be considered "external" (either not defined in the program
|
|
508
424
|
// or a user-defined version of a known alloc or no-op)?
|
|
509
|
-
bool is_ext(const
|
|
425
|
+
bool is_ext(const Function *F);
|
|
510
426
|
|
|
511
427
|
// Set the annotation of (F)
|
|
512
|
-
void setExtFuncAnnotations(const
|
|
428
|
+
void setExtFuncAnnotations(const Function* fun, const std::vector<std::string>& funcAnnotations);
|
|
513
429
|
|
|
514
430
|
private:
|
|
431
|
+
inline void addFunctionSet(const Function* svfFunc)
|
|
432
|
+
{
|
|
433
|
+
funSet.push_back(svfFunc);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
inline void setFunExitBB(const Function* fun, const SVFBasicBlock* bb) {
|
|
437
|
+
funToExitBB[fun] = bb;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
inline void setFunRealDefFun(const Function* fun, const Function* realDefFun) {
|
|
441
|
+
funToRealDefFun[fun] = realDefFun;
|
|
442
|
+
}
|
|
515
443
|
/// Create SVFTypes
|
|
516
444
|
SVFType* addSVFTypeInfo(const Type* t);
|
|
517
445
|
/// Collect a type info
|
|
@@ -531,11 +459,7 @@ private:
|
|
|
531
459
|
void addSVFMain();
|
|
532
460
|
|
|
533
461
|
void createSVFDataStructure();
|
|
534
|
-
|
|
535
|
-
void initSVFFunction();
|
|
536
|
-
void initSVFBasicBlock(const Function* func);
|
|
537
|
-
void initDomTree(SVFFunction* func, const Function* f);
|
|
538
|
-
void setValueAttr(const Value* val, SVFLLVMValue* value);
|
|
462
|
+
|
|
539
463
|
void addToSVFVar2LLVMValueMap(const Value* val, SVFValue* svfBaseNode);
|
|
540
464
|
void buildFunToFunMap();
|
|
541
465
|
void buildGlobalDefToRepMap();
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
|
|
33
33
|
#include "Util/SVFUtil.h"
|
|
34
34
|
#include "SVF-LLVM/BasicTypes.h"
|
|
35
|
-
#include "SVF-LLVM/SVFLLVMValue.h"
|
|
36
35
|
#include "Util/ThreadAPI.h"
|
|
37
36
|
|
|
38
37
|
namespace SVF
|
|
@@ -355,15 +354,14 @@ std::vector<const Function *> getCalledFunctions(const Function *F);
|
|
|
355
354
|
// Converts a mangled name to C naming style to match functions in extapi.c.
|
|
356
355
|
std::string restoreFuncName(std::string funcName);
|
|
357
356
|
|
|
358
|
-
bool isExtCall(const
|
|
357
|
+
bool isExtCall(const Function* fun);
|
|
359
358
|
|
|
360
|
-
bool isMemcpyExtFun(const
|
|
359
|
+
bool isMemcpyExtFun(const Function *fun);
|
|
361
360
|
|
|
362
|
-
bool isMemsetExtFun(const
|
|
361
|
+
bool isMemsetExtFun(const Function* fun);
|
|
363
362
|
|
|
364
|
-
u32_t getHeapAllocHoldingArgPosition(const
|
|
363
|
+
u32_t getHeapAllocHoldingArgPosition(const Function* fun);
|
|
365
364
|
|
|
366
|
-
const SVFFunction* getFunction(const std::string& name);
|
|
367
365
|
const FunObjVar* getFunObjVar(const std::string&name);
|
|
368
366
|
|
|
369
367
|
/// Return true if the value refers to constant data, e.g., i32 0
|
|
@@ -376,9 +374,6 @@ inline bool isConstDataOrAggData(const Value* val)
|
|
|
376
374
|
/// find the unique defined global across multiple modules
|
|
377
375
|
const Value* getGlobalRep(const Value* val);
|
|
378
376
|
|
|
379
|
-
/// Check whether this value points-to a constant object
|
|
380
|
-
bool isConstantObjSym(const SVFLLVMValue* val);
|
|
381
|
-
|
|
382
377
|
/// Check whether this value points-to a constant object
|
|
383
378
|
bool isConstantObjSym(const Value* val);
|
|
384
379
|
|