clang: clang::CFG Class Reference (original) (raw)

Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt. More...

#include "[clang/Analysis/CFG.h](CFG%5F8h%5Fsource.html)"

Public Types
using CFGBlockListTy = BumpVector< CFGBlock * >
using iterator = CFGBlockListTy::iterator
using const_iterator = CFGBlockListTy::const_iterator
using reverse_iterator = std::reverse_iterator< iterator >
using const_reverse_iterator = std::reverse_iterator< const_iterator >
using try_block_iterator = std::vector< const CFGBlock * >::const_iterator
using try_block_range = llvm::iterator_range< try_block_iterator >
using synthetic_stmt_iterator = llvm::DenseMap< const DeclStmt *, const DeclStmt * >::const_iterator
using synthetic_stmt_range = llvm::iterator_range< synthetic_stmt_iterator >
Public Member Functions
CFGBlock * createBlock ()
Create a new block in the CFG.
void setEntry (CFGBlock *B)
Set the entry block of the CFG.
void setIndirectGotoBlock (CFGBlock *B)
Set the block used for indirect goto jumps.
CFGBlock & front ()
CFGBlock & back ()
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
iterator nodes_begin ()
iterator nodes_end ()
llvm::iterator_range< iterator > nodes ()
llvm::iterator_range< const_iterator > const_nodes () const
const_iterator nodes_begin () const
const_iterator nodes_end () const
reverse_iterator rbegin ()
reverse_iterator rend ()
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
llvm::iterator_range< reverse_iterator > reverse_nodes ()
llvm::iterator_range< const_reverse_iterator > const_reverse_nodes () const
CFGBlock & getEntry ()
const CFGBlock & getEntry () const
CFGBlock & getExit ()
const CFGBlock & getExit () const
CFGBlock * getIndirectGotoBlock ()
const CFGBlock * getIndirectGotoBlock () const
try_block_iterator try_blocks_begin () const
try_block_iterator try_blocks_end () const
try_block_range try_blocks () const
void addTryDispatchBlock (const CFGBlock *block)
void addSyntheticDeclStmt (const DeclStmt *Synthetic, const DeclStmt *Source)
Records a synthetic DeclStmt and the DeclStmt it was constructed from.
synthetic_stmt_iterator synthetic_stmt_begin () const
Iterates over synthetic DeclStmts in the CFG.
synthetic_stmt_iterator synthetic_stmt_end () const
synthetic_stmt_range synthetic_stmts () const
template
void VisitBlockStmts (Callback &O) const
unsigned getNumBlockIDs () const
Returns the total number of BlockIDs allocated (which start at 0).
unsigned size () const
Return the total number of CFGBlocks within the CFG This is simply a renaming of the getNumBlockIDs().
bool isLinear () const
Returns true if the CFG has no branches.
void viewCFG (const LangOptions &LO) const
void print (raw_ostream &OS, const LangOptions &LO, bool ShowColors) const
print - A simple pretty printer of a CFG that outputs to an ostream.
void dump (const LangOptions &LO, bool ShowColors) const
dump - A simple pretty printer of a CFG that outputs to stderr.
CFG ()
llvm::BumpPtrAllocator & getAllocator ()
BumpVectorContext & getBumpVectorContext ()

Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt.

The Stmt can represent an entire function body, or a single expression. A CFG will always contain one empty block that represents the Exit point of the CFG. A CFG will also contain a designated Entry block. The CFG solely represents control-flow; it consists of CFGBlocks which are simply containers of Stmt*'s in the AST the CFG was constructed from.

Definition at line 1214 of file CFG.h.

CFGBlockListTy

const_iterator

const_reverse_iterator

iterator

reverse_iterator

synthetic_stmt_iterator

synthetic_stmt_range

try_block_iterator

try_block_range

clang::CFG::CFG ( ) inline

Definition at line 1427 of file CFG.h.

addSyntheticDeclStmt()

void clang::CFG::addSyntheticDeclStmt ( const DeclStmt * Synthetic, const DeclStmt * Source ) inline

addTryDispatchBlock()

void clang::CFG::addTryDispatchBlock ( const CFGBlock * block) inline

Definition at line 1345 of file CFG.h.

back()

begin() [1/2]

begin() [2/2]

buildCFG()

const_nodes()

llvm::iterator_range< const_iterator > clang::CFG::const_nodes ( ) const inline

const_reverse_nodes()

createBlock()

dump()

end() [1/2]

end() [2/2]

front()

getAllocator()

llvm::BumpPtrAllocator & clang::CFG::getAllocator ( ) inline

getBumpVectorContext()

getEntry() [1/2]

CFGBlock & clang::CFG::getEntry ( ) inline

Definition at line 1322 of file CFG.h.

Referenced by annotateStartParameter(), CheckFallThrough(), checkForRecursiveFunctionCall(), clang::ento::PathDiagnosticLocation::create(), clang::ento::CoreEngine::ExecuteWorkList(), clang::dataflow::findReachableBlocks(), clang::reachable_code::FindUnreachableCode(), clang::CallEnter::getEntry(), llvm::GraphTraits< ::clang::CFG * >::getEntryNode(), clang::internal::partitionIntoIntervals(), print_block(), clang::dataflow::runTypeErasedDataflowAnalysis(), clang::runUninitializedVariablesAnalysis(), visitReachableThrows(), and clang::threadSafety::CFGWalker::walk().

getEntry() [2/2]

const CFGBlock & clang::CFG::getEntry ( ) const inline

Definition at line 1323 of file CFG.h.

getExit() [1/2]

CFGBlock & clang::CFG::getExit ( ) inline

Definition at line 1324 of file CFG.h.

Referenced by CheckFallThrough(), checkForRecursiveFunctionCall(), checkRecursiveFunction(), checkThrowInNonThrowingFunc(), findBlockLocations(), clang::FunctionExitPoint::getBlock(), llvm::GraphTraits< Inverse< ::clang::CFG * > >::getEntryNode(), clang::ento::PathSensitiveBugReport::getStmt(), clang::CFGBlock::isInevitablySinking(), print_block(), clang::ento::ExprEngine::processCallExit(), throwEscapes(), and clang::threadSafety::CFGWalker::walk().

getExit() [2/2]

const CFGBlock & clang::CFG::getExit ( ) const inline

Definition at line 1325 of file CFG.h.

getIndirectGotoBlock() [1/2]

CFGBlock * clang::CFG::getIndirectGotoBlock ( ) inline

getIndirectGotoBlock() [2/2]

const CFGBlock * clang::CFG::getIndirectGotoBlock ( ) const inline

Definition at line 1328 of file CFG.h.

getNumBlockIDs()

unsigned clang::CFG::getNumBlockIDs ( ) const inline

Returns the total number of BlockIDs allocated (which start at 0).

Definition at line 1402 of file CFG.h.

Referenced by clang::internal::buildInterval(), CheckFallThrough(), clang::LiveVariables::computeLiveness(), clang::ento::CoreEngine::ExecuteWorkList(), clang::dataflow::findReachableBlocks(), clang::reachable_code::FindUnreachableCode(), clang::internal::partitionIntoIntervals(), clang::PostOrderCFGView::PostOrderCFGView(), clang::consumed::ConsumedAnalyzer::run(), clang::runUninitializedVariablesAnalysis(), throwEscapes(), and visitReachableThrows().

isLinear()

bool CFG::isLinear ( ) const

nodes()

llvm::iterator_range< iterator > clang::CFG::nodes ( ) inline

nodes_begin() [1/2]

iterator clang::CFG::nodes_begin ( ) inline

nodes_begin() [2/2]

nodes_end() [1/2]

iterator clang::CFG::nodes_end ( ) inline

nodes_end() [2/2]

print()

void CFG::print ( raw_ostream & OS,
const LangOptions & LO,
bool ShowColors
) const

rbegin() [1/2]

rbegin() [2/2]

rend() [1/2]

rend() [2/2]

reverse_nodes()

setEntry()

void clang::CFG::setEntry ( CFGBlock * B) inline

Set the entry block of the CFG.

This is typically used only during CFG construction. Most CFG clients expect that the entry block has no predecessors and contains no statements.

Definition at line 1275 of file CFG.h.

setIndirectGotoBlock()

void clang::CFG::setIndirectGotoBlock ( CFGBlock * B) inline

Set the block used for indirect goto jumps.

This is typically used only during CFG construction.

Definition at line 1279 of file CFG.h.

size()

unsigned clang::CFG::size ( ) const inline

synthetic_stmt_begin()

synthetic_stmt_end()

synthetic_stmts()

try_blocks()

try_blocks_begin()

try_blocks_end()

viewCFG()

VisitBlockStmts()

template

void clang::CFG::VisitBlockStmts ( Callback & O) const inline

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