public abstract class CFGBuilder extends Object
The translation of the AST to the CFG is split into three phases:
ExtendedNode
s. An extended node can either be a
Node
, or one of several meta elements such as a conditional or unconditional jump
or a node with additional information about exceptions. Some of the extended nodes contain
labels (e.g., for the jump target), and phase one additionally creates a mapping from
labels to extended nodes. Finally, the list of leaders is computed: A leader is an extended
node which will give rise to a basic block in phase two.
Constructor and Description |
---|
CFGBuilder() |
Modifier and Type | Method and Description |
---|---|
static ControlFlowGraph |
build(CompilationUnitTree root,
MethodTree tree,
ClassTree classTree,
ProcessingEnvironment env)
Build the control flow graph of a method.
|
static ControlFlowGraph |
build(CompilationUnitTree root,
UnderlyingAST underlyingAST,
boolean assumeAssertionsEnabled,
boolean assumeAssertionsDisabled,
ProcessingEnvironment env)
Build the control flow graph of some code.
|
static ControlFlowGraph |
build(CompilationUnitTree root,
UnderlyingAST underlyingAST,
ProcessingEnvironment env)
Build the control flow graph of some code.
|
static ControlFlowGraph |
build(TreePath bodyPath,
UnderlyingAST underlyingAST,
boolean assumeAssertionsEnabled,
boolean assumeAssertionsDisabled,
ProcessingEnvironment env)
Build the control flow graph of some code (method, initializer block, ...).
|
static String |
extendedNodeCollectionToStringDebug(Collection<? extends org.checkerframework.dataflow.cfg.builder.ExtendedNode> nodes)
Return a printed representation of a collection of extended nodes.
|
protected static void |
printBlocks(Set<Block> blocks)
Print a set of
Block s and the edges between them. |
public static ControlFlowGraph build(CompilationUnitTree root, UnderlyingAST underlyingAST, boolean assumeAssertionsEnabled, boolean assumeAssertionsDisabled, ProcessingEnvironment env)
root
- the compilation unitunderlyingAST
- the AST that underlies the control frow graphassumeAssertionsDisabled
- can assertions be assumed to be disabled?assumeAssertionsEnabled
- can assertions be assumed to be enabled?env
- annotation processing environment containing type utilitiespublic static ControlFlowGraph build(TreePath bodyPath, UnderlyingAST underlyingAST, boolean assumeAssertionsEnabled, boolean assumeAssertionsDisabled, ProcessingEnvironment env)
public static ControlFlowGraph build(CompilationUnitTree root, UnderlyingAST underlyingAST, ProcessingEnvironment env)
public static ControlFlowGraph build(CompilationUnitTree root, MethodTree tree, ClassTree classTree, ProcessingEnvironment env)
public static String extendedNodeCollectionToStringDebug(Collection<? extends org.checkerframework.dataflow.cfg.builder.ExtendedNode> nodes)
nodes
- a collection of extended nodes to format