Static Value-Flow Analysis
Loading...
Searching...
No Matches
Functions
cfl.cpp File Reference
#include "SVF-LLVM/LLVMUtil.h"
#include "SVF-LLVM/SVFIRBuilder.h"
#include "CFL/CFLAlias.h"
#include "CFL/CFLVF.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 42 of file cfl.cpp.

43{
44 // Parses command-line arguments and stores any module names in moduleNameVec
45 std::vector<std::string> moduleNameVec;
47 argc, argv, "CFL Reachability Analysis", "[options] <input-bitcode...>"
48 );
49
50 // If the WriteAnder option is set to "ir_annotator", pre-processes the bytecodes of the modules
51 if (Options::WriteAnder() == "ir_annotator")
52 {
54 }
55
56 // Pointer to the SVF Intermediate Representation (IR) of the module
57 SVFIR* svfir = nullptr;
58
59 // If no CFLGraph option is specified, the SVFIR is built from the .bc (bytecode) files of the modules
60 if (Options::CFLGraph().empty())
61 {
63 SVFIRBuilder builder(svfModule);
64 svfir = builder.build();
65 } // if no dot form CFLGraph is specified, we use svfir from .bc.
66
67 // The CFLBase pointer that will be used to run the analysis
68 std::unique_ptr<CFLBase> cfl;
69
70 // Determines which type of analysis to run based on the options and sets up cfl accordingly
71 if (Options::CFLSVFG())
72 cfl = std::make_unique<CFLVF>(svfir);
73 else if (Options::POCRHybrid())
74 cfl = std::make_unique<POCRHybrid>(svfir);
75 else if (Options::POCRAlias())
76 cfl = std::make_unique<POCRAlias>(svfir);
77 else
78 cfl = std::make_unique<CFLAlias>(svfir); // if no svfg is specified, we use CFLAlias as the default one.
79
80 // Runs the analysis
81 cfl->analyze();
82
83 // Releases the SVFIR and the LLVMModuleSet to free memory
86
87
88 return 0;
89
90}
static std::vector< std::string > parseOptions(int argc, char *argv[], std::string description, std::string callFormat)
Definition CommandLine.h:75
static void releaseLLVMModuleSet()
Definition LLVMModule.h:129
static void preProcessBCs(std::vector< std::string > &moduleNameVec)
static SVFModule * buildSVFModule(Module &mod)
static const Option< bool > POCRAlias
Definition Options.h:237
static const Option< bool > POCRHybrid
Definition Options.h:238
static const Option< bool > CFLSVFG
Definition Options.h:236
static const Option< std::string > CFLGraph
Definition Options.h:232
static const Option< std::string > WriteAnder
Definition Options.h:212
static void releaseSVFIR()
Definition SVFIR.h:124
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74