Class ControlFlowGraph
- Namespace
- ICSharpCode.Decompiler.IL.ControlFlow
- Assembly
- ICSharpCode.Decompiler.dll
Holds the control flow graph. A separate graph is computed for each BlockContainer at the start of the block transforms (before loop detection).
public class ControlFlowGraph
- Inheritance
-
ControlFlowGraph
- Inherited Members
Constructors
ControlFlowGraph(BlockContainer, CancellationToken)
Constructs a control flow graph for the blocks in the given block container.
Return statements, exceptions, or branches leaving the block container are not modeled by the control flow graph.
public ControlFlowGraph(BlockContainer container, CancellationToken cancellationToken = default)
Parameters
container
BlockContainercancellationToken
CancellationToken
Properties
Container
The container for which the ControlFlowGraph was created.
This may differ from the container currently holding a block, because a transform could have moved the block since the CFG was created.
public BlockContainer Container { get; }
Property Value
Methods
GetNode(Block)
Gets the ControlFlowNode for the block.
Precondition: the block belonged to the container
at the start of the block transforms
(when the control flow graph was created).
public ControlFlowNode GetNode(Block block)
Parameters
block
Block
Returns
HasDirectExitOutOfContainer(ControlFlowNode)
Gets whether the control flow node directly contains a branch/leave instruction exiting the container.
public bool HasDirectExitOutOfContainer(ControlFlowNode node)
Parameters
node
ControlFlowNode
Returns
HasReachableExit(ControlFlowNode)
Returns true iff there is a control flow path from node
to one of the following:
- branch or leave instruction leaving
this.Container
- branch instruction within this container to another node that is not dominated by
node
.
If this function returns false, the only way control flow can leave the set of nodes
dominated by node
is by executing a return
or throw
instruction.
public bool HasReachableExit(ControlFlowNode node)
Parameters
node
ControlFlowNode