CodeQL library for C/C++
Search

Module ControlFlowGraph

Provides a library for reasoning about control flow at the granularity of individual nodes in the control-flow graph.

Import path

import semmle.code.cpp.controlflow.ControlFlowGraph

Imports

BasicBlocks

Provides a library for reasoning about control flow at the granularity of basic blocks. This is usually much more efficient than reasoning directly at the level of ControlFlowNodes.

ControlFlowGraphPublic

Provides predicates that should be exported as if they were top-level predicates in ControlFlowGraph.qll. They have to be defined in this file in order to be grouped in a cached module with other predicates that must go in the same cached stage.

cpp

Provides classes and predicates for working with C/C++ code.

Predicates

falsecond_base

DEPRECATED: Use ControlFlowNode.getAFalseSuccessor() instead. Holds when n2 is a control-flow node such that the control-flow edge (n1, n2) may be taken when n1 is an expression that is false.

successors_extended

Holds if there is a control-flow edge from source to target in either the extractor-generated control-flow graph or in a subclass of AdditionalControlFlowEdge. Use this relation instead of qlCFGSuccessor.

truecond_base

DEPRECATED: Use ControlFlowNode.getATrueSuccessor() instead. Holds when n2 is a control-flow node such that the control-flow edge (n1, n2) may be taken when n1 is an expression that is true.

Classes

AdditionalControlFlowEdge

An abstract class that can be extended to add additional edges to the control-flow graph. Instances of this class correspond to the source nodes of such edges, and the predicate getAnEdgeTarget should be overridden to produce the target nodes of each source.

ControlFlowNode

A control-flow node is either a statement or an expression; in addition, functions are control-flow nodes representing the exit point of the function. The graph represents one possible evaluation order out of all the ones the compiler might have picked.

ControlFlowNodeBase

An element that is convertible to ControlFlowNode. This class is similar to ControlFlowNode except that is has no member predicates apart from toString.