Interface CFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
- Type Parameters:
V
- the abstract value type to be tracked by the analysisS
- the store type used in the analysisT
- the transfer function type that is used to approximate run-time behavior
- All Known Implementing Classes:
AbstractCFGVisualizer
,DOTCFGVisualizer
,StringCFGVisualizer
public interface CFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
Perform some visualization on a control flow graph. The particular operations depend on the
implementation.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the separator for lines within a node's representation.void
Initialization method guaranteed to be called once before the first invocation ofvisualize(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>)
orvisualizeWithAction(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>)
.void
shutdown()
Shutdown method called once from the shutdown hook of theBaseTypeChecker
.Creates a visualization representing the control flow graph starting atentry
.Visualize a block based on the analysis.Visualize a Node based on the analysis.Visualize the transferInput after a Block based on the analysis.Visualize the transferInput before a Block based on the analysis.Visualize a ConditionalBlock.Visualize a SpecialBlock.visualizeStore
(S store) Delegate the visualization responsibility to the passedStore
instance, which will call back to this visualizer instance for sub-components.visualizeStoreArrayVal
(ArrayAccess arrayValue, V value) Called byCFAbstractStore#internalVisualize()
to visualize the value of one array collected by this Store.visualizeStoreClassVals
(ClassName className, V value) Called byCFAbstractStore#internalVisualize()
to visualize the value of class names collected by this Store.visualizeStoreFieldVal
(FieldAccess fieldAccess, V value) Called byCFAbstractStore#internalVisualize()
to visualize the value of one field collected by this Store.visualizeStoreKeyVal
(String keyName, Object value) Called byCFAbstractStore#internalVisualize()
to visualize the specific information collected according to the specific kind of Store.visualizeStoreLocalVar
(LocalVariable localVar, V value) Called byCFAbstractStore#internalVisualize()
to visualize a local variable.visualizeStoreMethodVals
(MethodCall methodCall, V value) Called byCFAbstractStore#internalVisualize()
to visualize the value of pure method calls collected by this Store.visualizeStoreThisVal
(V value) Called byCFAbstractStore#internalVisualize()
to visualize the value of the current objectthis
in this Store.visualizeWithAction
(ControlFlowGraph cfg, Block entry, @Nullable Analysis<V, S, T> analysis) Output a visualization representing the control flow graph starting atentry
.
-
Method Details
-
init
Initialization method guaranteed to be called once before the first invocation ofvisualize(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>)
orvisualizeWithAction(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>)
.- Parameters:
args
- implementation-dependent options
-
getSeparator
String getSeparator()Returns the separator for lines within a node's representation.- Returns:
- the separator for lines within a node's representation
-
visualize
@Nullable Map<String,Object> visualize(ControlFlowGraph cfg, Block entry, @Nullable Analysis<V, S, T> analysis) Creates a visualization representing the control flow graph starting atentry
. The keys and values in the returned map are implementation dependent. The method should not perform any actions.An invocation
visualize(cfg, entry, null);
does not output stores at the beginning of basic blocks.- Parameters:
cfg
- the CFG to visualizeentry
- the entry node of the control flow graph to be representedanalysis
- an analysis containing information about the program represented by the CFG. The information includesStore
s that are valid at the beginning of basic blocks reachable fromentry
and per-node information for value producingNode
s. Can also benull
to indicate that this information should not be output.- Returns:
- visualization results, e.g. generated file names (
DOTCFGVisualizer
) or a String representation of the CFG (StringCFGVisualizer
) - See Also:
-
visualizeWithAction
@Nullable Map<String,Object> visualizeWithAction(ControlFlowGraph cfg, Block entry, @Nullable Analysis<V, S, T> analysis) Output a visualization representing the control flow graph starting atentry
. The keys and values in the returned map are implementation dependent. The concrete actions are implementation dependent, and can include outputting information and producing files.An invocation
visualizeWithAction(cfg, entry, null);
does not output stores at the beginning of basic blocks.- Parameters:
cfg
- the CFG to visualizeentry
- the entry node of the control flow graph to be representedanalysis
- an analysis containing information about the program represented by the CFG. The information includesStore
s that are valid at the beginning of basic blocks reachable fromentry
and per-node information for value producingNode
s. Can also benull
to indicate that this information should not be output.- Returns:
- visualization results, e.g. generated file names (
DOTCFGVisualizer
) or a String representation of the CFG (StringCFGVisualizer
) - See Also:
-
visualizeStore
Delegate the visualization responsibility to the passedStore
instance, which will call back to this visualizer instance for sub-components.- Parameters:
store
- the store to visualize- Returns:
- the String representation of the given store
-
visualizeStoreLocalVar
Called byCFAbstractStore#internalVisualize()
to visualize a local variable.- Parameters:
localVar
- the local variablevalue
- the value of the local variable- Returns:
- the String representation of the local variable
-
visualizeStoreThisVal
Called byCFAbstractStore#internalVisualize()
to visualize the value of the current objectthis
in this Store.- Parameters:
value
- the value of the current objectthis
- Returns:
- the String representation of
this
-
visualizeStoreFieldVal
Called byCFAbstractStore#internalVisualize()
to visualize the value of one field collected by this Store.- Parameters:
fieldAccess
- the fieldvalue
- the value of the field- Returns:
- the String representation of the field
-
visualizeStoreArrayVal
Called byCFAbstractStore#internalVisualize()
to visualize the value of one array collected by this Store.- Parameters:
arrayValue
- the arrayvalue
- the value of the array- Returns:
- the String representation of the array
-
visualizeStoreMethodVals
Called byCFAbstractStore#internalVisualize()
to visualize the value of pure method calls collected by this Store.- Parameters:
methodCall
- the pure method callvalue
- the value of the pure method call- Returns:
- the String representation of the pure method call
-
visualizeStoreClassVals
Called byCFAbstractStore#internalVisualize()
to visualize the value of class names collected by this Store.- Parameters:
className
- the class namevalue
- the value of the class name- Returns:
- the String representation of the class name
-
visualizeStoreKeyVal
Called byCFAbstractStore#internalVisualize()
to visualize the specific information collected according to the specific kind of Store. Currently, these Stores call this method:LockStore
,NullnessStore
, andInitializationStore
to visualize additional information.- Parameters:
keyName
- the name of the specific information to be visualizedvalue
- the value of the specific information to be visualized- Returns:
- the String representation of the specific information
-
visualizeBlock
Visualize a block based on the analysis.- Parameters:
bb
- the blockanalysis
- the current analysis- Returns:
- the String representation of the given block
-
visualizeSpecialBlock
Visualize a SpecialBlock.- Parameters:
sbb
- the special block- Returns:
- the String representation of the type of the special block
sbb
: entry, exit, or exceptional-exit
-
visualizeConditionalBlock
Visualize a ConditionalBlock.- Parameters:
cbb
- the conditional block- Returns:
- the String representation of the conditional block
-
visualizeBlockTransferInputBefore
Visualize the transferInput before a Block based on the analysis.- Parameters:
bb
- the blockanalysis
- the current analysis- Returns:
- the String representation of the transferInput before the given block
-
visualizeBlockTransferInputAfter
Visualize the transferInput after a Block based on the analysis.- Parameters:
bb
- the blockanalysis
- the current analysis- Returns:
- the String representation of the transferInput after the given block
-
visualizeBlockNode
Visualize a Node based on the analysis.- Parameters:
n
- the nodeanalysis
- the current analysis- Returns:
- the String representation of the given node
-
shutdown
void shutdown()Shutdown method called once from the shutdown hook of theBaseTypeChecker
.
-