clang
6.0.0
|
CFGBlock - Represents a single basic block in a source-level CFG. More...
#include "clang/Analysis/CFG.h"
Classes | |
class | AdjacentBlock |
This class represents a potential adjacent block in the CFG. More... | |
class | FilteredCFGBlockIterator |
class | FilterOptions |
Static Public Member Functions | |
static bool | FilterEdge (const FilterOptions &F, const CFGBlock *Src, const CFGBlock *Dst) |
CFGBlock - Represents a single basic block in a source-level CFG.
It consists of:
(1) A set of statements/expressions (which may contain subexpressions). (2) A "terminator" statement (not in the set of statements). (3) A list of successors and predecessors.
Terminator: The terminator represents the type of control-flow that occurs at the end of the basic block. The terminator is a Stmt* referring to an AST node that has control-flow: if-statements, breaks, loops, etc. If the control-flow is conditional, the condition expression will appear within the set of statements in the block (usually the last statement).
Predecessors: the order in the set of predecessors is arbitrary.
Successors: the order in the set of successors is NOT arbitrary. We currently have the following orderings based on the terminator:
if Then Block; Else Block ? operator LHS expression; RHS expression &&, || expression that uses result of && or ||, RHS
But note that any of that may be NULL in case of optimized-out edges.
using clang::CFGBlock::const_iterator = ElementList::const_iterator |
using clang::CFGBlock::iterator = ElementList::iterator |
using clang::CFGBlock::pred_const_range = llvm::iterator_range<const_pred_iterator> |
using clang::CFGBlock::pred_range = llvm::iterator_range<pred_iterator> |
using clang::CFGBlock::succ_const_range = llvm::iterator_range<const_succ_iterator> |
using clang::CFGBlock::succ_range = llvm::iterator_range<succ_iterator> |
|
inlineexplicit |
void CFGBlock::addSuccessor | ( | AdjacentBlock | Succ, |
BumpVectorContext & | C | ||
) |
Adds a (potentially unreachable) successor block to the current block.
Definition at line 4284 of file CFG.cpp.
References clang::CFGBlock::AdjacentBlock::getPossiblyUnreachableBlock(), clang::CFGBlock::AdjacentBlock::getReachableBlock(), and clang::CFGBlock::AdjacentBlock::isReachable().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 574 of file CFG.h.
Referenced by clang::CFG::back(), and neverReturns().
|
inline |
Definition at line 576 of file CFG.h.
Referenced by clang::LiveVariables::computeLiveness(), isImmediateSinkBlock(), and print_block().
|
inline |
|
inline |
|
inline |
LLVM_DUMP_METHOD void CFGBlock::dump | ( | ) | const |
Definition at line 4878 of file CFG.cpp.
References getParent().
void CFGBlock::dump | ( | const CFG * | cfg, |
const LangOptions & | LO, | ||
bool | ShowColors = false |
||
) | const |
|
inline |
Definition at line 587 of file CFG.h.
Referenced by clang::ento::CoreEngine::ExecuteWorkList(), clang::BlockEntrance::getFirstElement(), neverReturns(), clang::ento::ExprEngine::processCallEnter(), and clang::ento::ExprEngine::VisitLogicalExpr().
|
inline |
Definition at line 577 of file CFG.h.
Referenced by clang::LiveVariables::computeLiveness(), isImmediateSinkBlock(), and print_block().
|
inline |
|
inline |
|
inline |
|
static |
Definition at line 4295 of file CFG.cpp.
References clang::CFG::begin(), clang::CFG::end(), getLabel(), clang::CFGTerminator::getStmt(), getTerminator(), clang::CFGBlock::FilterOptions::IgnoreDefaultsWithCoveredEnums, and clang::CFGBlock::FilterOptions::IgnoreNullPredecessors.
|
inline |
Definition at line 573 of file CFG.h.
Referenced by clang::CFG::front(), and clang::BlockEntrance::getFirstElement().
|
inline |
Definition at line 729 of file CFG.h.
Referenced by clang::consumed::ConsumedBlockInfo::addInfo(), clang::consumed::ConsumedBlockInfo::allBackEdgesVisited(), clang::PostOrderCFGView::CFGBlockSet::alreadySet(), clang::ento::NodeBuilderContext::blockCount(), clang::consumed::ConsumedBlockInfo::borrowInfo(), checkForRecursiveFunctionCall(), clang::LiveVariables::computeLiveness(), clang::consumed::ConsumedBlockInfo::discardInfo(), clang::LiveVariables::dumpBlockLiveness(), clang::ento::CoreEngine::ExecuteWorkList(), clang::ento::CheckerContext::getBlockID(), clang::consumed::ConsumedBlockInfo::getInfo(), hasThrowOutNonThrowingFunc(), clang::PostOrderCFGView::CFGBlockSet::insert(), isAlwaysUninit(), clang::consumed::ConsumedBlockInfo::isBackEdge(), clang::consumed::ConsumedBlockInfo::isBackEdgeTarget(), clang::CFGReverseBlockReachabilityAnalysis::isReachable(), clang::threadSafety::SExprBuilder::lookupBlock(), print_block(), runOnBlock(), clang::runUninitializedVariablesAnalysis(), scanFromBlock(), and SrcCmp().
|
inline |
Definition at line 724 of file CFG.h.
References Label.
Referenced by FilterEdge(), GenerateMinimalPathDiagnostic(), and print_block().
|
inline |
|
inline |
|
inline |
Definition at line 713 of file CFG.h.
Referenced by FilterEdge(), GenerateExtensivePathDiagnostic(), GenerateMinimalPathDiagnostic(), getLastStmtLoc(), clang::ento::SwitchNodeBuilder::getSwitch(), clang::consumed::ConsumedStateMap::operator!=(), peelOffOuterExpr(), printTerminator(), clang::ento::ExprEngine::processCFGBlockEntrance(), ResolveCondition(), shouldTreatSuccessorsAsReachable(), clang::ento::ExprEngine::VisitLogicalExpr(), clang::ento::SuppressInlineDefensiveChecksVisitor::VisitNode(), and clang::ento::ConditionBRVisitor::VisitNodeImpl().
|
inline |
Definition at line 714 of file CFG.h.
References getTerminatorCondition().
Definition at line 4898 of file CFG.cpp.
References clang::Stmt::getStmtClass().
Referenced by GenerateExtensivePathDiagnostic(), getTerminatorCondition(), and shouldTreatSuccessorsAsReachable().
Definition at line 718 of file CFG.h.
References getTerminatorCondition().
|
inline |
Definition at line 727 of file CFG.h.
Referenced by isImmediateSinkBlock(), neverReturns(), and print_block().
|
inline |
|
inline |
Definition at line 606 of file CFG.h.
References clang::BumpVector< T >::begin().
Referenced by clang::consumed::ConsumedBlockInfo::allBackEdgesVisited(), llvm::GraphTraits< Inverse< ::clang::CFGBlock * > >::child_begin(), llvm::GraphTraits< Inverse< const ::clang::CFGBlock * > >::child_begin(), getLastStmtLoc(), clang::consumed::ConsumedBlockInfo::isBackEdgeTarget(), and clang::CFGReverseBlockReachabilityAnalysis::isReachable().
|
inline |
Definition at line 608 of file CFG.h.
References clang::BumpVector< T >::begin().
|
inline |
Definition at line 646 of file CFG.h.
References clang::BumpVector< T >::empty().
Referenced by checkRecursiveFunction(), and checkThrowInNonThrowingFunc().
|
inline |
Definition at line 607 of file CFG.h.
References clang::BumpVector< T >::end().
Referenced by clang::consumed::ConsumedBlockInfo::allBackEdgesVisited(), llvm::GraphTraits< Inverse< ::clang::CFGBlock * > >::child_end(), llvm::GraphTraits< Inverse< const ::clang::CFGBlock * > >::child_end(), clang::consumed::ConsumedBlockInfo::isBackEdgeTarget(), and clang::CFGReverseBlockReachabilityAnalysis::isReachable().
|
inline |
Definition at line 609 of file CFG.h.
References clang::BumpVector< T >::end().
|
inline |
Definition at line 611 of file CFG.h.
References clang::BumpVector< T >::rbegin().
|
inline |
Definition at line 613 of file CFG.h.
References clang::BumpVector< T >::rbegin().
|
inline |
Definition at line 612 of file CFG.h.
References clang::BumpVector< T >::rend().
|
inline |
Definition at line 614 of file CFG.h.
References clang::BumpVector< T >::rend().
|
inline |
Definition at line 645 of file CFG.h.
References clang::BumpVector< T >::size().
Referenced by getLastStmtLoc(), and clang::consumed::ConsumedBlockInfo::isBackEdgeTarget().
|
inline |
|
inline |
void CFGBlock::print | ( | raw_ostream & | OS, |
const CFG * | cfg, | ||
const LangOptions & | LO, | ||
bool | ShowColors | ||
) | const |
print - A simple pretty printer of a CFGBlock that outputs to an ostream.
Generally this will only be called from CFG::print.
Definition at line 4884 of file CFG.cpp.
References print_block().
Referenced by dump(), and clang::CFG::dump().
|
inline |
void CFGBlock::printTerminator | ( | raw_ostream & | OS, |
const LangOptions & | LO | ||
) | const |
printTerminator - A simple pretty printer of the terminator of a CFGBlock.
Definition at line 4892 of file CFG.cpp.
References getTerminator().
|
inline |
Definition at line 581 of file CFG.h.
Referenced by getLastStmtLoc(), and clang::ento::ExprEngine::VisitLogicalExpr().
|
inline |
|
inline |
Definition at line 582 of file CFG.h.
Referenced by getLastStmtLoc().
|
inline |
|
inline |
Definition at line 709 of file CFG.h.
References clang::CFGElement::Statement.
Referenced by shouldAddCase().
|
inline |
|
inline |
|
inline |
Definition at line 586 of file CFG.h.
Referenced by canHaveDirectConstructor().
|
inline |
Definition at line 624 of file CFG.h.
References clang::BumpVector< T >::begin().
Referenced by clang::ento::IndirectGotoNodeBuilder::begin(), llvm::GraphTraits< ::clang::CFGBlock * >::child_begin(), llvm::GraphTraits< const ::clang::CFGBlock * >::child_begin(), ClassifyDiagnostic(), clang::LiveVariables::computeLiveness(), clang::ento::CoreEngine::ExecuteWorkList(), getLastStmtLoc(), isJumpToFalseBranch(), clang::consumed::ConsumedStateMap::operator!=(), peelOffOuterExpr(), clang::ento::ExprEngine::processCallEnter(), clang::ento::ExprEngine::VisitLogicalExpr(), and clang::ento::ConditionBRVisitor::VisitTerminator().
|
inline |
Definition at line 626 of file CFG.h.
References clang::BumpVector< T >::begin().
|
inline |
Definition at line 643 of file CFG.h.
References clang::BumpVector< T >::empty().
|
inline |
Definition at line 625 of file CFG.h.
References clang::BumpVector< T >::end().
Referenced by llvm::GraphTraits< ::clang::CFGBlock * >::child_end(), llvm::GraphTraits< const ::clang::CFGBlock * >::child_end(), ClassifyDiagnostic(), clang::LiveVariables::computeLiveness(), and clang::ento::IndirectGotoNodeBuilder::end().
|
inline |
Definition at line 627 of file CFG.h.
References clang::BumpVector< T >::end().
|
inline |
Definition at line 629 of file CFG.h.
References clang::BumpVector< T >::rbegin().
Referenced by clang::ento::SwitchNodeBuilder::begin(), and clang::ento::SwitchNodeBuilder::generateDefaultCaseNode().
|
inline |
Definition at line 631 of file CFG.h.
References clang::BumpVector< T >::rbegin().
|
inline |
Definition at line 630 of file CFG.h.
References clang::BumpVector< T >::rend().
Referenced by clang::ento::SwitchNodeBuilder::end().
|
inline |
Definition at line 632 of file CFG.h.
References clang::BumpVector< T >::rend().
|
inline |
Definition at line 642 of file CFG.h.
References clang::BumpVector< T >::size().
Referenced by clang::ento::CoreEngine::ExecuteWorkList(), getLastStmtLoc(), isJumpToFalseBranch(), clang::ento::ExprEngine::processCallEnter(), clang::ento::ExprEngine::VisitLogicalExpr(), and clang::ento::ConditionBRVisitor::VisitTerminator().
|
inline |
Definition at line 634 of file CFG.h.
Referenced by isInevitablySinking().
|
inline |