clang 19.0.0git
Public Member Functions | Static Public Member Functions | List of all members
clang::dataflow::ControlFlowContext Class Reference

Holds CFG and other derived context that is needed to perform dataflow analysis. More...

#include "clang/Analysis/FlowSensitive/ControlFlowContext.h"

Public Member Functions

const DeclgetDecl () const
 Returns the Decl containing the statement used to construct the CFG, if available.
 
const CFGgetCFG () const
 Returns the CFG that is stored in this context.
 
const llvm::DenseMap< const Stmt *, const CFGBlock * > & getStmtToBlock () const
 Returns a mapping from statements to basic blocks that contain them.
 
bool isBlockReachable (const CFGBlock &B) const
 Returns whether B is reachable from the entry block.
 

Static Public Member Functions

static llvm::Expected< ControlFlowContextbuild (const FunctionDecl &Func)
 Builds a ControlFlowContext from a FunctionDecl.
 
static llvm::Expected< ControlFlowContextbuild (const Decl &D, Stmt &S, ASTContext &C)
 Builds a ControlFlowContext from an AST node.
 

Detailed Description

Holds CFG and other derived context that is needed to perform dataflow analysis.

Definition at line 32 of file ControlFlowContext.h.

Member Function Documentation

◆ build() [1/2]

llvm::Expected< ControlFlowContext > clang::dataflow::ControlFlowContext::build ( const Decl D,
Stmt S,
ASTContext C 
)
static

Builds a ControlFlowContext from an AST node.

D is the function in which S resides. D.isTemplated() must be false.

Definition at line 108 of file ControlFlowContext.cpp.

References clang::dataflow::buildStmtToBasicBlockMap(), clang::dataflow::findReachableBlocks(), and clang::Decl::isTemplated().

◆ build() [2/2]

llvm::Expected< ControlFlowContext > clang::dataflow::ControlFlowContext::build ( const FunctionDecl Func)
static

Builds a ControlFlowContext from a FunctionDecl.

Func.doesThisDeclarationHaveABody() must be true, and Func.isTemplated() must be false.

Definition at line 98 of file ControlFlowContext.cpp.

References clang::Func.

Referenced by clang::dataflow::diagnoseFunction().

◆ getCFG()

const CFG & clang::dataflow::ControlFlowContext::getCFG ( ) const
inline

Returns the CFG that is stored in this context.

Definition at line 49 of file ControlFlowContext.h.

Referenced by clang::dataflow::runTypeErasedDataflowAnalysis().

◆ getDecl()

const Decl & clang::dataflow::ControlFlowContext::getDecl ( ) const
inline

Returns the Decl containing the statement used to construct the CFG, if available.

Definition at line 46 of file ControlFlowContext.h.

◆ getStmtToBlock()

const llvm::DenseMap< const Stmt *, const CFGBlock * > & clang::dataflow::ControlFlowContext::getStmtToBlock ( ) const
inline

Returns a mapping from statements to basic blocks that contain them.

Definition at line 52 of file ControlFlowContext.h.

Referenced by clang::dataflow::StmtToEnvMap::getEnvironment().

◆ isBlockReachable()

bool clang::dataflow::ControlFlowContext::isBlockReachable ( const CFGBlock B) const
inline

Returns whether B is reachable from the entry block.

Definition at line 57 of file ControlFlowContext.h.

References clang::CFGBlock::getBlockID().

Referenced by clang::dataflow::StmtToEnvMap::getEnvironment().


The documentation for this class was generated from the following files: