clang
7.0.0
|
Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt. More...
#include "clang/Analysis/CFG.h"
Classes | |
class | BuildOptions |
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 | 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. More... | |
void | setEntry (CFGBlock *B) |
Set the entry block of the CFG. More... | |
void | setIndirectGotoBlock (CFGBlock *B) |
Set the block used for indirect goto jumps. More... | |
CFGBlock & | front () |
CFGBlock & | back () |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
iterator | nodes_begin () |
iterator | nodes_end () |
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 |
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 |
void | addTryDispatchBlock (const CFGBlock *block) |
void | addSyntheticDeclStmt (const DeclStmt *Synthetic, const DeclStmt *Source) |
Records a synthetic DeclStmt and the DeclStmt it was constructed from. More... | |
synthetic_stmt_iterator | synthetic_stmt_begin () const |
Iterates over synthetic DeclStmts in the CFG. More... | |
synthetic_stmt_iterator | synthetic_stmt_end () const |
synthetic_stmt_range | synthetic_stmts () const |
template<typename CALLBACK > | |
void | VisitBlockStmts (CALLBACK &O) const |
unsigned | getNumBlockIDs () const |
Returns the total number of BlockIDs allocated (which start at 0). More... | |
unsigned | size () const |
Return the total number of CFGBlocks within the CFG This is simply a renaming of the getNumBlockIDs(). More... | |
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. More... | |
void | dump (const LangOptions &LO, bool ShowColors) const |
dump - A simple pretty printer of a CFG that outputs to stderr. More... | |
CFG () | |
llvm::BumpPtrAllocator & | getAllocator () |
BumpVectorContext & | getBumpVectorContext () |
Static Public Member Functions | |
static std::unique_ptr< CFG > | buildCFG (const Decl *D, Stmt *AST, ASTContext *C, const BuildOptions &BO) |
Builds a CFG from an AST. More... | |
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.
using clang::CFG::CFGBlockListTy = BumpVector<CFGBlock *> |
using clang::CFG::const_reverse_iterator = std::reverse_iterator<const_iterator> |
using clang::CFG::reverse_iterator = std::reverse_iterator<iterator> |
using clang::CFG::synthetic_stmt_iterator = llvm::DenseMap<const DeclStmt *, const DeclStmt *>::const_iterator |
using clang::CFG::synthetic_stmt_range = llvm::iterator_range<synthetic_stmt_iterator> |
using clang::CFG::try_block_iterator = std::vector<const CFGBlock *>::const_iterator |
|
inline |
|
inline |
Definition at line 1076 of file CFG.h.
References clang::CFGBlock::back().
|
inline |
Definition at line 1078 of file CFG.h.
Referenced by clang::LiveVariables::computeLiveness(), clang::CFGBlock::FilterEdge(), and clang::LiveVariables::runOnAllBlocks().
|
inline |
|
static |
Builds a CFG from an AST.
buildCFG - Constructs a CFG from an AST.
Definition at line 4634 of file CFG.cpp.
Referenced by clang::AnalysisDeclContext::getCFG(), and clang::AnalysisDeclContext::getUnoptimizedCFG().
CFGBlock * CFG::createBlock | ( | ) |
Create a new block in the CFG.
createBlock - Constructs and adds a new CFGBlock to the CFG.
The CFG owns the block; the caller should not directly free it.
The block has no successors or predecessors. If this is the first block created in the CFG, it is automatically set to be the Entry and Exit of the CFG.
void CFG::dump | ( | const LangOptions & | LO, |
bool | ShowColors | ||
) | const |
dump - A simple pretty printer of a CFG that outputs to stderr.
Definition at line 5384 of file CFG.cpp.
References clang::CFGBlock::print().
|
inline |
Definition at line 1079 of file CFG.h.
Referenced by clang::LiveVariables::computeLiveness(), clang::CFGBlock::FilterEdge(), and clang::LiveVariables::runOnAllBlocks().
|
inline |
|
inline |
Definition at line 1075 of file CFG.h.
References clang::CFGBlock::front().
|
inline |
|
inline |
Definition at line 1093 of file CFG.h.
Referenced by CheckFallThrough(), checkForRecursiveFunctionCall(), clang::ento::CoreEngine::ExecuteWorkList(), clang::reachable_code::FindUnreachableCode(), clang::CallEnter::getEntry(), llvm::GraphTraits< ::clang::CFG *>::getEntryNode(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), print_block(), clang::runUninitializedVariablesAnalysis(), and visitReachableThrows().
|
inline |
Definition at line 1095 of file CFG.h.
Referenced by checkForRecursiveFunctionCall(), checkThrowInNonThrowingFunc(), findBlockLocations(), llvm::GraphTraits< Inverse< ::clang::CFG * > >::getEntryNode(), clang::ento::BugReport::getStmt(), print_block(), and clang::consumed::ConsumedAnalyzer::run().
|
inline |
Definition at line 1098 of file CFG.h.
Referenced by print_block().
|
inline |
|
inline |
Returns the total number of BlockIDs allocated (which start at 0).
Definition at line 1169 of file CFG.h.
Referenced by CheckFallThrough(), clang::LiveVariables::computeLiveness(), clang::ento::CoreEngine::ExecuteWorkList(), clang::reachable_code::FindUnreachableCode(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), mayInlineDecl(), clang::PostOrderCFGView::PostOrderCFGView(), clang::consumed::ConsumedAnalyzer::run(), clang::runUninitializedVariablesAnalysis(), and visitReachableThrows().
|
inline |
Definition at line 1083 of file CFG.h.
Referenced by llvm::GraphTraits< ::clang::CFG *>::nodes_begin(), and llvm::GraphTraits< Inverse< ::clang::CFG * > >::nodes_begin().
|
inline |
|
inline |
Definition at line 1084 of file CFG.h.
Referenced by llvm::GraphTraits< ::clang::CFG *>::nodes_end(), and llvm::GraphTraits< Inverse< ::clang::CFG * > >::nodes_end().
|
inline |
void CFG::print | ( | raw_ostream & | OS, |
const LangOptions & | LO, | ||
bool | ShowColors | ||
) | const |
print - A simple pretty printer of a CFG that outputs to an ostream.
Definition at line 5389 of file CFG.cpp.
References print_block().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return the total number of CFGBlocks within the CFG This is simply a renaming of the getNumBlockIDs().
This is necessary because the dominator implementation needs such an interface.
Definition at line 1174 of file CFG.h.
References dump().
Referenced by llvm::GraphTraits< ::clang::CFG *>::size().
|
inline |
Iterates over synthetic DeclStmts in the CFG.
Each element is a (synthetic statement, source statement) pair.
|
inline |
|
inline |
|
inline |
|
inline |
void CFG::viewCFG | ( | const LangOptions & | LO | ) | const |
|
inline |
Definition at line 1155 of file CFG.h.
Referenced by clang::runUninitializedVariablesAnalysis().