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

#include <CFG.h>

Classes

class  AdjacentBlock
 
class  FilteredCFGBlockIterator
 
class  FilterOptions
 

Public Types

typedef ElementList::iterator iterator
 
typedef ElementList::const_iterator const_iterator
 
typedef
ElementList::reverse_iterator 
reverse_iterator
 
typedef
ElementList::const_reverse_iterator 
const_reverse_iterator
 
typedef AdjacentBlocks::iterator pred_iterator
 
typedef
AdjacentBlocks::const_iterator 
const_pred_iterator
 
typedef
AdjacentBlocks::reverse_iterator 
pred_reverse_iterator
 
typedef
AdjacentBlocks::const_reverse_iterator 
const_pred_reverse_iterator
 
typedef AdjacentBlocks::iterator succ_iterator
 
typedef
AdjacentBlocks::const_iterator 
const_succ_iterator
 
typedef
AdjacentBlocks::reverse_iterator 
succ_reverse_iterator
 
typedef
AdjacentBlocks::const_reverse_iterator 
const_succ_reverse_iterator
 
typedef
FilteredCFGBlockIterator
< const_pred_iterator, true
filtered_pred_iterator
 
typedef
FilteredCFGBlockIterator
< const_succ_iterator, false
filtered_succ_iterator
 

Public Member Functions

 CFGBlock (unsigned blockid, BumpVectorContext &C, CFG *parent)
 
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
 
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
 
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
 
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 ()
 
CFGTerminator getTerminator ()
 
const CFGTerminator getTerminator () const
 
StmtgetTerminatorCondition (bool StripParens=true)
 
const StmtgetTerminatorCondition (bool StripParens=true) const
 
const StmtgetLoopTarget () const
 
StmtgetLabel ()
 
const StmtgetLabel () const
 
bool hasNoReturnElement () const
 
unsigned getBlockID () const
 
CFGgetParent () 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
 
void printTerminator (raw_ostream &OS, const LangOptions &LO) const
 printTerminator - A simple pretty printer of the terminator of a CFGBlock. 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 appendInitializer (CXXCtorInitializer *initializer, BumpVectorContext &C)
 
void appendNewAllocator (CXXNewExpr *NE, 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 appendDeleteDtor (CXXRecordDecl *RD, CXXDeleteExpr *DE, BumpVectorContext &C)
 
iterator beginAutomaticObjDtorsInsert (iterator I, size_t Cnt, BumpVectorContext &C)
 
iterator insertAutomaticObjDtor (iterator I, VarDecl *VD, Stmt *S)
 

Static Public Member Functions

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

Detailed Description

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:

Terminator Successor Ordering

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.

Definition at line 354 of file CFG.h.

Member Typedef Documentation

typedef ElementList::const_iterator clang::CFGBlock::const_iterator

Definition at line 499 of file CFG.h.

Definition at line 523 of file CFG.h.

Definition at line 525 of file CFG.h.

Definition at line 501 of file CFG.h.

Definition at line 528 of file CFG.h.

Definition at line 530 of file CFG.h.

Definition at line 603 of file CFG.h.

Definition at line 606 of file CFG.h.

typedef ElementList::iterator clang::CFGBlock::iterator

Definition at line 498 of file CFG.h.

Definition at line 522 of file CFG.h.

Definition at line 524 of file CFG.h.

Definition at line 500 of file CFG.h.

Definition at line 527 of file CFG.h.

Definition at line 529 of file CFG.h.

Constructor & Destructor Documentation

clang::CFGBlock::CFGBlock ( unsigned  blockid,
BumpVectorContext C,
CFG parent 
)
inlineexplicit

Definition at line 492 of file CFG.h.

Member Function Documentation

void CFGBlock::addSuccessor ( AdjacentBlock  Succ,
BumpVectorContext C 
)
void clang::CFGBlock::appendAutomaticObjDtor ( VarDecl VD,
Stmt S,
BumpVectorContext C 
)
inline

Definition at line 682 of file CFG.h.

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

Definition at line 670 of file CFG.h.

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

Definition at line 686 of file CFG.h.

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

Definition at line 660 of file CFG.h.

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

Definition at line 674 of file CFG.h.

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

Definition at line 665 of file CFG.h.

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

Definition at line 656 of file CFG.h.

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

Definition at line 678 of file CFG.h.

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

Definition at line 504 of file CFG.h.

Referenced by neverReturns().

iterator clang::CFGBlock::begin ( )
inline

Definition at line 506 of file CFG.h.

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

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

Definition at line 508 of file CFG.h.

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

Definition at line 693 of file CFG.h.

References AttributeLangSupport::C.

void CFGBlock::dump ( ) const

Definition at line 4450 of file CFG.cpp.

References getParent().

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

References print().

bool clang::CFGBlock::empty ( ) const
inline
iterator clang::CFGBlock::end ( )
inline

Definition at line 507 of file CFG.h.

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

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

Definition at line 509 of file CFG.h.

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

Definition at line 608 of file CFG.h.

References pred_begin(), and pred_end().

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

Definition at line 612 of file CFG.h.

References succ_begin(), and succ_end().

bool CFGBlock::FilterEdge ( const FilterOptions F,
const CFGBlock Src,
const CFGBlock Dst 
)
static
CFGElement clang::CFGBlock::front ( ) const
inline

Definition at line 503 of file CFG.h.

Referenced by clang::BlockEntrance::getFirstElement().

unsigned clang::CFGBlock::getBlockID ( ) const
inline
Stmt* clang::CFGBlock::getLabel ( )
inline
const Stmt* clang::CFGBlock::getLabel ( ) const
inline

Definition at line 635 of file CFG.h.

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

Definition at line 632 of file CFG.h.

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

Definition at line 641 of file CFG.h.

Referenced by dump().

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

Definition at line 624 of file CFG.h.

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

Definition at line 628 of file CFG.h.

References getTerminatorCondition().

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

Definition at line 637 of file CFG.h.

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

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

Definition at line 698 of file CFG.h.

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

Definition at line 519 of file CFG.h.

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

Definition at line 534 of file CFG.h.

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

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

Definition at line 556 of file CFG.h.

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

Referenced by checkRecursiveFunction(), and print_block().

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

Definition at line 535 of file CFG.h.

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

pred_reverse_iterator clang::CFGBlock::pred_rbegin ( )
inline

Definition at line 537 of file CFG.h.

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

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

Definition at line 539 of file CFG.h.

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

pred_reverse_iterator clang::CFGBlock::pred_rend ( )
inline

Definition at line 538 of file CFG.h.

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

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

Definition at line 540 of file CFG.h.

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

unsigned clang::CFGBlock::pred_size ( ) const
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 4456 of file CFG.cpp.

References print_block().

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

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

Definition at line 649 of file CFG.h.

References getBlockID().

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

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

Definition at line 4464 of file CFG.cpp.

References getTerminator().

Referenced by llvm::DOTGraphTraits< ExplodedNode * >::getNodeLabel().

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

Definition at line 513 of file CFG.h.

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

Definition at line 514 of file CFG.h.

void clang::CFGBlock::setHasNoReturnElement ( )
inline

Definition at line 621 of file CFG.h.

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

Definition at line 619 of file CFG.h.

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

Definition at line 620 of file CFG.h.

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

Definition at line 618 of file CFG.h.

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

Definition at line 516 of file CFG.h.

Referenced by getRegionForConstructedObject().

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

Definition at line 544 of file CFG.h.

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

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

Definition at line 553 of file CFG.h.

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

Referenced by print_block().

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

Definition at line 545 of file CFG.h.

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

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

Definition at line 549 of file CFG.h.

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

succ_reverse_iterator clang::CFGBlock::succ_rend ( )
inline

Definition at line 548 of file CFG.h.

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

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

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

Definition at line 550 of file CFG.h.

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

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

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