Represents a single basic block in a source-level CFG. More...
#include "clang/Analysis/CFG.h"
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:
Terminator Successor Ordering if Then Block; Else Block ? operator LHS expression; RHS expression logical and/or expression that consumes the op, RHS vbase inits already handled by the most derived class; not yetBut note that any of that may be NULL in case of optimized-out edges.
Definition at line 604 of file CFG.h.
◆ CFGElementRef ◆ const_iterator ◆ const_pred_iterator ◆ const_pred_reverse_iterator ◆ const_ref_iterator ◆ const_ref_iterator_range ◆ const_reverse_iterator ◆ const_reverse_ref_iterator ◆ const_reverse_ref_iterator_range ◆ const_succ_iterator ◆ const_succ_reverse_iterator ◆ ConstCFGElementRef ◆ filtered_pred_iterator ◆ filtered_succ_iterator ◆ iterator ◆ pred_const_range ◆ pred_iterator ◆ pred_range ◆ pred_reverse_iterator ◆ ref_iterator ◆ ref_iterator_range ◆ reverse_iterator ◆ reverse_ref_iterator ◆ reverse_ref_iterator_range ◆ succ_const_range ◆ succ_iterator ◆ succ_range ◆ succ_reverse_iterator ◆ CFGBlock() ◆ addSuccessor() ◆ appendAutomaticObjDtor() ◆ appendBaseDtor() ◆ appendCleanupFunction() ◆ appendConstructor() ◆ appendCXXRecordTypedCall() ◆ appendDeleteDtor() ◆ appendInitializer() ◆ appendLifetimeEnds() ◆ appendLoopExit() ◆ appendMemberDtor() ◆ appendNewAllocator() ◆ appendScopeBegin() ◆ appendScopeEnd() ◆ appendStmt() ◆ appendTemporaryDtor() ◆ back() ◆ begin() [1/2] ◆ begin() [2/2] ◆ dump() [1/2] LLVM_DUMP_METHOD void CFGBlock::dump ( ) const ◆ dump() [2/2] ◆ empty() bool clang::CFGBlock::empty ( ) const inline ◆ end() [1/2] ◆ end() [2/2] ◆ filtered_pred_start_end() ◆ filtered_succ_start_end() ◆ FilterEdge() ◆ front() ◆ getBlockID() unsigned clang::CFGBlock::getBlockID ( ) const inlineDefinition at line 1105 of file CFG.h.
References BlockID.
Referenced by clang::consumed::ConsumedBlockInfo::allBackEdgesVisited(), CheckFallThrough(), checkForRecursiveFunctionCall(), clang::LiveVariables::computeLiveness(), clang::DataflowWorklistBase< Comp, QueueSize >::dequeue(), clang::ento::CoreEngine::ExecuteWorkList(), clang::reachable_code::FindUnreachableCode(), clang::ento::CheckerContext::getBlockID(), clang::internal::getID(), clang::consumed::ConsumedBlockInfo::isBackEdge(), clang::dataflow::AdornedCFG::isBlockReachable(), clang::CFGReverseBlockReachabilityAnalysis::isReachable(), clang::threadSafety::SExprBuilder::lookupBlock(), clang::WTOCompare::operator()(), print_block(), printAsOperand(), runOnBlock(), clang::dataflow::runTypeErasedDataflowAnalysis(), clang::runUninitializedVariablesAnalysis(), scanFromBlock(), and throwEscapes().
◆ getIndexInCFG() size_t CFGBlock::getIndexInCFG ( ) const ◆ getLabel() [1/2] Stmt * clang::CFGBlock::getLabel ( ) inline ◆ getLabel() [2/2] const Stmt * clang::CFGBlock::getLabel ( ) const inline ◆ getLastCondition() const Expr * CFGBlock::getLastCondition ( ) constrbegin()
) condition, e.g. observe the following code snippet: if (A && B && C) A block would be created for A
, B
, and C
. For the latter, getTerminatorStmt()
would retrieve the entire condition, rather than C itself, while this method would only return C.
Definition at line 6242 of file CFG.cpp.
References clang::CFGElement::getAs(), clang::CFGTerminator::getKind(), clang::Expr::IgnoreParens(), rbegin(), size(), clang::CFGTerminator::StmtBranch, succ_size(), and Terminator.
◆ getLoopTarget() const Stmt * clang::CFGBlock::getLoopTarget ( ) const inline ◆ getParent() CFG * clang::CFGBlock::getParent ( ) const inline ◆ getTerminator() ◆ getTerminatorCondition() [1/2] Stmt * CFGBlock::getTerminatorCondition ( bool StripParens =true
) ◆ getTerminatorCondition() [2/2] const Stmt * clang::CFGBlock::getTerminatorCondition ( bool StripParens = true
) const inline ◆ getTerminatorStmt() [1/2] Stmt * clang::CFGBlock::getTerminatorStmt ( ) inline
Definition at line 1081 of file CFG.h.
References clang::CFGTerminator::getStmt(), and Terminator.
Referenced by Accumulate(), CheckFallThrough(), DiagnoseSwitchLabelsFallthrough(), FilterEdge(), getLastStmtLoc(), clang::BlockExit::getTerminator(), getTerminatorCondition(), isTrivialDoWhile(), peelOffOuterExpr(), clang::ento::ExprEngine::processCFGBlockEntrance(), shouldTreatSuccessorsAsReachable(), clang::ento::SuppressInlineDefensiveChecksVisitor::VisitNode(), and clang::ento::ConditionBRVisitor::VisitNodeImpl().
◆ getTerminatorStmt() [2/2] const Stmt * clang::CFGBlock::getTerminatorStmt ( ) const inline ◆ hasNoReturnElement() bool clang::CFGBlock::hasNoReturnElement ( ) const inline ◆ isInevitablySinking() bool CFGBlock::isInevitablySinking ( ) const ◆ operator[]() ◆ pred_begin() [1/2] ◆ pred_begin() [2/2] ◆ pred_empty() bool clang::CFGBlock::pred_empty ( ) const inline ◆ pred_end() [1/2] ◆ pred_end() [2/2] ◆ pred_rbegin() [1/2] ◆ pred_rbegin() [2/2] ◆ pred_rend() [1/2] ◆ pred_rend() [2/2] ◆ pred_size() unsigned clang::CFGBlock::pred_size ( ) const inline ◆ preds() [1/2] ◆ preds() [2/2] ◆ print() void CFGBlock::print ( raw_ostream & OS, const CFG * cfg, const LangOptions & LO, bool ShowColors ) const ◆ printAsOperand() void clang::CFGBlock::printAsOperand ( raw_ostream & OS, bool ) inline ◆ printTerminator() void CFGBlock::printTerminator ( raw_ostream & OS, const LangOptions & LO ) const ◆ printTerminatorJson() void CFGBlock::printTerminatorJson ( raw_ostream & Out, const LangOptions & LO, bool AddQuotes ) const ◆ rbegin() [1/2] ◆ rbegin() [2/2] ◆ ref_begin() [1/2] ◆ ref_begin() [2/2] ◆ ref_end() [1/2] ◆ ref_end() [2/2] ◆ refs() [1/2] ◆ refs() [2/2] ◆ rend() [1/2] ◆ rend() [2/2] ◆ rref_begin() [1/2] ◆ rref_begin() [2/2] ◆ rref_end() [1/2] ◆ rref_end() [2/2] ◆ rrefs() [1/2] ◆ rrefs() [2/2] ◆ setHasNoReturnElement() void clang::CFGBlock::setHasNoReturnElement ( ) inlineDefinition at line 1073 of file CFG.h.
◆ setLabel() void clang::CFGBlock::setLabel ( Stmt * Statement ) inline ◆ setLoopTarget() void clang::CFGBlock::setLoopTarget ( const Stmt * loopTarget ) inline ◆ setTerminator() ◆ size() unsigned clang::CFGBlock::size ( ) const inline ◆ succ_begin() [1/2]Definition at line 984 of file CFG.h.
Referenced by clang::ento::IndirectGotoNodeBuilder::begin(), clang::dataflow::blockIndexInPredecessor(), checkForRecursiveFunctionCall(), llvm::GraphTraits< ::clang::CFGBlock * >::child_begin(), llvm::GraphTraits< const ::clang::CFGBlock * >::child_begin(), clang::LiveVariables::computeLiveness(), DiagnoseSwitchLabelsFallthrough(), clang::ento::CoreEngine::ExecuteWorkList(), filtered_succ_start_end(), getFirstStmtLoc(), getLastStmtLoc(), isAssertlikeBlock(), isJumpToFalseBranch(), peelOffOuterExpr(), print_block(), clang::ento::ExprEngine::processCallEnter(), scanFromBlock(), succs(), clang::ento::ExprEngine::VisitLogicalExpr(), and clang::ento::ConditionBRVisitor::VisitTerminator().
◆ succ_begin() [2/2] ◆ succ_empty() bool clang::CFGBlock::succ_empty ( ) const inline ◆ succ_end() [1/2] ◆ succ_end() [2/2] ◆ succ_rbegin() [1/2] ◆ succ_rbegin() [2/2] ◆ succ_rend() [1/2] ◆ succ_rend() [2/2] ◆ succ_size() unsigned clang::CFGBlock::succ_size ( ) const inlineDefinition at line 1002 of file CFG.h.
Referenced by DiagnoseSwitchLabelsFallthrough(), clang::ento::CoreEngine::ExecuteWorkList(), getFirstStmtLoc(), getLastCondition(), getLastStmtLoc(), isAssertlikeBlock(), isJumpToFalseBranch(), print_block(), clang::ento::ExprEngine::processCallEnter(), clang::ento::ExprEngine::VisitLogicalExpr(), and clang::ento::ConditionBRVisitor::VisitTerminator().
◆ succs() [1/2] ◆ succs() [2/2] ◆ BlockID ◆ Elements ElementList clang::CFGBlock::ElementsThe set of statements in the basic block.
Definition at line 794 of file CFG.h.
Referenced by appendAutomaticObjDtor(), appendBaseDtor(), appendCleanupFunction(), appendConstructor(), appendCXXRecordTypedCall(), appendDeleteDtor(), appendInitializer(), appendLifetimeEnds(), appendLoopExit(), appendMemberDtor(), appendNewAllocator(), appendScopeBegin(), appendScopeEnd(), appendStmt(), appendTemporaryDtor(), back(), begin(), empty(), end(), front(), operator[](), rbegin(), rend(), and size().
◆ Label Stmt* clang::CFGBlock::Label = nullptr ◆ LoopTarget const Stmt* clang::CFGBlock::LoopTarget = nullptrSome blocks are used to represent the "loop edge" to the start of a loop from within the loop body.
This Stmt* will be refer to the loop statement for such blocks (and be null otherwise).
Definition at line 808 of file CFG.h.
Referenced by getLoopTarget(), and setLoopTarget().
◆ TerminatorThe documentation for this class was generated from the following files:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4