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.
@@ -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