CodeQL library for C/C++
Search

Class BasicBlock

A basic block in the C/C++ control-flow graph.

A basic block is a simple sequence of control-flow nodes, connected to each other and nothing else:

   A - B - C - D  ABCD is a basic block

Any incoming or outgoing edges break the block into two:

   A - B > C - D  AB is a basic block and CD is a basic block (C has two incoming edges)


   A - B < C - D  AB is a basic block and CD is a basic block (B has two outgoing edges)

Import path

import cpp

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

contains

Holds if this basic block contains node.

getAFalseSuccessor

Gets a BasicBlock such that the control-flow edge (this, result) may be taken when the outgoing edge of this basic block is an expression that is false.

getANode

Gets a ControlFlowNode in this basic block.

getAPredecessor

Gets a BasicBlock that is a direct predecessor of this basic block.

getASuccessor

Gets a BasicBlock that is a direct successor of this basic block.

getATrueSuccessor

Gets a BasicBlock such that the control-flow edge (this, result) may be taken when the outgoing edge of this basic block is an expression that is true.

getEnclosingFunction

Gets the function containing this basic block.

getEnd

Gets the final ControlFlowNode of this basic block.

getNode

Gets the ControlFlowNode at position pos in this basic block.

getStart

Gets the first ControlFlowNode of this basic block.

hasLocationInfo

Holds if this element is at the specified location. The location spans column startcolumn of line startline to column endcolumn of line endline in file filepath. For more information, see Locations.

inLoop

Holds if this basic block is in a loop of the control-flow graph. This includes loops created by goto statements. This predicate may not hold even if this basic block is syntactically inside a while loop if the necessary back edges are unreachable.

isLoopHeader

DEPRECATED since version 1.11: this predicate does not match the standard definition of loop header.

isReachable

Holds if control flow may reach this basic block from a function entry point or any handler of a reachable try statement.

isUnreachable

Means not isReachable().

length

Gets the number of ControlFlowNodes in this basic block.

Inherited predicates

getAPrimaryQlClass

Gets the name of a primary CodeQL class to which this element belongs.

from ElementBase
getCanonicalQLClass

DEPRECATED: use getAPrimaryQlClass instead.

from ElementBase
toString

Gets a textual representation of this element.

from ElementBase

Charpred