svf-tools 1.0.730 → 1.0.732
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/CFL/CFGNormalizer.h +1 -1
- package/svf/include/CFL/CFLAlias.h +2 -2
- package/svf/include/CFL/CFLBase.h +3 -0
- package/svf/include/CFL/CFLGramGraphChecker.h +10 -10
- package/svf/include/CFL/CFLGrammar.h +29 -29
- package/svf/include/CFL/CFLGraphBuilder.h +68 -44
- package/svf/include/CFL/CFLVF.h +3 -0
- package/svf/include/SVFIR/SVFValue.h +7 -0
- package/svf/include/Util/ExtAPI.h +209 -19
- package/svf/include/Util/ExtAPI.json +125 -22
- package/svf/include/Util/Options.h +1 -0
- package/svf/include/Util/SVFUtil.h +12 -5
- package/svf/lib/CFL/CFGNormalizer.cpp +26 -26
- package/svf/lib/CFL/CFLAlias.cpp +3 -0
- package/svf/lib/CFL/CFLBase.cpp +23 -2
- package/svf/lib/CFL/CFLGrammar.cpp +19 -19
- package/svf/lib/CFL/CFLGraphBuilder.cpp +153 -178
- package/svf/lib/CFL/CFLSolver.cpp +3 -3
- package/svf/lib/CFL/CFLVF.cpp +18 -0
- package/svf/lib/Util/ExtAPI.cpp +90 -18
- package/svf/lib/Util/Options.cpp +6 -0
- package/svf-llvm/include/SVF-LLVM/LLVMModule.h +1 -0
- package/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +10 -5
- package/svf-llvm/lib/LLVMUtil.cpp +21 -11
- package/svf-llvm/lib/SVFIRBuilder.cpp +1 -423
- package/svf-llvm/lib/SVFIRExtAPI.cpp +681 -0
- package/svf-llvm/tools/CFL/cfl.cpp +14 -0
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
// Author: Yulei Sui,
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
+
// This file is a driver for Context-Free Language (CFL) Reachability Analysis. The code
|
|
30
|
+
// processes command-line arguments, sets up the analysis based on these arguments, and
|
|
31
|
+
// then runs the analysis.
|
|
29
32
|
|
|
30
33
|
#include "SVF-LLVM/LLVMUtil.h"
|
|
31
34
|
#include "SVF-LLVM/SVFIRBuilder.h"
|
|
@@ -37,17 +40,22 @@ using namespace SVF;
|
|
|
37
40
|
|
|
38
41
|
int main(int argc, char ** argv)
|
|
39
42
|
{
|
|
43
|
+
// Parses command-line arguments and stores any module names in moduleNameVec
|
|
40
44
|
std::vector<std::string> moduleNameVec;
|
|
41
45
|
moduleNameVec = OptionBase::parseOptions(
|
|
42
46
|
argc, argv, "CFL Reachability Analysis", "[options] <input-bitcode...>"
|
|
43
47
|
);
|
|
44
48
|
|
|
49
|
+
// If the WriteAnder option is set to "ir_annotator", pre-processes the bytecodes of the modules
|
|
45
50
|
if (Options::WriteAnder() == "ir_annotator")
|
|
46
51
|
{
|
|
47
52
|
LLVMModuleSet::preProcessBCs(moduleNameVec);
|
|
48
53
|
}
|
|
49
54
|
|
|
55
|
+
// Pointer to the SVF Intermediate Representation (IR) of the module
|
|
50
56
|
SVFIR* svfir = nullptr;
|
|
57
|
+
|
|
58
|
+
// If no CFLGraph option is specified, the SVFIR is built from the .bc (bytecode) files of the modules
|
|
51
59
|
if (Options::CFLGraph().empty())
|
|
52
60
|
{
|
|
53
61
|
SVFModule* svfModule = LLVMModuleSet::buildSVFModule(moduleNameVec);
|
|
@@ -55,7 +63,10 @@ int main(int argc, char ** argv)
|
|
|
55
63
|
svfir = builder.build();
|
|
56
64
|
} // if no dot form CFLGraph is specified, we use svfir from .bc.
|
|
57
65
|
|
|
66
|
+
// The CFLBase pointer that will be used to run the analysis
|
|
58
67
|
std::unique_ptr<CFLBase> cfl;
|
|
68
|
+
|
|
69
|
+
// Determines which type of analysis to run based on the options and sets up cfl accordingly
|
|
59
70
|
if (Options::CFLSVFG())
|
|
60
71
|
cfl = std::make_unique<CFLVF>(svfir);
|
|
61
72
|
else if (Options::POCRHybrid())
|
|
@@ -64,8 +75,11 @@ int main(int argc, char ** argv)
|
|
|
64
75
|
cfl = std::make_unique<POCRAlias>(svfir);
|
|
65
76
|
else
|
|
66
77
|
cfl = std::make_unique<CFLAlias>(svfir); // if no svfg is specified, we use CFLAlias as the default one.
|
|
78
|
+
|
|
79
|
+
// Runs the analysis
|
|
67
80
|
cfl->analyze();
|
|
68
81
|
|
|
82
|
+
// Releases the SVFIR and the LLVMModuleSet to free memory
|
|
69
83
|
SVFIR::releaseSVFIR();
|
|
70
84
|
SVF::LLVMModuleSet::releaseLLVMModuleSet();
|
|
71
85
|
|