clang 10.0.0git

Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
clang::CFGBlock Class Reference

Represents a single basic block in a source-level CFG. More...

`#include "clang/Analysis/CFG.h"`

Collaboration diagram for clang::CFGBlock:
[legend]

## Classes
class | AdjacentBlock
| This class represents a potential adjacent block in the CFG. More...
class | FilteredCFGBlockIterator
class | FilterOptions

## Public Types
using | iterator = ElementList::iterator
using | const_iterator = ElementList::const_iterator
using | reverse_iterator = ElementList::reverse_iterator
using | const_reverse_iterator = ElementList::const_reverse_iterator
using | CFGElementRef = ElementRefImpl< false >
using | ConstCFGElementRef = ElementRefImpl< true >
using | ref_iterator = ElementRefIterator< false, false >
using | ref_iterator_range = llvm::iterator_range< ref_iterator >
using | const_ref_iterator = ElementRefIterator< false, true >
using | const_ref_iterator_range = llvm::iterator_range< const_ref_iterator >
using | reverse_ref_iterator = ElementRefIterator< true, false >
using | reverse_ref_iterator_range = llvm::iterator_range< reverse_ref_iterator >
using | const_reverse_ref_iterator = ElementRefIterator< true, true >
using | const_reverse_ref_iterator_range = llvm::iterator_range< const_reverse_ref_iterator >
using | pred_iterator = AdjacentBlocks::iterator
using | const_pred_iterator = AdjacentBlocks::const_iterator
using | pred_reverse_iterator = AdjacentBlocks::reverse_iterator
using | const_pred_reverse_iterator = AdjacentBlocks::const_reverse_iterator
using | pred_range = llvm::iterator_range< pred_iterator >
using | pred_const_range = llvm::iterator_range< const_pred_iterator >
using | succ_iterator = AdjacentBlocks::iterator
using | const_succ_iterator = AdjacentBlocks::const_iterator
using | succ_reverse_iterator = AdjacentBlocks::reverse_iterator
using | const_succ_reverse_iterator = AdjacentBlocks::const_reverse_iterator
using | succ_range = llvm::iterator_range< succ_iterator >
using | succ_const_range = llvm::iterator_range< const_succ_iterator >
using | filtered_pred_iterator = FilteredCFGBlockIterator< const_pred_iterator, true >
using | filtered_succ_iterator = FilteredCFGBlockIterator< const_succ_iterator, false >

## Public Member Functions
| CFGBlock (unsigned blockid, BumpVectorContext &C, CFG *parent)
size_t | getIndexInCFG () const
CFGElement | front () const
CFGElement | back () const
iterator | begin ()
iterator | end ()
const_iterator | begin () const
const_iterator | end () const
reverse_iterator | rbegin ()
reverse_iterator | rend ()
const_reverse_iterator | rbegin () const
const_reverse_iterator | rend () const
ref_iterator | ref_begin ()
ref_iterator | ref_end ()
const_ref_iterator | ref_begin () const
const_ref_iterator | ref_end () const
reverse_ref_iterator | rref_begin ()
reverse_ref_iterator | rref_end ()
const_reverse_ref_iterator | rref_begin () const
const_reverse_ref_iterator | rref_end () const
ref_iterator_range | refs ()
const_ref_iterator_range | refs () const
reverse_ref_iterator_range | rrefs ()
const_reverse_ref_iterator_range | rrefs () const
unsigned | size () const
bool | empty () const
CFGElement | operator[] (size_t i) const
pred_iterator | pred_begin ()
pred_iterator | pred_end ()
const_pred_iterator | pred_begin () const
const_pred_iterator | pred_end () const
pred_reverse_iterator | pred_rbegin ()
pred_reverse_iterator | pred_rend ()
const_pred_reverse_iterator | pred_rbegin () const
const_pred_reverse_iterator | pred_rend () const
pred_range | preds ()
pred_const_range | preds () const
succ_iterator | succ_begin ()
succ_iterator | succ_end ()
const_succ_iterator | succ_begin () const
const_succ_iterator | succ_end () const
succ_reverse_iterator | succ_rbegin ()
succ_reverse_iterator | succ_rend ()
const_succ_reverse_iterator | succ_rbegin () const
const_succ_reverse_iterator | succ_rend () const
succ_range | succs ()
succ_const_range | succs () const
unsigned | succ_size () const
bool | succ_empty () const
unsigned | pred_size () const
bool | pred_empty () const
filtered_pred_iterator | filtered_pred_start_end (const FilterOptions &f) const
filtered_succ_iterator | filtered_succ_start_end (const FilterOptions &f) const
void | setTerminator (CFGTerminator Term)
void | setLabel (Stmt *Statement)
void | setLoopTarget (const Stmt *loopTarget)
void | setHasNoReturnElement ()
bool | isInevitablySinking () const
| Returns true if the block would eventually end with a sink (a noreturn node). More...
CFGTerminator | getTerminator () const
Stmt * | getTerminatorStmt ()
const Stmt * | getTerminatorStmt () const
const Expr * | getLastCondition () const
Stmt * | getTerminatorCondition (bool StripParens=true)
const Stmt * | getTerminatorCondition (bool StripParens=true) const
const Stmt * | getLoopTarget () const
Stmt * | getLabel ()
const Stmt * | getLabel () const
bool | hasNoReturnElement () const
unsigned | getBlockID () const
CFG * | getParent () const
void | dump () const
void | dump (const CFG *cfg, const LangOptions &LO, bool ShowColors=false) const
| dump - A simply pretty printer of a CFGBlock that outputs to stderr. More...
void | 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. More...
void | printTerminator (raw_ostream &OS, const LangOptions &LO) const
| printTerminator - A simple pretty printer of the terminator of a CFGBlock. More...
void | printTerminatorJson (raw_ostream &Out, const LangOptions &LO, bool AddQuotes) const
| printTerminatorJson - Pretty-prints the terminator in JSON format. More...
void | printAsOperand (raw_ostream &OS, bool)
void | addSuccessor (AdjacentBlock Succ, BumpVectorContext &C)
| Adds a (potentially unreachable) successor block to the current block. More...
void | appendStmt (Stmt *statement, BumpVectorContext &C)
void | appendConstructor (CXXConstructExpr *CE, const ConstructionContext *CC, BumpVectorContext &C)
void | appendCXXRecordTypedCall (Expr *E, const ConstructionContext *CC, BumpVectorContext &C)
void | appendInitializer (CXXCtorInitializer *initializer, BumpVectorContext &C)
void | appendNewAllocator (CXXNewExpr *NE, BumpVectorContext &C)
void | appendScopeBegin (const VarDecl *VD, const Stmt *S, BumpVectorContext &C)
void | prependScopeBegin (const VarDecl *VD, const Stmt *S, BumpVectorContext &C)
void | appendScopeEnd (const VarDecl *VD, const Stmt *S, BumpVectorContext &C)
void | prependScopeEnd (const VarDecl *VD, const Stmt *S, BumpVectorContext &C)
void | appendBaseDtor (const CXXBaseSpecifier *BS, BumpVectorContext &C)
void | appendMemberDtor (FieldDecl *FD, BumpVectorContext &C)
void | appendTemporaryDtor (CXXBindTemporaryExpr *E, BumpVectorContext &C)
void | appendAutomaticObjDtor (VarDecl *VD, Stmt *S, BumpVectorContext &C)
void | appendLifetimeEnds (VarDecl *VD, Stmt *S, BumpVectorContext &C)
void | appendLoopExit (const Stmt *LoopStmt, BumpVectorContext &C)
void | appendDeleteDtor (CXXRecordDecl *RD, CXXDeleteExpr *DE, BumpVectorContext &C)
iterator | beginAutomaticObjDtorsInsert (iterator I, size_t Cnt, BumpVectorContext &C)
iterator | insertAutomaticObjDtor (iterator I, VarDecl *VD, Stmt *S)
iterator | beginLifetimeEndsInsert (iterator I, size_t Cnt, BumpVectorContext &C)
iterator | insertLifetimeEnds (iterator I, VarDecl *VD, Stmt *S)
iterator | beginScopeEndInsert (iterator I, size_t Cnt, BumpVectorContext &C)
iterator | insertScopeEnd (iterator I, VarDecl *VD, Stmt *S)

## Static Public Member Functions
static bool | FilterEdge (const FilterOptions &F, const CFGBlock *Src, const CFGBlock *Dst)

## Public Attributes
ElementList | Elements
| The set of statements in the basic block. More...
Stmt * | Label = nullptr
| An (optional) label that prefixes the executable statements in the block. More...
CFGTerminator | Terminator
| The terminator for a basic block that indicates the type of control-flow that occurs between a block and its successors. More...
const Stmt * | LoopTarget = nullptr
| Some blocks are used to represent the "loop edge" to the start of a loop from within the loop body. More...
unsigned | BlockID
| A numerical ID assigned to a CFGBlock during construction of the CFG. More...

## Detailed Description

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 yet

But note that any of that may be NULL in case of optimized-out edges.

Definition at line 576 of file CFG.h.

## Member Typedef Documentation

## ◆ CFGElementRef

using clang::CFGBlock::CFGElementRef = ElementRefImpl<false>

Definition at line 886 of file CFG.h.

## ◆ const_iterator

using clang::CFGBlock::const_iterator = ElementList::const_iterator

Definition at line 867 of file CFG.h.

## ◆ const_pred_iterator

using clang::CFGBlock::const_pred_iterator = AdjacentBlocks::const_iterator

Definition at line 925 of file CFG.h.

## ◆ const_pred_reverse_iterator

using clang::CFGBlock::const_pred_reverse_iterator = AdjacentBlocks::const_reverse_iterator

Definition at line 927 of file CFG.h.

## ◆ const_ref_iterator

using clang::CFGBlock::const_ref_iterator = ElementRefIterator<false, true>

Definition at line 891 of file CFG.h.

## ◆ const_ref_iterator_range

using clang::CFGBlock::const_ref_iterator_range = llvm::iterator_range<const_ref_iterator>

Definition at line 892 of file CFG.h.

## ◆ const_reverse_iterator

using clang::CFGBlock::const_reverse_iterator = ElementList::const_reverse_iterator

Definition at line 869 of file CFG.h.

## ◆ const_reverse_ref_iterator

using clang::CFGBlock::const_reverse_ref_iterator = ElementRefIterator<true, true>

Definition at line 897 of file CFG.h.

## ◆ const_reverse_ref_iterator_range

using clang::CFGBlock::const_reverse_ref_iterator_range = llvm::iterator_range<const_reverse_ref_iterator>

Definition at line 899 of file CFG.h.

## ◆ const_succ_iterator

using clang::CFGBlock::const_succ_iterator = AdjacentBlocks::const_iterator

Definition at line 932 of file CFG.h.

## ◆ const_succ_reverse_iterator

using clang::CFGBlock::const_succ_reverse_iterator = AdjacentBlocks::const_reverse_iterator

Definition at line 934 of file CFG.h.

## ◆ ConstCFGElementRef

using clang::CFGBlock::ConstCFGElementRef = ElementRefImpl<true>

Definition at line 887 of file CFG.h.

## ◆ filtered_pred_iterator

using clang::CFGBlock::filtered_pred_iterator = FilteredCFGBlockIterator<const_pred_iterator, true>

Definition at line 1025 of file CFG.h.

## ◆ filtered_succ_iterator

using clang::CFGBlock::filtered_succ_iterator = FilteredCFGBlockIterator<const_succ_iterator, false>

Definition at line 1028 of file CFG.h.

## ◆ iterator

using clang::CFGBlock::iterator = ElementList::iterator

Definition at line 866 of file CFG.h.

## ◆ pred_const_range

using clang::CFGBlock::pred_const_range = llvm::iterator_range<const_pred_iterator>

Definition at line 929 of file CFG.h.

## ◆ pred_iterator

using clang::CFGBlock::pred_iterator = AdjacentBlocks::iterator

Definition at line 924 of file CFG.h.

## ◆ pred_range

using clang::CFGBlock::pred_range = llvm::iterator_range<pred_iterator>

Definition at line 928 of file CFG.h.

## ◆ pred_reverse_iterator

using clang::CFGBlock::pred_reverse_iterator = AdjacentBlocks::reverse_iterator

Definition at line 926 of file CFG.h.

## ◆ ref_iterator

using clang::CFGBlock::ref_iterator = ElementRefIterator<false, false>

Definition at line 889 of file CFG.h.

## ◆ ref_iterator_range

using clang::CFGBlock::ref_iterator_range = llvm::iterator_range<ref_iterator>

Definition at line 890 of file CFG.h.

## ◆ reverse_iterator

using clang::CFGBlock::reverse_iterator = ElementList::reverse_iterator

Definition at line 868 of file CFG.h.

## ◆ reverse_ref_iterator

using clang::CFGBlock::reverse_ref_iterator = ElementRefIterator<true, false>

Definition at line 894 of file CFG.h.

## ◆ reverse_ref_iterator_range

using clang::CFGBlock::reverse_ref_iterator_range = llvm::iterator_range<reverse_ref_iterator>

Definition at line 895 of file CFG.h.

## ◆ succ_const_range

using clang::CFGBlock::succ_const_range = llvm::iterator_range<const_succ_iterator>

Definition at line 936 of file CFG.h.

## ◆ succ_iterator

using clang::CFGBlock::succ_iterator = AdjacentBlocks::iterator

Definition at line 931 of file CFG.h.

## ◆ succ_range

using clang::CFGBlock::succ_range = llvm::iterator_range<succ_iterator>

Definition at line 935 of file CFG.h.

## ◆ succ_reverse_iterator

using clang::CFGBlock::succ_reverse_iterator = AdjacentBlocks::reverse_iterator

Definition at line 933 of file CFG.h.

## Constructor & Destructor Documentation

## ◆ CFGBlock()

clang::CFGBlock::CFGBlock | ( | unsigned | blockid,
|  | BumpVectorContext & | C,
|  | CFG * | parent
| ) |  |
| inline explicit

Definition at line 861 of file CFG.h.

## Member Function Documentation

## ◆ addSuccessor()

void CFGBlock::addSuccessor | ( | AdjacentBlock | Succ,
|  | BumpVectorContext & | C
| ) |  |

Adds a (potentially unreachable) successor block to the current block.

Definition at line 5055 of file CFG.cpp.

References clang::CFGBlock::AdjacentBlock::getPossiblyUnreachableBlock(), clang::CFGBlock::AdjacentBlock::getReachableBlock(), and clang::CFGBlock::AdjacentBlock::isReachable().

## ◆ appendAutomaticObjDtor()

void clang::CFGBlock::appendAutomaticObjDtor | ( | VarDecl * | VD,
|  | Stmt * | S,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1151 of file CFG.h.

## ◆ appendBaseDtor()

void clang::CFGBlock::appendBaseDtor | ( | const CXXBaseSpecifier * | BS,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1139 of file CFG.h.

## ◆ appendConstructor()

void clang::CFGBlock::appendConstructor | ( | CXXConstructExpr * | CE,
|  | const ConstructionContext * | CC,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1100 of file CFG.h.

## ◆ appendCXXRecordTypedCall()

void clang::CFGBlock::appendCXXRecordTypedCall | ( | Expr * | E,
|  | const ConstructionContext * | CC,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1105 of file CFG.h.

## ◆ appendDeleteDtor()

void clang::CFGBlock::appendDeleteDtor | ( | CXXRecordDecl * | RD,
|  | CXXDeleteExpr * | DE,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1163 of file CFG.h.

## ◆ appendInitializer()

void clang::CFGBlock::appendInitializer | ( | CXXCtorInitializer * | initializer,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1111 of file CFG.h.

## ◆ appendLifetimeEnds()

void clang::CFGBlock::appendLifetimeEnds | ( | VarDecl * | VD,
|  | Stmt * | S,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1155 of file CFG.h.

## ◆ appendLoopExit()

void clang::CFGBlock::appendLoopExit | ( | const Stmt * | LoopStmt,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1159 of file CFG.h.

## ◆ appendMemberDtor()

void clang::CFGBlock::appendMemberDtor | ( | FieldDecl * | FD,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1143 of file CFG.h.

## ◆ appendNewAllocator()

void clang::CFGBlock::appendNewAllocator | ( | CXXNewExpr * | NE,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1116 of file CFG.h.

## ◆ appendScopeBegin()

void clang::CFGBlock::appendScopeBegin | ( | const VarDecl * | VD,
|  | const Stmt * | S,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1121 of file CFG.h.

## ◆ appendScopeEnd()

void clang::CFGBlock::appendScopeEnd | ( | const VarDecl * | VD,
|  | const Stmt * | S,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1131 of file CFG.h.

## ◆ appendStmt()

void clang::CFGBlock::appendStmt | ( | Stmt * | statement,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1096 of file CFG.h.

## ◆ appendTemporaryDtor()

void clang::CFGBlock::appendTemporaryDtor | ( | CXXBindTemporaryExpr * | E,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1147 of file CFG.h.

## ◆ back()

CFGElement clang::CFGBlock::back | ( |  | ) | const
| inline

Definition at line 874 of file CFG.h.

Referenced by clang::CFG::back(), clang::ento::CoreEngine::ExecuteWorkListWithInitialState(), and neverReturns().

## ◆ begin() [1/2]

iterator clang::CFGBlock::begin | ( |  | ) |
| inline

Definition at line 876 of file CFG.h.

Referenced by Accumulate(), clang::LiveVariables::computeLiveness(), isImmediateSinkBlock(), and print_block().

## ◆ begin() [2/2]

const_iterator clang::CFGBlock::begin | ( |  | ) | const
| inline

Definition at line 878 of file CFG.h.

## ◆ beginAutomaticObjDtorsInsert()

iterator clang::CFGBlock::beginAutomaticObjDtorsInsert | ( | iterator | I,
|  | size_t | Cnt,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1170 of file CFG.h.

References clang::C.

## ◆ beginLifetimeEndsInsert()

iterator clang::CFGBlock::beginLifetimeEndsInsert | ( | iterator | I,
|  | size_t | Cnt,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1183 of file CFG.h.

References clang::C.

## ◆ beginScopeEndInsert()

iterator clang::CFGBlock::beginScopeEndInsert | ( | iterator | I,
|  | size_t | Cnt,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1196 of file CFG.h.

References clang::C.

## ◆ dump() [1/2]

LLVM_DUMP_METHOD void CFGBlock::dump | ( |  | ) | const

Definition at line 5806 of file CFG.cpp.

References getParent().

## ◆ dump() [2/2]

void CFGBlock::dump | ( | const CFG * | cfg,
|  | const LangOptions & | LO,
|  | bool | ShowColors = `false`
| ) |  | const

dump - A simply pretty printer of a CFGBlock that outputs to stderr.

Definition at line 5801 of file CFG.cpp.

References print().

## ◆ empty()

bool clang::CFGBlock::empty | ( |  | ) | const
| inline

Definition at line 919 of file CFG.h.

Referenced by clang::ento::CoreEngine::ExecuteWorkList(), clang::ento::CoreEngine::ExecuteWorkListWithInitialState(), clang::BlockEntrance::getFirstElement(), clang::ento::WorkList::makeUnexploredFirstPriorityQueue(), neverReturns(), clang::ento::ExprEngine::processCallEnter(), and clang::ento::ExprEngine::VisitLogicalExpr().

## ◆ end() [1/2]

iterator clang::CFGBlock::end | ( |  | ) |
| inline

Definition at line 877 of file CFG.h.

Referenced by Accumulate(), clang::LiveVariables::computeLiveness(), isImmediateSinkBlock(), and print_block().

## ◆ end() [2/2]

const_iterator clang::CFGBlock::end | ( |  | ) | const
| inline

Definition at line 879 of file CFG.h.

## ◆ filtered_pred_start_end()

filtered_pred_iterator clang::CFGBlock::filtered_pred_start_end | ( | const FilterOptions & | f | ) | const
| inline

Definition at line 1030 of file CFG.h.

## ◆ filtered_succ_start_end()

filtered_succ_iterator clang::CFGBlock::filtered_succ_start_end | ( | const FilterOptions & | f | ) | const
| inline

Definition at line 1034 of file CFG.h.

## ◆ FilterEdge()

bool CFGBlock::FilterEdge | ( | const FilterOptions & | F,
|  | const CFGBlock * | Src,
|  | const CFGBlock * | Dst
| ) |  |
| static

Definition at line 5066 of file CFG.cpp.

References clang::CFG::begin(), clang::CFG::end(), clang::IfStmt::getCond(), clang::SwitchStmt::getCond(), clang::WhileStmt::getCond(), clang::DoStmt::getCond(), clang::ForStmt::getCond(), clang::AbstractConditionalOperator::getCond(), clang::ChooseExpr::getCond(), clang::ForStmt::getInc(), clang::ForStmt::getInit(), clang::CFGTerminator::getKind(), getLabel(), clang::BinaryOperator::getLHS(), clang::NamedDecl::getName(), clang::BinaryOperator::getOpcode(), clang::DeclStmt::getSingleDecl(), clang::CFGTerminator::getStmt(), clang::Stmt::getStmtClass(), clang::IndirectGotoStmt::getTarget(), getTerminatorStmt(), clang::CFGBlock::FilterOptions::IgnoreDefaultsWithCoveredEnums, clang::CFGBlock::FilterOptions::IgnoreNullPredecessors, clang::PrintingPolicy::IncludeNewlines, clang::BinaryOperator::isLogicalOp(), P, print(), clang::Stmt::printPretty(), clang::ast_matchers::stmt, clang::CFGTerminator::StmtBranch, clang::CFGTerminator::TemporaryDtorsBranch, and clang::CFGTerminator::VirtualBaseBranch.

## ◆ front()

CFGElement clang::CFGBlock::front | ( |  | ) | const
| inline

Definition at line 873 of file CFG.h.

Referenced by clang::CFG::front(), and clang::BlockEntrance::getFirstElement().

## ◆ getBlockID()

unsigned clang::CFGBlock::getBlockID | ( |  | ) | const
| inline

Definition at line 1075 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(), CheckFallThrough(), checkForRecursiveFunctionCall(), clang::LiveVariables::computeLiveness(), clang::consumed::ConsumedBlockInfo::discardInfo(), clang::LiveVariables::dumpBlockLiveness(), clang::ento::CoreEngine::ExecuteWorkList(), clang::ento::CoreEngine::ExecuteWorkListWithInitialState(), clang::reachable_code::FindUnreachableCode(), clang::ento::CheckerContext::getBlockID(), clang::consumed::ConsumedBlockInfo::getInfo(), getStaticBooleanValue(), 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().

## ◆ getIndexInCFG()

size_t CFGBlock::getIndexInCFG | ( |  | ) | const

Definition at line 5796 of file CFG.cpp.

References clang::CFG::begin(), and getParent().

## ◆ getLabel() [1/2]

Stmt* clang::CFGBlock::getLabel | ( |  | ) |
| inline

Definition at line 1070 of file CFG.h.

References Label.

Referenced by Accumulate(), FilterEdge(), getEnclosingStmtLocation(), and print_block().

## ◆ getLabel() [2/2]

const Stmt* clang::CFGBlock::getLabel | ( |  | ) | const
| inline

Definition at line 1071 of file CFG.h.

References Label.

## ◆ getLastCondition()

const Expr * CFGBlock::getLastCondition | ( |  | ) | const

Returns
  the last (`rbegin()`) 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 5902 of file CFG.cpp.

References clang::CFGElement::getAs(), rbegin(), size(), clang::CFGTerminator::StmtBranch, and succ_size().

## ◆ getLoopTarget()

const Stmt* clang::CFGBlock::getLoopTarget | ( |  | ) | const
| inline

Definition at line 1068 of file CFG.h.

## ◆ getParent()

CFG* clang::CFGBlock::getParent | ( |  | ) | const
| inline

Definition at line 1077 of file CFG.h.

References clang::CFGElement::dump(), Parent, and print().

Referenced by dump(), getIndexInCFG(), and isInevitablySinking().

## ◆ getTerminator()

CFGTerminator clang::CFGBlock::getTerminator | ( |  | ) | const
| inline

Definition at line 1049 of file CFG.h.

Referenced by clang::ento::CoreEngine::ExecuteWorkListWithInitialState(), clang::ento::SwitchNodeBuilder::getSwitch(), clang::consumed::ConsumedStateMap::operator!=(), print_block(), printTerminator(), ResolveCondition(), and clang::ento::ExprEngine::VisitLogicalExpr().

## ◆ getTerminatorCondition() [1/2]

Stmt * CFGBlock::getTerminatorCondition | ( | bool | StripParens = `true` | ) |

Definition at line 5930 of file CFG.cpp.

References clang::Stmt::getStmtClass(), getTerminatorStmt(), clang::Expr::IgnoreParens(), and Terminator.

Referenced by getStaticBooleanValue(), getTerminatorCondition(), and shouldTreatSuccessorsAsReachable().

## ◆ getTerminatorCondition() [2/2]

const Stmt* clang::CFGBlock::getTerminatorCondition | ( | bool | StripParens = `true` | ) | const
| inline

Definition at line 1064 of file CFG.h.

References getTerminatorCondition().

## ◆ getTerminatorStmt() [1/2]

Stmt* clang::CFGBlock::getTerminatorStmt | ( |  | ) |
| inline

Definition at line 1051 of file CFG.h.

References clang::CFGTerminator::getStmt().

Referenced by Accumulate(), CheckFallThrough(), clang::ento::CoreEngine::ExecuteWorkListWithInitialState(), FilterEdge(), getLastStmtLoc(), getLocationRegionIfReference(), getStaticBooleanValue(), getTerminatorCondition(), clang::ento::ExprEngine::processCFGBlockEntrance(), shouldTreatSuccessorsAsReachable(), and writeShouldKill().

## ◆ getTerminatorStmt() [2/2]

const Stmt* clang::CFGBlock::getTerminatorStmt | ( |  | ) | const
| inline

Definition at line 1052 of file CFG.h.

References clang::CFGTerminator::getStmt(), and getTerminatorCondition().

## ◆ hasNoReturnElement()

bool clang::CFGBlock::hasNoReturnElement | ( |  | ) | const
| inline

Definition at line 1073 of file CFG.h.

Referenced by CheckFallThrough(), isImmediateSinkBlock(), neverReturns(), and print_block().

## ◆ insertAutomaticObjDtor()

iterator clang::CFGBlock::insertAutomaticObjDtor | ( | iterator | I,
|  | VarDecl * | VD,
|  | Stmt * | S
| ) |  |
| inline

Definition at line 1175 of file CFG.h.

## ◆ insertLifetimeEnds()

iterator clang::CFGBlock::insertLifetimeEnds | ( | iterator | I,
|  | VarDecl * | VD,
|  | Stmt * | S
| ) |  |
| inline

Definition at line 1188 of file CFG.h.

## ◆ insertScopeEnd()

iterator clang::CFGBlock::insertScopeEnd | ( | iterator | I,
|  | VarDecl * | VD,
|  | Stmt * | S
| ) |  |
| inline

Definition at line 1200 of file CFG.h.

## ◆ isInevitablySinking()

bool CFGBlock::isInevitablySinking | ( |  | ) | const

Returns true if the block would eventually end with a sink (a noreturn node).

Definition at line 5864 of file CFG.cpp.

References clang::CFG::getExit(), getParent(), isImmediateSinkBlock(), and succs().

## ◆ operator[]()

CFGElement clang::CFGBlock::operator[] | ( | size_t | i | ) | const
| inline

Definition at line 921 of file CFG.h.

## ◆ pred_begin() [1/2]

pred_iterator clang::CFGBlock::pred_begin | ( |  | ) |
| inline

Definition at line 938 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(), clang::CFGReverseBlockReachabilityAnalysis::isReachable(), print_block(), and runOnBlock().

## ◆ pred_begin() [2/2]

const_pred_iterator clang::CFGBlock::pred_begin | ( |  | ) | const
| inline

Definition at line 940 of file CFG.h.

References clang::BumpVector< T >::begin().

## ◆ pred_empty()

bool clang::CFGBlock::pred_empty | ( |  | ) | const
| inline

Definition at line 978 of file CFG.h.

References clang::BumpVector< T >::empty().

Referenced by checkRecursiveFunction(), checkThrowInNonThrowingFunc(), and print_block().

## ◆ pred_end() [1/2]

pred_iterator clang::CFGBlock::pred_end | ( |  | ) |
| inline

Definition at line 939 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(), clang::CFGReverseBlockReachabilityAnalysis::isReachable(), print_block(), and runOnBlock().

## ◆ pred_end() [2/2]

const_pred_iterator clang::CFGBlock::pred_end | ( |  | ) | const
| inline

Definition at line 941 of file CFG.h.

References clang::BumpVector< T >::end().

## ◆ pred_rbegin() [1/2]

pred_reverse_iterator clang::CFGBlock::pred_rbegin | ( |  | ) |
| inline

Definition at line 943 of file CFG.h.

References clang::BumpVector< T >::rbegin().

## ◆ pred_rbegin() [2/2]

const_pred_reverse_iterator clang::CFGBlock::pred_rbegin | ( |  | ) | const
| inline

Definition at line 945 of file CFG.h.

References clang::BumpVector< T >::rbegin().

## ◆ pred_rend() [1/2]

pred_reverse_iterator clang::CFGBlock::pred_rend | ( |  | ) |
| inline

Definition at line 944 of file CFG.h.

References clang::BumpVector< T >::rend().

## ◆ pred_rend() [2/2]

const_pred_reverse_iterator clang::CFGBlock::pred_rend | ( |  | ) | const
| inline

Definition at line 946 of file CFG.h.

References clang::BumpVector< T >::rend().

## ◆ pred_size()

unsigned clang::CFGBlock::pred_size | ( |  | ) | const
| inline

Definition at line 977 of file CFG.h.

References clang::BumpVector< T >::size().

Referenced by getLastStmtLoc(), clang::consumed::ConsumedBlockInfo::isBackEdgeTarget(), and print_block().

## ◆ preds() [1/2]

pred_range clang::CFGBlock::preds | ( |  | ) |
| inline

Definition at line 948 of file CFG.h.

## ◆ preds() [2/2]

pred_const_range clang::CFGBlock::preds | ( |  | ) | const
| inline

Definition at line 952 of file CFG.h.

## ◆ prependScopeBegin()

void clang::CFGBlock::prependScopeBegin | ( | const VarDecl * | VD,
|  | const Stmt * | S,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1126 of file CFG.h.

## ◆ prependScopeEnd()

void clang::CFGBlock::prependScopeEnd | ( | const VarDecl * | VD,
|  | const Stmt * | S,
|  | BumpVectorContext & | C
| ) |  |
| inline

Definition at line 1135 of file CFG.h.

## ◆ print()

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 5812 of file CFG.cpp.

References print_block().

Referenced by dump(), clang::CFG::dump(), and FilterEdge().

## ◆ printAsOperand()

void clang::CFGBlock::printAsOperand | ( | raw_ostream & | OS,
|  | bool |
| ) |  |
| inline

Definition at line 1089 of file CFG.h.

References clang::C.

## ◆ printTerminator()

void CFGBlock::printTerminator | ( | raw_ostream & | OS,
|  | const LangOptions & | LO
| ) |  | const

printTerminator - A simple pretty printer of the terminator of a CFGBlock.

Definition at line 5820 of file CFG.cpp.

References getTerminator().

Referenced by printTerminatorJson().

## ◆ printTerminatorJson()

void CFGBlock::printTerminatorJson | ( | raw_ostream & | Out,
|  | const LangOptions & | LO,
|  | bool | AddQuotes
| ) |  | const

printTerminatorJson - Pretty-prints the terminator in JSON format.

Definition at line 5827 of file CFG.cpp.

References clang::JsonFormat(), and printTerminator().

## ◆ rbegin() [1/2]

reverse_iterator clang::CFGBlock::rbegin | ( |  | ) |
| inline

Definition at line 881 of file CFG.h.

Referenced by CheckFallThrough(), getLastCondition(), getLastStmtLoc(), ResolveCondition(), clang::ento::ExprEngine::VisitLogicalExpr(), and writeShouldKill().

## ◆ rbegin() [2/2]

const_reverse_iterator clang::CFGBlock::rbegin | ( |  | ) | const
| inline

Definition at line 883 of file CFG.h.

## ◆ ref_begin() [1/2]

ref_iterator clang::CFGBlock::ref_begin | ( |  | ) |
| inline

Definition at line 901 of file CFG.h.

## ◆ ref_begin() [2/2]

const_ref_iterator clang::CFGBlock::ref_begin | ( |  | ) | const
| inline

Definition at line 903 of file CFG.h.

## ◆ ref_end() [1/2]

ref_iterator clang::CFGBlock::ref_end | ( |  | ) |
| inline

Definition at line 902 of file CFG.h.

## ◆ ref_end() [2/2]

const_ref_iterator clang::CFGBlock::ref_end | ( |  | ) | const
| inline

Definition at line 904 of file CFG.h.

## ◆ refs() [1/2]

ref_iterator_range clang::CFGBlock::refs | ( |  | ) |
| inline

Definition at line 911 of file CFG.h.

## ◆ refs() [2/2]

const_ref_iterator_range clang::CFGBlock::refs | ( |  | ) | const
| inline

Definition at line 912 of file CFG.h.

## ◆ rend() [1/2]

reverse_iterator clang::CFGBlock::rend | ( |  | ) |
| inline

Definition at line 882 of file CFG.h.

Referenced by CheckFallThrough(), getLastStmtLoc(), ResolveCondition(), and writeShouldKill().

## ◆ rend() [2/2]

const_reverse_iterator clang::CFGBlock::rend | ( |  | ) | const
| inline

Definition at line 884 of file CFG.h.

## ◆ rref_begin() [1/2]

reverse_ref_iterator clang::CFGBlock::rref_begin | ( |  | ) |
| inline

Definition at line 906 of file CFG.h.

## ◆ rref_begin() [2/2]

const_reverse_ref_iterator clang::CFGBlock::rref_begin | ( |  | ) | const
| inline

Definition at line 908 of file CFG.h.

## ◆ rref_end() [1/2]

reverse_ref_iterator clang::CFGBlock::rref_end | ( |  | ) |
| inline

Definition at line 907 of file CFG.h.

## ◆ rref_end() [2/2]

const_reverse_ref_iterator clang::CFGBlock::rref_end | ( |  | ) | const
| inline

Definition at line 909 of file CFG.h.

## ◆ rrefs() [1/2]

reverse_ref_iterator_range clang::CFGBlock::rrefs | ( |  | ) |
| inline

Definition at line 913 of file CFG.h.

## ◆ rrefs() [2/2]

const_reverse_ref_iterator_range clang::CFGBlock::rrefs | ( |  | ) | const
| inline

Definition at line 914 of file CFG.h.

## ◆ setHasNoReturnElement()

void clang::CFGBlock::setHasNoReturnElement | ( |  | ) |
| inline

Definition at line 1043 of file CFG.h.

## ◆ setLabel()

void clang::CFGBlock::setLabel | ( | Stmt * | Statement | ) |
| inline

Definition at line 1041 of file CFG.h.

References clang::CFGElement::Statement.

Referenced by shouldAddCase().

## ◆ setLoopTarget()

void clang::CFGBlock::setLoopTarget | ( | const Stmt * | loopTarget | ) |
| inline

Definition at line 1042 of file CFG.h.

## ◆ setTerminator()

void clang::CFGBlock::setTerminator | ( | CFGTerminator | Term | ) |
| inline

Definition at line 1040 of file CFG.h.

## ◆ size()

unsigned clang::CFGBlock::size | ( |  | ) | const
| inline

Definition at line 918 of file CFG.h.

Referenced by clang::ento::CoreEngine::ExecuteWorkListWithInitialState(), clang::ento::CallEvent::getCalleeStackFrame(), and getLastCondition().

## ◆ succ_begin() [1/2]

succ_iterator clang::CFGBlock::succ_begin | ( |  | ) |
| inline

Definition at line 956 of file CFG.h.

References clang::BumpVector< T >::begin().

Referenced by clang::ento::IndirectGotoNodeBuilder::begin(), CheckFallThrough(), checkForRecursiveFunctionCall(), llvm::GraphTraits< ::clang::CFGBlock * >::child_begin(), llvm::GraphTraits< const ::clang::CFGBlock * >::child_begin(), ClassifyDiagnostic(), clang::LiveVariables::computeLiveness(), clang::ento::CoreEngine::ExecuteWorkList(), clang::ento::CoreEngine::ExecuteWorkListWithInitialState(), getLastStmtLoc(), getLocationRegionIfReference(), isAlwaysUninit(), isJumpToFalseBranch(), clang::consumed::ConsumedStateMap::operator!=(), print_block(), clang::ento::ExprEngine::processCallEnter(), scanFromBlock(), and clang::ento::ExprEngine::VisitLogicalExpr().

## ◆ succ_begin() [2/2]

const_succ_iterator clang::CFGBlock::succ_begin | ( |  | ) | const
| inline

Definition at line 958 of file CFG.h.

References clang::BumpVector< T >::begin().

## ◆ succ_empty()

bool clang::CFGBlock::succ_empty | ( |  | ) | const
| inline

Definition at line 975 of file CFG.h.

References clang::BumpVector< T >::empty().

Referenced by print_block().

## ◆ succ_end() [1/2]

succ_iterator clang::CFGBlock::succ_end | ( |  | ) |
| inline

Definition at line 957 of file CFG.h.

References clang::BumpVector< T >::end().

Referenced by CheckFallThrough(), checkForRecursiveFunctionCall(), llvm::GraphTraits< ::clang::CFGBlock * >::child_end(), llvm::GraphTraits< const ::clang::CFGBlock * >::child_end(), ClassifyDiagnostic(), clang::LiveVariables::computeLiveness(), clang::ento::IndirectGotoNodeBuilder::end(), clang::ento::CoreEngine::ExecuteWorkListWithInitialState(), isAlwaysUninit(), print_block(), and scanFromBlock().

## ◆ succ_end() [2/2]

const_succ_iterator clang::CFGBlock::succ_end | ( |  | ) | const
| inline

Definition at line 959 of file CFG.h.

References clang::BumpVector< T >::end().

## ◆ succ_rbegin() [1/2]

succ_reverse_iterator clang::CFGBlock::succ_rbegin | ( |  | ) |
| inline

Definition at line 961 of file CFG.h.

References clang::BumpVector< T >::rbegin().

Referenced by clang::ento::SwitchNodeBuilder::begin(), and clang::ento::SwitchNodeBuilder::generateDefaultCaseNode().

## ◆ succ_rbegin() [2/2]

const_succ_reverse_iterator clang::CFGBlock::succ_rbegin | ( |  | ) | const
| inline

Definition at line 963 of file CFG.h.

References clang::BumpVector< T >::rbegin().

## ◆ succ_rend() [1/2]

succ_reverse_iterator clang::CFGBlock::succ_rend | ( |  | ) |
| inline

Definition at line 962 of file CFG.h.

References clang::BumpVector< T >::rend().

Referenced by clang::ento::SwitchNodeBuilder::end().

## ◆ succ_rend() [2/2]

const_succ_reverse_iterator clang::CFGBlock::succ_rend | ( |  | ) | const
| inline

Definition at line 964 of file CFG.h.

References clang::BumpVector< T >::rend().

## ◆ succ_size()

unsigned clang::CFGBlock::succ_size | ( |  | ) | const
| inline

Definition at line 974 of file CFG.h.

References clang::BumpVector< T >::size().

Referenced by clang::ento::CoreEngine::ExecuteWorkList(), clang::ento::CoreEngine::ExecuteWorkListWithInitialState(), getLastCondition(), getLastStmtLoc(), isJumpToFalseBranch(), print_block(), clang::ento::ExprEngine::processCallEnter(), and clang::ento::ExprEngine::VisitLogicalExpr().

## ◆ succs() [1/2]

succ_range clang::CFGBlock::succs | ( |  | ) |
| inline

Definition at line 966 of file CFG.h.

Referenced by isInevitablySinking(), and clang::CFG::isLinear().

## ◆ succs() [2/2]

succ_const_range clang::CFGBlock::succs | ( |  | ) | const
| inline

Definition at line 970 of file CFG.h.

## Member Data Documentation

## ◆ BlockID

unsigned clang::CFGBlock::BlockID

A numerical ID assigned to a CFGBlock during construction of the CFG.

Definition at line 784 of file CFG.h.

## ◆ Elements

ElementList clang::CFGBlock::Elements

The set of statements in the basic block.

Definition at line 767 of file CFG.h.

## ◆ Label

Stmt* clang::CFGBlock::Label = nullptr

An (optional) label that prefixes the executable statements in the block.

When this variable is non-NULL, it is either an instance of LabelStmt, SwitchCase or CXXCatchStmt.

Definition at line 772 of file CFG.h.

Referenced by print_block().

## ◆ LoopTarget

const Stmt* clang::CFGBlock::LoopTarget = nullptr

Some 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 781 of file CFG.h.

## ◆ Terminator

CFGTerminator clang::CFGBlock::Terminator

The terminator for a basic block that indicates the type of control-flow that occurs between a block and its successors.

Definition at line 776 of file CFG.h.

Referenced by getTerminatorCondition().

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

- include/clang/Analysis/CFG.h
- lib/Analysis/CFG.cpp