Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
Doxygen Documentation
https://svf-tools.github.io/SVF
Admin
Automatically generated technical documentation for a software project.
Tokens:
3,064,470
Snippets:
25,728
Trust Score:
9.7
Update:
4 months ago
Context
Chat
Benchmark
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### build Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1LLVMLoopAnalysis.html Starts the loop analysis process. ```APIDOC ## build(ICFG *icfg) ### Description Start from here. Initiates the loop analysis process. ### Method `virtual void` ### Endpoint N/A ### Parameters * **icfg** (ICFG *) - Pointer to the ICFG object. ### Request Example None ### Response None ``` -------------------------------- ### Start SVFG Optimization Timing Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1SVFGStat.html Records the start time for SVFG optimization. This is used for performance profiling. ```cpp void SVF::SVFGStat::sfvgOptStart(void) { svfgOptTimeStart = PTAStat::getClk(true); } ``` -------------------------------- ### Get Start Kind Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1GrammarBase.html Returns the Kind value designated as the start symbol for the grammar. ```C++ Kind SVF::GrammarBase::getStartKind() { return this->startKind; } ``` -------------------------------- ### Start Build Process Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1LLVMLoopAnalysis.html Initiates the build process for LLVM loop analysis. This is the entry point for the analysis. ```cpp void LLVMLoopAnalysis::build(ICFG *icfg) { std::vector<const Loop *> llvmLoops; buildLLVMLoops(icfg); } ``` -------------------------------- ### begin() Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1SparseBitVector.html Returns an iterator to the beginning of the sparse bit vector. ```APIDOC ## begin() ### Description Returns an iterator pointing to the first element of the sparse bit vector. ### Method `iterator begin()` ### Returns An iterator to the beginning of the sparse bit vector. ``` -------------------------------- ### Get Start Kind Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1CFGrammar.html Retrieves the kind value designated as the starting kind for the grammar. ```APIDOC ## getStartKind() ### Description Returns the `Kind` value that is designated as the starting point or root kind for grammar parsing or analysis. ### Method `getStartKind` ### Parameters None ### Returns `Kind`: The start kind of the grammar. ### Code Example ```cpp Kind startKind = grammar.getStartKind(); ``` ``` -------------------------------- ### Get Start Kind in CFGrammar Source: https://svf-tools.github.io/SVF-doxygen/html/CFGrammar_8h_source.html Returns the start kind of the grammar. This inline function provides direct access to the startKind member. ```C++ inline Kind getStartKind() { return this->startKind; } ``` -------------------------------- ### SVF Module Building and Analysis Setup Source: https://svf-tools.github.io/SVF-doxygen/html/ae_8cpp_source.html Shows the process of building an SVFIR module and setting up abstract interpretation with various detectors. ```C++ LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec); SVFIRBuilder builder; SVFIR* pag = builder.build(); // Run Andersen's to resolve indirect calls, then update SVFIR with resolved targets. // The Andersen singleton will be reused inside AbstractInterpretation::runOnModule(). AndersenWaveDiff* ander = AndersenWaveDiff::createAndersenWaveDiff(pag); builder.updateCallGraph(ander->getCallGraph()); AbstractInterpretation& ae = AbstractInterpretation::getAEInstance(); if (Options::BufferOverflowCheck()) ae.addDetector(std::make_unique<BufOverflowDetector>()); if (Options::NullDerefCheck()) ae.addDetector(std::make_unique<NullptrDerefDetector>()); ae.runOnModule(); AndersenWaveDiff::releaseAndersenWaveDiff(); LLVMModuleSet::releaseLLVMModuleSet(); ``` -------------------------------- ### begin() Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1WTOCycle.html Returns an iterator to the beginning of the component list. ```APIDOC ## Iterator begin() const ### Description Begin iterator over the components. ### Returns * (Iterator) - An iterator pointing to the first component. ### Definition Line 424 of file WTO.h. ``` -------------------------------- ### Get Start Routine of CxtThread Source: https://svf-tools.github.io/SVF-doxygen/html/TCT_8h_source.html Retrieves the FunObjVar pointer representing the start routine for a given CxtThread from a map. Asserts if the CxtThread is not found. ```C++ const FunObjVar* getStartRoutineOfCxtThread(const CxtThread& ct) const { CxtThreadToFun::const_iterator it = ctToRoutineFunMap.find(ct); assert(it!=ctToRoutineFunMap.end() && "Cxt Thread not found!!"); return it->second; } ``` -------------------------------- ### initialize Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1POCRSolver-members.html Initializes the solver. ```APIDOC ## initialize() ### Description Initializes the solver's internal state before analysis begins. ### Method virtual ``` -------------------------------- ### Get Start Routine of Context Thread in SVF TCT Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1TCT.html Retrieves the start routine function for a given context thread. Asserts if the context thread is not found. ```cpp const FunObjVar * SVF::TCT::getStartRoutineOfCxtThread ( const CxtThread & _ct_ ) const { CxtThreadToFun::const_iterator it = ctToRoutineFunMap.find(ct); assert(it!=ctToRoutineFunMap.end() && "Cxt Thread not found!!"); return it->second; } ``` -------------------------------- ### BasicBlockG.cpp Includes Source: https://svf-tools.github.io/SVF-doxygen/html/BasicBlockG_8cpp.html Includes necessary headers for BasicBlockG, ICFGNode, and Options. ```cpp #include "Graphs/BasicBlockG.h" #include "Graphs/ICFGNode.h" #include "Util/Options.h" ``` -------------------------------- ### Get Element Index Source: https://svf-tools.github.io/SVF-doxygen/html/SparseBitVector_8h_source.html Returns the index of the SparseBitVectorElement, which indicates the starting position of its bits. ```C++ unsigned index() const { return ElementIndex; } ``` -------------------------------- ### Dump Grammar to File Source: https://svf-tools.github.io/SVF-doxygen/html/CFGrammar_8cpp_source.html Writes the current grammar state, including start kind and epsilon productions, to a specified file. The output format includes the start kind and details of epsilon productions. ```C++ void CFGrammar::dump(std::string fileName) const { std::ofstream gramFile(fileName); gramFile << "Start Kind:\n"; gramFile << '\t' << kindToStr(startKind) << '(' << startKind << ')' << ' ' << " \n\n"; gramFile << "Epsilon Production:\n"; std::vector<std::string> strV; for (auto pro: this->epsilonProds) { std::stringstream ss; for (auto sym : pro) { if (sym == pro[1]) { ``` -------------------------------- ### Get Source Node Source: https://svf-tools.github.io/SVF-doxygen/html/ProgSlice_8h_source.html Returns the source node of the program slice. This is the starting point for slice computation. ```C++ inline const SVFGNode* getSource() const { return root; } ``` -------------------------------- ### initSnks() Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1SrcSnkDDA.html Pure virtual method to initialize sinks. Must be implemented by derived classes. ```APIDOC ## initSnks() ### Description Initialize sinks. ### Method virtual void ### Endpoint N/A ### Parameters None ### Request Example None ### Response #### Success Response None ### Response Example None ``` -------------------------------- ### Get Base Value for External Argument (Constant Struct Example) Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1SVFIRBuilder.html Retrieves the base value for a pointer operand loaded from a constant struct, even when the offset is not zero. This example shows that the base value is recognized as itself in such cases. ```llvm @conststruct = internal global <{ [40 x i8], [4 x i8], [4 x i8], [2512 x i8] }> <{ [40 x i8] undef, [4 x i8] zeroinitializer, [4 x i8] undef, [2512 x i8] zeroinitializer }>, align 8 %0 = load ptr, ptr getelementptr inbounds (<{ [40 x i8], [4 x i8], [4 x i8], [2512 x i8] }>, ptr @conststruct, i64 0, i32 0, i64 16) ``` -------------------------------- ### initialize Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1POCRHybridSolver.html Initializes the worklist for the solver. ```APIDOC ## initialize() ### Description Initializes the worklist for the solver. ### Definition (Source does not specify file and line for this method) ``` -------------------------------- ### Get Base Node of GepValVar Source: https://svf-tools.github.io/SVF-doxygen/html/SVFVariables_8h_source.html Returns the base ValVar from which this GepValVar is derived. This establishes the starting point for the access path. ```cpp inline const ValVar* getBaseNode(void) const { return base; } ``` -------------------------------- ### initialize() Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1POCRHybridSolver.html Initializes the worklist and hybrid dataset for the solver. Adds initial edges and epsilon productions. ```APIDOC ## initialize() ### Description Initializes the solver's worklist and hybrid dataset. It starts by adding all control flow graph (CFG) edges to the worklist. Then, for each node in the graph, it adds an index from the node to itself. Finally, it processes epsilon productions from the grammar, adding corresponding edges and pushing them onto the worklist if they are new. ### Method `void POCRHybridSolver::initialize()` ### Initialization Steps 1. Adds all edges from `graph->getCFLEdges()` to the worklist. 2. For each node `nId` in the graph, calls `addInd_h(nId, nId)`. 3. For each epsilon production `prod` from `grammar->getEpsilonProds()`: - If `addEdge(IDMap.first, IDMap.first, X)` is true: - Creates a new `CFLNode` and `CFLEdge`. - Pushes the new edge onto the worklist. ``` -------------------------------- ### Get Next Instructions Source: https://svf-tools.github.io/SVF-doxygen/html/LLVMUtil_8cpp_source.html Recursively collects subsequent non-intrinsic instructions starting from a given instruction. Handles terminators by exploring successor basic blocks. ```C++ void LLVMUtil::getNextInsts(const Instruction* curInst, std::vector<const Instruction*>& instList) { if (!curInst->isTerminator()) { const Instruction* nextInst = curInst->getNextNode(); if (LLVMUtil::isIntrinsicInst(nextInst)) getNextInsts(nextInst, instList); else instList.push_back(nextInst); } else { const BasicBlock *BB = curInst->getParent(); // Visit all successors of BB in the CFG for (succ_const_iterator it = succ_begin(BB), ie = succ_end(BB); it != ie; ++it) { const Instruction* nextInst = &((*it)->front()); if (LLVMUtil::isIntrinsicInst(nextInst)) getNextInsts(nextInst, instList); else instList.push_back(nextInst); } } } ``` -------------------------------- ### initialize Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1BVDataPTAImpl.html Initializes the pointer analysis. ```APIDOC ## virtual void initialize () ### Description Performs the initialization steps for the pointer analysis, including building the symbol table and SVFIR. ``` -------------------------------- ### Get Base Value for External Argument (Global Variable Example) Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1SVFIRBuilder.html Retrieves the base value for a pointer operand loaded from a global variable, considering byte offsets. This example demonstrates how to find the base value when dealing with global struct initializers and memory copy operations. ```llvm @i1 = dso_local global struct.inner { i32 0, ptr @f1, ptr @f2 } @n1 = dso_local global struct.outer { i32 0, ptr @i1 } inner = alloca struct.inner %0 = load ptr, ptr getelementptr inbounds (struct.outer, ptr @n1, i32 0, i32 1) call void @llvm.memcpy(ptr inner, ptr %0, i64 24, i1 false) ``` -------------------------------- ### C++ Get Map of First RHS Symbol to Productions Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1CFGrammar.html Returns a reference to the map that associates the first symbol on the right-hand side of a production with all productions starting with that symbol. ```cpp SymbolMap< Symbol, Productions > & getFirstRHSToProds() { return firstRHSToProds; } ``` -------------------------------- ### visitInstruction Source: https://svf-tools.github.io/SVF-doxygen/html/functions_func_v.html Visits a generic instruction during IR traversal. ```APIDOC ## visitInstruction ### Description Handles the visiting of a generic instruction within the Intermediate Representation (IR). This serves as a base or fallback for instruction visiting. ### Method Not Applicable (Function Signature) ### Endpoint Not Applicable (Function Signature) ### Parameters None ### Returns - SVF::SVFIRBuilder - The IR builder context. ``` -------------------------------- ### initialize Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1CFLAlias.html Initializes the grammar, graph, and solver for the CFL analysis. ```APIDOC ## void initialize () ### Description Initialize the grammar, graph, and solver. ### Method virtual void ``` -------------------------------- ### Get Virtual Memory Address Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1AddressValue.html Calculates a virtual memory address based on an index. Asserts that the index is not zero. The physical address starts with 0x7f...... + idx. ```cpp inlinestatic The physical address starts with 0x7f...... + idx. Definition at line 211 of file AddressValue.h. { // 0 is the null address, should not be used as a virtual address assert(idx != 0 && "idx can’t be 0 because it represents a nullptr"); return AddressMask + idx; } ``` -------------------------------- ### Get Function Entry CHI Set Source: https://svf-tools.github.io/SVF-doxygen/html/MemSSA_8h_source.html Retrieves the CHI set associated with the entry point of a given FunObjVar. This provides access to heap information at function start. ```C++ inline CHISet& getFuncEntryChiSet(const FunObjVar * fun) { return funToEntryChiSetMap[fun]; } ``` -------------------------------- ### init() Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1WTO.html Initializes the WTO structure by visiting the entry node, clearing internal mappings, and building the node-to-depth table. ```APIDOC ## init() ### Description Initializes the WTO structure. ### Signature ```cpp template<typename GraphT > void SVF::WTO< GraphT >::init() ``` ### Definition File: WTO.h, Line: 673 ``` -------------------------------- ### begin() Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1CoreBitVector.html Returns a const_iterator to the beginning of the CoreBitVector. ```APIDOC ## begin() ### Description Returns a `const_iterator` to the beginning of the `CoreBitVector`. This allows iteration over the bits in the vector. ### Method `CoreBitVector::const_iterator SVF::CoreBitVector::begin(void) const` ### Returns A `const_iterator` pointing to the first element. ``` -------------------------------- ### C++ Get Productions from First RHS Symbol Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1CFGrammar.html Finds and returns all productions that start with a given symbol on their right-hand side. Asserts if the symbol is not found as a first RHS symbol in any production. ```cpp const Productions & getProdsFromFirstRHS(const Symbol _sym_) const { auto it = firstRHSToProds.find(sym); assert(it!=firstRHSToProds.end() && "production (X -> sym Y ) not found for sym!!"); return it->second; } ``` -------------------------------- ### Get Argument Index Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1ArgValVar.html Returns the index of this formal argument within its containing function. For example, in 'void foo(int a, float b)', 'a' is 0 and 'b' is 1. This is an inline function. ```cpp u32_t SVF::ArgValVar::getArgNo() const { return argNo; } ``` -------------------------------- ### Read Points-to Sets from File Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1FlowSensitive.html Initializes the solver and loads points-to sets from a specified file. Finalizes the analysis after loading. ```cpp void FlowSensitive::readPtsFromFile(const std::string &filename) { initialize(); if(!filename.empty()) this->readFromFile(filename); finalize(); } ``` -------------------------------- ### Get Function Entry ICFG Node in C++ Source: https://svf-tools.github.io/SVF-doxygen/html/AEWTO_8cpp_source.html Retrieves the entry node for a given function in the ICFG (Intermediate Control Flow Graph). Used to access the starting point of a function's control flow. ```cpp FunEntryICFGNode * getFunEntryICFGNode(const FunObjVar *fun) ``` -------------------------------- ### Initialize POCRHybridSolver Source: https://svf-tools.github.io/SVF-doxygen/html/CFLAlias_8cpp_source.html Initializes the POCRHybridSolver with the graph and grammar. ```cpp void POCRHybrid::initializeSolver() { solver = new POCRHybridSolver(graph, grammar); } ``` -------------------------------- ### Get Base Value for External Argument (Struct Example) Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1SVFIRBuilder.html Retrieves the base value for a struct member accessed via getelementptr with a zero offset. This is useful when the base value is recognized as the base if the field index is 0. ```llvm %0 = getelementptr inbounds struct.outer, struct.inner base, i32 0, i32 0 call void @llvm.memcpy(ptr inner, ptr %0, i64 24, i1 false) ``` -------------------------------- ### initialize Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1POCRSolver.html Initializes the worklist by adding all CFG edges and epsilon productions to it. This method is virtual and reimplemented in derived classes. ```APIDOC ## initialize() ### Description Initializes the worklist. It adds all CFG edges to the worklist and then iterates through epsilon productions, adding corresponding nodes to the worklist if they don't already exist. ### Signature `void POCRSolver::initialize()` ### Remarks This method is virtual and reimplemented from `SVF::CFLSolver`. It is also reimplemented in `SVF::POCRHybridSolver`. ### Definition CFLSolver.cpp:192 ``` -------------------------------- ### Get Full Cycle Head State in Semi-Sparse Interpretation Source: https://svf-tools.github.io/SVF-doxygen/html/SparseAbstractInterpretation_8cpp_source.html Retrieves the abstract state at the head of a cycle, starting from a dense snapshot and pulling cycle-specific ValVars from their definition sites. Skips ValVars without a stored value to prevent contamination. ```cpp AbstractState SemiSparseAbstractInterpretation::getFullCycleHeadState( const ICFGCycleWTO* cycle) { // Start from the dense snapshot (ObjVars + any ValVars that happen to // be cached at cycle_head's trace entry). AbstractState snap = AbstractInterpretation::getFullCycleHeadState(cycle); const Set<const ValVar*>& valVars = preAnalysis->getCycleValVars(cycle); if (valVars.empty()) return snap; // no cycle ValVars known: nothing to pull // Drop stale ValVar entries and pull each cycle ValVar from its // def-site. ValVars without a genuine stored value are skipped to // avoid getAbsValue's top-fallback contaminating body def-sites on // the subsequent widen/narrow scatter. snap.clearValVars(); for (const ValVar* v : valVars) { const ICFGNode* defSite = v->getICFGNode(); if (!defSite || !hasAbsValue(v, defSite)) continue; snap[v->getId()] = getAbsValue(v, defSite); } return snap; } ``` -------------------------------- ### build Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1CDGBuilder.html Starts the control dependence graph building process. ```APIDOC ## build() ### Description Initiates the control dependence graph construction process. ### Method void ### Parameters None ``` -------------------------------- ### begin() Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1PointsTo.html Returns an iterator to the beginning of the points-to set, allowing iteration over the contained node IDs. ```APIDOC ## begin() ### Description Returns a constant iterator to the beginning of the points-to set. This allows for iteration over the elements within the set. ### Method const_iterator SVF::PointsTo::begin() const ### Returns A `PointsToIterator` pointing to the first element. ### Definition File: PointsTo.h, Line: 128 ``` -------------------------------- ### Install Target in CMake Source: https://svf-tools.github.io/SVF-doxygen/html/CMakeLists_8txt.html Installs a specified build target. This command is used to define which targets should be installed and where. ```cmake install( TARGETS ${_tool} ) ``` -------------------------------- ### Get Function Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1FormalINSVFGNode.html Gets the function associated with this SVFG node. ```APIDOC ## getFun () ### Description Get the function of this SVFGNode. ### Returns - (const FunObjVar *) - Pointer to the function object. ``` -------------------------------- ### Build Usage String for Command-Line Options Source: https://svf-tools.github.io/SVF-doxygen/html/CommandLine_8h_source.html Constructs a formatted usage string for command-line arguments. It lists options and their descriptions, aligning them for readability. Supports splitting into two columns based on option length. ```C++ static std::string buildUsage( const std::string description, const std::string argv0, const std::string callFormat ) { // Determine longest option to split into two columns: options and descriptions. unsigned longest = 0; for (const std::pair<std::string, OptionBase *> nopt : getOptionsMap()) { const std::string name = std::get<0>(nopt); const OptionBase *option = std::get<1>(nopt); if (option->isMultiple()) { // For Multiple, description goes in left column. if (option->description.length() > longest) longest = option->description.length(); } else { if (name.length() > longest) longest = name.length(); } for (const PossibilityDescription &pd : option->possibilityDescriptions) { const std::string possibility = std::get<0>(pd); if (possibility.length() + 3 > longest) longest = possibility.length() + 3; } } std::stringstream ss; ss << description << std::endl << std::endl; ss << "USAGE:" << std::endl; ss << " " << argv0 << " " << callFormat << std::endl; ss << std::endl; return ss.str(); } ``` -------------------------------- ### Initialize POCRSolver Source: https://svf-tools.github.io/SVF-doxygen/html/CFLAlias_8cpp_source.html Initializes the POCRSolver with the graph and grammar. ```cpp void POCRAlias::initializeSolver() { solver = new POCRSolver(graph, grammar); } ``` -------------------------------- ### gets Function Definition (short) Source: https://svf-tools.github.io/SVF-doxygen/html/extapi_8c_source.html A concise definition of the gets function. ```c gets char * gets(char *str) **Definition** extapi.c:879 ``` -------------------------------- ### Get Z3 Expression Size Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1Z3Expr.html Gets the number of subexpressions within a Z3 expression. ```cpp static u32_t getExprSize (const Z3Expr &z3Expr) | get the number of subexpression of a Z3 expression ``` -------------------------------- ### initialize Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1CFLBase.html Initialization of a pointer analysis, including building the symbol table and SVFIR. ```APIDOC ## initialize ### Description Initialization of a pointer analysis, including building the symbol table and SVFIR. ### Signature virtual void initialize () ``` -------------------------------- ### Get SVF Statement List from Instruction Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1MRGenerator.html Given an instruction, get all its PAGEdges (statements). ```C++ SVFStmtList & getSVFStmtList(const ICFGNode *inst) Given an instruction, get all its PAGEdges. **Definition** SVFIR.h:316 ``` -------------------------------- ### SVF::POCRHybridSolver::initialize Source: https://svf-tools.github.io/SVF-doxygen/html/CFLSolver_8cpp_source.html Initializes the worklist for the POCRHybridSolver. This method sets up the solver's state before processing. ```APIDOC ## SVF::POCRHybridSolver::initialize ### Description Initializes the worklist for the POCRHybridSolver. This prepares the solver for its operations. ### Method `virtual void initialize()` ### Definition `CFLSolver.cpp:284` ``` -------------------------------- ### Functions starting with 'r' Source: https://svf-tools.github.io/SVF-doxygen/html/globals_func_r.html This section lists functions starting with 'r' and the files they are defined in. ```APIDOC ## Functions starting with 'r' ### Description This section lists functions starting with 'r' and the files they are defined in. ### Functions - **re_comp()**: Defined in `extapi.c` - **readdir_r()**: Defined in `extapi.c` - **realpath()**: Defined in `extapi.c` - **replace_item_in_object()**: Defined in `cJSON.cpp` - **replaceExtension()**: Defined in `llvm2svf.cpp` - **return()**: Defined in `cJSON.cpp` - **rindex()**: Defined in `extapi.c` ``` -------------------------------- ### SVF::WPASolver::initWorklist Source: https://svf-tools.github.io/SVF-doxygen/html/Andersen_8cpp_source.html Initializes the worklist for the WPASolver. ```APIDOC ## SVF::WPASolver::initWorklist ### Description Initializes the worklist of the WPASolver, preparing it for constraint solving. ### Method virtual void ### Endpoint N/A (Method Signature) ### Parameters None ### Response None ``` -------------------------------- ### Set Start Kind Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1CFGrammar.html Sets the kind value designated as the starting kind for the grammar. ```APIDOC ## setStartKind(Kind startKind) ### Description Sets the `Kind` value that will be used as the starting point for grammar operations. ### Method `setStartKind` ### Parameters * **startKind** (`Kind`): The `Kind` value to set as the start kind. ### Returns `void` ### Code Example ```cpp grammar.setStartKind(newStartKind); ``` ``` -------------------------------- ### begin() Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1CondPointsToSet.html Returns an iterator to the beginning of the conditional points-to set. Overloaded for const and non-const access. ```APIDOC ## begin() ### Description Returns an iterator to the beginning of the conditional points-to set. This method is overloaded for const and non-const instances of `CondPointsToSet`. ### Method `iterator begin()` ### Returns `iterator`: An iterator pointing to the first element in the set. ``` ```APIDOC ## begin() const ### Description Returns a const iterator to the beginning of the conditional points-to set. ### Method `iterator begin() const` ### Returns `iterator`: A const iterator pointing to the first element in the set. ``` -------------------------------- ### gets Function Signature Source: https://svf-tools.github.io/SVF-doxygen/html/extapi_8c_source.html Declaration for the gets function, which reads characters from stdin until a newline or EOF. ```c char * gets(char *str) ``` -------------------------------- ### PointsTo begin() Method Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1PointsTo.html Returns an iterator to the beginning of the points-to set. Used for iterating over the elements in the set. ```cpp inline PointsToIterator SVF::PointsTo::begin() const { return PointsToIterator(this); } ``` -------------------------------- ### Get PTA SVF Statement List from Instruction Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1MRGenerator.html Given an instruction, get all its PTA PAGEdges. ```C++ SVFStmtList & getPTASVFStmtList(const ICFGNode *inst) Given an instruction, get all its PTA PAGEdges. **Definition** SVFIR.h:321 ``` -------------------------------- ### SVFIRBuilder::build() Method Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1SVFIRBuilder.html This method starts the SVFIR building process. It handles initialization, graph constructions (ICFG, CallGraph, CHG), and visits all instructions to populate the SVFIR. It returns the built SVFIR object. ```cpp virtual SVFIR * SVFIRBuilder::build(PAG* pag) { double startTime = SVFStat::getClk(true); DBOUT(DGENERAL, outs() << pasMsg(" Building SVFIR ...\n")); // If the SVFIR has been built before, then we return the unique SVFIR of the program if(pag->getNodeNumAfterPAGBuild() > 1) return pag; createFunObjVars(); ICFGBuilder icfgbuilder; pag->icfg = icfgbuilder.build(); initialiseNodes(); visitGlobal(); CallGraphBuilder callGraphBuilder; std::vector<const FunObjVar*> funset; for (const auto& item: llvmModuleSet()->getFunctionSet()) { funset.push_back(llvmModuleSet()->getFunObjVar(item)); } pag->callGraph = callGraphBuilder.buildSVFIRCallGraph(funset); CHGraph* chg = new CHGraph(); CHGBuilder chgbuilder(chg); chgbuilder.buildCHG(); pag->setCHG(chg); for (Module& M : llvmModuleSet()->getLLVMModules()) { for (Module::const_iterator F = M.begin(), E = M.end(); F != E; ++F) { const Function& fun = *F; const FunObjVar* svffun = llvmModuleSet()->getFunObjVar(&fun); if(!fun.isDeclaration()) { if (fun.doesNotReturn() == false && fun.getReturnType()->isVoidTy() == false) { pag->addFunRet(svffun, pag->getValVar(pag->getReturnNode(svffun))); } for (Function::const_arg_iterator I = fun.arg_begin(), E = fun.arg_end(); I != E; ++I) { setCurrentLocation(&*I,&fun.getEntryBlock()); NodeID argValNodeId = llvmModuleSet()->getValueNode(&*I); // if this is the function does not have caller (e.g. main) // or a dead function, shall we create a black hole address edge for it? // it is (1) too conservative, and (2) make FormalParmVFGNode defined at blackhole address PAGEdge. // if(SVFUtil::ArgInNoCallerFunction(&*I)) { // if(I->getType()->isPointerTy()) // addBlackHoleAddrEdge(argValNodeId); //} pag->addFunArgs(svffun,pag->getValVar(argValNodeId)); } } for (Function::const_iterator bit = fun.begin(), ebit = fun.end(); bit != ebit; ++bit) { const BasicBlock& bb = *bit; for (BasicBlock::const_iterator it = bb.begin(), eit = bb.end(); it != eit; ++it) { const Instruction& inst = *it; setCurrentLocation(&inst,&bb); visit(const_cast<Instruction&>(inst)); } } } } sanityCheck(); pag->initialiseCandidatePointers(); pag->setNodeNumAfterPAGBuild(pag->getTotalNodeNum()); // dump SVFIR if (Options::PAGDotGraph()) pag->dump("svfir_initial"); // print to command line of the SVFIR graph if (Options::PAGPrint()) pag->print(); // dump ICFG if (Options::DumpICFG()) pag->getICFG()->dump("icfg_initial"); if (Options::LoopAnalysis()) { LLVMLoopAnalysis loopAnalysis; loopAnalysis.build(pag->getICFG()); } // dump SVFIR as JSON if (!Options::DumpJson().empty()) { assert(false && "please implement SVFIRWriter::writeJsonToPath"); } double endTime = SVFStat::getClk(true); SVFStat::timeOfBuildingSVFIR = (endTime - startTime) / TIMEINTERVAL; return pag; } ``` -------------------------------- ### Initialize SVF Module and Build PAG Source: https://svf-tools.github.io/SVF-doxygen/html/saber_8cpp_source.html Parses command-line options, builds the SVF module, and constructs the Program Analysis Graph (PAG). This is a foundational step for bug detection. ```C++ #include "SVF-LLVM/LLVMUtil.h" #include "SVF-LLVM/SVFIRBuilder.h" #include "SABER/LeakChecker.h" #include "SABER/FileChecker.h" #include "SABER/DoubleFreeChecker.h" #include "Util/CommandLine.h" #include "Util/Options.h" #include "Util/Z3Expr.h" using namespace llvm; using namespace SVF; int main(int argc, char ** argv) { std::vector<std::string> moduleNameVec; moduleNameVec = OptionBase::parseOptions( argc, argv, "Source-Sink Bug Detector", "[options] <input-bitcode...>"); LLVMModuleSet::buildSVFModule(moduleNameVec); SVFIRBuilder builder; SVFIR* pag = builder.build(); std::unique_ptr<LeakChecker> saber; if(Options::MemoryLeakCheck()) saber = std::make_unique<LeakChecker>(); else if(Options::FileCheck()) saber = std::make_unique<FileChecker>(); else if(Options::DFreeCheck()) saber = std::make_unique<DoubleFreeChecker>(); else saber = std::make_unique<LeakChecker>(); // if no checker is specified, we use leak checker as the default one. saber->runOnModule(pag); LLVMModuleSet::releaseLLVMModuleSet(); return 0; } ``` -------------------------------- ### C: gets function definition Source: https://svf-tools.github.io/SVF-doxygen/html/extapi_8c.html Provides the definition for the gets function, used for reading strings from a stream. ```c char * gets | ( | char * | _str_| ) | { return str; } ``` -------------------------------- ### POCRHybrid Initialization and Solving Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1POCRHybrid.html Functions for initializing and running the POCRHybrid solver. ```APIDOC ## POCRHybrid (SVFIR *ir) ### Description Constructor for the POCRHybrid class. ## initializeSolver () ### Description Initialize POCRHybrid Solver. ### Method void ## solve () ### Description Solving CFL Reachability. ### Method void ``` -------------------------------- ### init Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1ICFGWTO.html Initializes the ICFGWTO structure. ```APIDOC ## void init() ### Description Initializes the ICFGWTO structure. ### Method POST (Implicit) ``` -------------------------------- ### C gets Function Source: https://svf-tools.github.io/SVF-doxygen/html/extapi_8c_source.html This function reads a line from standard input. Note: gets is considered dangerous and should be avoided. ```c char* gets(char *str) { return str; } ``` -------------------------------- ### Start Analysis Limit Timer Source: https://svf-tools.github.io/SVF-doxygen/html/namespaceSVF_1_1SVFUtil.html Starts a timer to limit the analysis duration. Takes the time limit in seconds. ```C++ bool | startAnalysisLimitTimer (unsigned timeLimit) ``` -------------------------------- ### Initialize WTO Components Source: https://svf-tools.github.io/SVF-doxygen/html/AEWTO_8cpp_source.html Initializes WTO components for functions, identifying entry points and building ICFGWTO objects for SCCs. ```cpp void AEWTO::initWTO() { callGraphSCC->find(); for (auto it = callGraph->begin(); it != callGraph->end(); it++) { const FunObjVar *fun = it->second->getFunction(); if (fun->isDeclaration()) continue; NodeID repNodeId = callGraphSCC->repNode(it->second->getId()); auto cgSCCNodes = callGraphSCC->subNodes(repNodeId); bool isEntry = false; if (it->second->getInEdges().empty()) isEntry = true; for (auto inEdge: it->second->getInEdges()) { NodeID srcNodeId = inEdge->getSrcID(); if (!cgSCCNodes.test(srcNodeId)) isEntry = true; } if (isEntry) { Set<const FunObjVar*> funcScc; for (const auto& node: cgSCCNodes) { funcScc.insert(callGraph->getGNode(node)->getFunction()); } ICFGWTO* iwto = new ICFGWTO(icfg->getFunEntryICFGNode(fun), funcScc); iwto->init(); funcToWTO[it->second->getFunction()] = iwto; } } } ``` -------------------------------- ### Functions starting with 'l' Source: https://svf-tools.github.io/SVF-doxygen/html/globals_func_l.html This section lists functions that start with the letter 'l'. Each function is linked to the file it belongs to. ```APIDOC ## Functions starting with 'l' ### Description This section lists functions that start with the letter 'l'. Each function is linked to the file it belongs to. ### Functions * localeconv() : extapi.c * localtime() : extapi.c * localtime_r() : extapi.c ``` -------------------------------- ### Select DDA Client based on User Input Source: https://svf-tools.github.io/SVF-doxygen/html/DDAPass_8cpp_source.html Initializes the appropriate DDA client based on user-specified query options. Asserts if no query options are provided. ```C++ void DDAPass::selectClient() { if (!Options::UserInputQuery().empty()) { if (Options::UserInputQuery() == "funptr") { _client = new FunptrDDAClient(); } else if (Options::UserInputQuery() == "alias") { _client = new AliasDDAClient(); } else { _client = new DDAClient(); if (Options::UserInputQuery() != "all") { u32_t buf; // Have a buffer stringstream ss(Options::UserInputQuery()); // Insert the user input string into a stream while (ss >> buf) _client->setQuery(buf); } } } else { assert(false && "Please specify query options!"); } _client->initialise(); } ``` -------------------------------- ### begin Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1POCRSolver-members.html Returns an iterator to the beginning of the collection. ```APIDOC ## begin() const ### Description Returns a const iterator pointing to the beginning of the collection. ### Method const iterator ### Parameters None ``` ```APIDOC ## begin() ### Description Returns a non-const iterator pointing to the beginning of the collection. ### Method iterator ### Parameters None ``` -------------------------------- ### Set Start Kind Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1GrammarBase.html Sets the Kind identifier for the start symbol of the grammar. This is an inline function for direct assignment. ```cpp void setStartKind(Kind startKind) { this->startKind = startKind; } ``` -------------------------------- ### begin Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1WTOCycleDepth.html Returns an iterator to the beginning of the cycle heads. ```APIDOC ## begin() const ### Description Begin iterator over the head of cycles. ### Method Begin Iterator ### Returns Iterator to the beginning of the cycle heads. ``` -------------------------------- ### Set Start Kind in CFGrammar Source: https://svf-tools.github.io/SVF-doxygen/html/CFGrammar_8h_source.html Sets the start kind for the CFGrammar. This inline function updates the startKind member. ```C++ inline void setStartKind(Kind startKind) { this->startKind = startKind; } ``` -------------------------------- ### Get Heap Allocation Argument Position Source: https://svf-tools.github.io/SVF-doxygen/html/namespaceSVF_1_1SVFUtil.html Gets the position of the argument that holds the allocated heap object for external functions. ```C++ u32_t | getHeapAllocHoldingArgPosition (const FunObjVar *fun) ``` -------------------------------- ### main Source: https://svf-tools.github.io/SVF-doxygen/html/cfl_8cpp.html The main entry point for the Static Value-Flow Analysis tool. It parses command-line arguments and initiates the analysis process. ```APIDOC ## main ### Description The main function serves as the entry point for the SVF analysis tool. It is responsible for handling command-line arguments and orchestrating the overall static value-flow analysis process. ### Signature ```c++ int main(int argc, char **argv) ``` ### Parameters - **argc** (int) - The number of command-line arguments. - **argv** (char **) - An array of strings representing the command-line arguments. ``` -------------------------------- ### visitVAStartInst Source: https://svf-tools.github.io/SVF-doxygen/html/functions_func_v.html Visits a VAStart instruction during IR traversal. ```APIDOC ## visitVAStartInst ### Description Handles the visiting of a VAStart instruction, used for initializing variadic function argument handling, within the Intermediate Representation (IR). ### Method Not Applicable (Function Signature) ### Endpoint Not Applicable (Function Signature) ### Parameters None ### Returns - SVF::SVFIRBuilder - The IR builder context. ``` -------------------------------- ### Get the value name for ObjVar Source: https://svf-tools.github.io/SVF-doxygen/html/SVFVariables_8h_source.html Virtual function to get the name of the ObjVar. It calls the base class getName() method. ```C++ virtual const std::string getValueName() const { return getName(); } ``` -------------------------------- ### Generic Get Graph Name Source: https://svf-tools.github.io/SVF-doxygen/html/structSVF_1_1DOTGraphTraits_3_01ICFG_01_5_01_4.html A generic template function to get the graph name for any GraphType. This is part of the broader DOTGraphTraits functionality. ```C++ template<typename GraphType > static std::string | getGraphName (const GraphType &) ``` -------------------------------- ### SVF::WPAFSSolver Constructor Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1WPAFSSolver.html Initializes a new instance of the WPAFSSolver class. ```APIDOC ## WPAFSSolver() ### Description Constructor for the WPAFSSolver class. ### Method Constructor ### Parameters None ``` -------------------------------- ### buildFullSVFG() Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1SVFGBuilder.html Builds a full SVFG, either optimized or standard, based on the SVFGWithPostOpts flag. ```APIDOC ## buildFullSVFG(BVDataPTAImpl *pta) ### Description Builds a full SVFG. If SVFGWithPostOpts is true, it calls `build` with `VFG::FULLSVFG_OPT`; otherwise, it calls `build` with `VFG::FULLSVFG`. ### Method public ### Parameters * **pta** (BVDataPTAImpl *) - The pointer analysis implementation. ### Returns * SVFG * ``` -------------------------------- ### Get the value name for ValVar Source: https://svf-tools.github.io/SVF-doxygen/html/SVFVariables_8h_source.html Inline function to get the name of the ValVar. It simply calls the base class getName() method. ```C++ inline const std::string getValueName() const { return getName(); } ``` -------------------------------- ### Add Start Routine of Cxt Thread Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1TCT.html Adds the start routine function of a context thread. This function is private and used internally. ```cpp inlineprivate Add start routine function of a cxt thread. Definition at line 556 of file TCT.h. 557 { 558 ctToRoutineFunMap[ct] = fun; 559 } ``` -------------------------------- ### Main function for CFL Reachability Analysis Source: https://svf-tools.github.io/SVF-doxygen/html/cfl_8cpp_source.html This is the main entry point for the CFL Reachability Analysis tool. It parses command-line options, builds the SVF IR, initializes the chosen CFL analysis class, runs the analysis, and cleans up memory. ```C++ #include "SVF-LLVM/LLVMUtil.h" #include "SVF-LLVM/SVFIRBuilder.h" #include "CFL/CFLAlias.h" #include "CFL/CFLVF.h" using namespace llvm; using namespace SVF; int main(int argc, char ** argv) { // Parses command-line arguments and stores any module names in moduleNameVec std::vector<std::string> moduleNameVec; moduleNameVec = OptionBase::parseOptions( argc, argv, "CFL Reachability Analysis", "[options] <input-bitcode...>" ); // Pointer to the SVF Intermediate Representation (IR) of the module SVFIR* svfir = nullptr; // If no CFLGraph option is specified, the SVFIR is built from the .bc (bytecode) files of the modules if (Options::CFLGraph().empty()) { LLVMModuleSet::buildSVFModule(moduleNameVec); SVFIRBuilder builder; svfir = builder.build(); } // The CFLBase pointer that will be used to run the analysis std::unique_ptr<CFLBase> cfl; // Determines which type of analysis to run based on the options and sets up cfl accordingly if (Options::CFLSVFG()) cfl = std::make_unique<CFLVF>(svfir); else if (Options::POCRHybrid()) cfl = std::make_unique<POCRHybrid>(svfir); else if (Options::POCRAlias()) cfl = std::make_unique<POCRAlias>(svfir); else cfl = std::make_unique<CFLAlias>(svfir); // if no svfg is specified, we use CFLAlias as the default one. // Runs the analysis cfl->analyze(); // Releases the SVFIR and the LLVMModuleSet to free memory SVFIR::releaseSVFIR(); SVF::LLVMModuleSet::releaseLLVMModuleSet(); return 0; } ``` -------------------------------- ### Get SVFG Node Count Source: https://svf-tools.github.io/SVF-doxygen/html/SVFG_8h_source.html Returns the total number of nodes in the SVFG. This provides a quick way to get the current size of the graph. ```C++ inline u32_t getSVFGNodeNum() const { return nodeNum; } ``` -------------------------------- ### getSolver() Source: https://svf-tools.github.io/SVF-doxygen/html/classSVF_1_1Z3Expr.html Gets the Z3 solver instance, ensuring a singleton. ```APIDOC ## getSolver() ### Description Provides access to the global Z3 solver. This method ensures that only one Z3 solver instance is created and managed, utilizing the singleton design pattern for consistency. ### Method static ### Returns - z3::solver & - A reference to the singleton Z3 solver. ``` -------------------------------- ### Namespace Members starting with 'o' Source: https://svf-tools.github.io/SVF-doxygen/html/namespacemembers_o.html This section details various operators, types, and utility functions within the SVF namespace, categorized by their starting letter 'o'. ```APIDOC ## Namespace Members starting with 'o' ### Description Provides access to overloaded operators, custom data structures, and utility functions within the SVF namespace. ### Members - **operator%()** : SVF - Description: Overloaded modulo operator. - **operator&()** : SVF - Description: Overloaded bitwise AND operator. - **operator&=()** : SVF - Description: Overloaded bitwise AND assignment operator. - **operator*()** : SVF - Description: Overloaded multiplication operator. - **operator+()** : SVF - Description: Overloaded addition operator. - **operator-()** : SVF - Description: Overloaded subtraction operator. - **operator/()** : SVF - Description: Overloaded division operator. - **operator<()** : SVF - Description: Overloaded less than operator. - **operator<<()** : SVF - Description: Overloaded left shift operator. - **operator<=()** : SVF - Description: Overloaded less than or equal to operator. - **operator>()** : SVF - Description: Overloaded greater than operator. - **operator>=()** : SVF - Description: Overloaded greater than or equal to operator. - **operator>>()** : SVF - Description: Overloaded right shift operator. - **operator^()** : SVF - Description: Overloaded bitwise XOR operator. - **operator|()** : SVF - Description: Overloaded bitwise OR operator. - **operator|=()** : SVF - Description: Overloaded bitwise OR assignment operator. - **OrderedMap** : SVF - Description: Represents an ordered map data structure. - **OrderedNodeSet** : SVF - Description: Represents an ordered set of nodes. - **OrderedSet** : SVF - Description: Represents an ordered set data structure. - **outs()** : SVF::SVFUtil - Description: Utility function for outputting streams. - **OutStream** : SVF - Description: Represents an output stream. ``` -------------------------------- ### ActualParmVFGNode Constructor Source: https://svf-tools.github.io/SVF-doxygen/html/VFGNode_8h_source.html Constructor for ActualParmVFGNode, initializing base class and call site information. ```cpp ActualParmVFGNode(NodeID id, const ValVar* n, const CallICFGNode* c) : ArgumentVFGNode(id, n, AParm), cs(c) { } ```