public class DOTCFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>> extends AbstractCFGVisualizer<A,S,T>
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
checkerName
Initialized in
init(Map) . |
protected java.util.Map<java.lang.String,java.lang.String> |
generated
Mapping from class/method representation to generated dot file.
|
protected static java.lang.String |
leftJustifiedTerminator
Terminator for lines that are left-justified.
|
protected java.lang.String |
outDir
The output directory.
|
lineSeparator, storeEntryIndent, verbose
Constructor and Description |
---|
DOTCFGVisualizer() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
addEdge(long sId,
long eId,
java.lang.String flowRule)
Generate the String representation of an edge.
|
protected java.lang.String |
dotOutputFileName(UnderlyingAST ast)
Create a dot file and return its name.
|
void |
init(java.util.Map<java.lang.String,java.lang.Object> args)
Initialization method guaranteed to be called once before the first invocation of
CFGVisualizer.visualize(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<A, S, T>) . |
void |
shutdown()
Write a file
methods.txt that contains a mapping from source code location to
generated dot file. |
@Nullable java.util.Map<java.lang.String,java.lang.Object> |
visualize(ControlFlowGraph cfg,
Block entry,
@Nullable Analysis<A,S,T> analysis)
Output a visualization representing the control flow graph starting at
entry . |
java.lang.String |
visualizeBlock(Block bb,
@Nullable Analysis<A,S,T> analysis)
Visualize a block based on the analysis.
|
java.lang.String |
visualizeBlockNode(Node t,
@Nullable Analysis<A,S,T> analysis)
Visualize a Node based on the analysis.
|
java.lang.String |
visualizeBlockTransferInput(Block bb,
Analysis<A,S,T> analysis)
Visualize the transferInput of a Block based on the analysis.
|
protected java.lang.String |
visualizeGraphFooter()
Return the footer of the generated graph.
|
protected java.lang.String |
visualizeGraphHeader()
Return the header of the generated graph.
|
java.lang.String |
visualizeNodes(java.util.Set<Block> blocks,
ControlFlowGraph cfg,
@Nullable Analysis<A,S,T> analysis)
Generate the String representation of the nodes of a control flow graph.
|
java.lang.String |
visualizeSpecialBlock(SpecialBlock sbb)
Visualize a SpecialBlock.
|
java.lang.String |
visualizeStoreArrayVal(FlowExpressions.ArrayAccess arrayValue,
A value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of arrays
collected by this Store. |
java.lang.String |
visualizeStoreClassVals(FlowExpressions.ClassName className,
A value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of class names
collected by this Store. |
java.lang.String |
visualizeStoreFieldVals(FlowExpressions.FieldAccess fieldAccess,
A value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of fields
collected by this Store. |
java.lang.String |
visualizeStoreFooter()
Called by
CFAbstractStore to visualize any information after the invocation of CFAbstractStore#internalVisualize() . |
java.lang.String |
visualizeStoreHeader(java.lang.String classCanonicalName)
Called by a
CFAbstractStore to visualize the class name before calling the CFAbstractStore#internalVisualize() method. |
java.lang.String |
visualizeStoreKeyVal(java.lang.String keyName,
java.lang.Object value)
Called by
CFAbstractStore#internalVisualize() to visualize the specific information
collected according to the specific kind of Store. |
java.lang.String |
visualizeStoreLocalVar(FlowExpressions.LocalVariable localVar,
A value)
Called by
CFAbstractStore#internalVisualize() to visualize a local variable. |
java.lang.String |
visualizeStoreMethodVals(FlowExpressions.MethodCall methodCall,
A value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of pure method
calls collected by this Store. |
java.lang.String |
visualizeStoreThisVal(A value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of the current
object this in this Store. |
addBlock, addBlockContent, getLastNode, getNodeSimpleName, getProcessOrder, getProcessOrderSimpleString, handleSuccessorsHelper, loopOverBlockContents, visualizeBlockHelper, visualizeBlockTransferInputHelper, visualizeGraph, visualizeGraphWithoutHeaderAndFooter, visualizeSpecialBlockHelper, visualizeStore
protected java.lang.String outDir
protected java.lang.String checkerName
init(Map)
. Use it as a part of the name of the output dot file.protected java.util.Map<java.lang.String,java.lang.String> generated
protected static final java.lang.String leftJustifiedTerminator
public void init(java.util.Map<java.lang.String,java.lang.Object> args)
CFGVisualizer
CFGVisualizer.visualize(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<A, S, T>)
.init
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
init
in class AbstractCFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
args
- implementation-dependent optionspublic @Nullable java.util.Map<java.lang.String,java.lang.Object> visualize(ControlFlowGraph cfg, Block entry, @Nullable Analysis<A,S,T> analysis)
CFGVisualizer
entry
. The
concrete actions are implementation dependent.
An invocation visualize(cfg, entry, null);
does not output stores at the beginning
of basic blocks.
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 includes Store
s that are valid at the beginning of basic blocks
reachable from entry
and per-node information for value producing Node
s.
Can also be null
to indicate that this information should not be output.DOTCFGVisualizer
) or a
String representation of the CFG (StringCFGVisualizer
)public java.lang.String visualizeNodes(java.util.Set<Block> blocks, ControlFlowGraph cfg, @Nullable Analysis<A,S,T> analysis)
AbstractCFGVisualizer
visualizeNodes
in class AbstractCFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
blocks
- the set of all the blocks in a control flow graphcfg
- the control flow graphanalysis
- the current analysisprotected java.lang.String addEdge(long sId, long eId, java.lang.String flowRule)
AbstractCFGVisualizer
addEdge
in class AbstractCFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
sId
- the ID of current blockeId
- the ID of successor blockflowRule
- the content of the edgepublic java.lang.String visualizeBlock(Block bb, @Nullable Analysis<A,S,T> analysis)
CFGVisualizer
bb
- the blockanalysis
- the current analysispublic java.lang.String visualizeSpecialBlock(SpecialBlock sbb)
CFGVisualizer
sbb
- the special blocksbb
: entry, exit,
or exceptional-exitpublic java.lang.String visualizeBlockTransferInput(Block bb, Analysis<A,S,T> analysis)
CFGVisualizer
bb
- the blockanalysis
- the current analysisprotected java.lang.String dotOutputFileName(UnderlyingAST ast)
ast
- an abstract syntax treepublic java.lang.String visualizeBlockNode(Node t, @Nullable Analysis<A,S,T> analysis)
CFGVisualizer
t
- the nodeanalysis
- the current analysispublic java.lang.String visualizeStoreThisVal(A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of the current
object this
in this Store.value
- the value of the current object this
this
public java.lang.String visualizeStoreLocalVar(FlowExpressions.LocalVariable localVar, A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize a local variable.localVar
- the local variablevalue
- the value of the local variablepublic java.lang.String visualizeStoreFieldVals(FlowExpressions.FieldAccess fieldAccess, A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of fields
collected by this Store.fieldAccess
- the fieldvalue
- the value of the fieldpublic java.lang.String visualizeStoreArrayVal(FlowExpressions.ArrayAccess arrayValue, A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of arrays
collected by this Store.arrayValue
- the arrayvalue
- the value of the arraypublic java.lang.String visualizeStoreMethodVals(FlowExpressions.MethodCall methodCall, A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of pure method
calls collected by this Store.methodCall
- the pure method callvalue
- the value of the pure method callpublic java.lang.String visualizeStoreClassVals(FlowExpressions.ClassName className, A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of class names
collected by this Store.className
- the class namevalue
- the value of the class namepublic java.lang.String visualizeStoreKeyVal(java.lang.String keyName, java.lang.Object value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the specific information
collected according to the specific kind of Store. Currently, these Stores call this method:
LockStore
, NullnessStore
, and InitializationStore
to visualize
additional information.keyName
- the name of the specific information to be visualizedvalue
- the value of the specific information to be visualizedpublic java.lang.String visualizeStoreHeader(java.lang.String classCanonicalName)
CFGVisualizer
CFAbstractStore
to visualize the class name before calling the CFAbstractStore#internalVisualize()
method.classCanonicalName
- the canonical name of the classpublic java.lang.String visualizeStoreFooter()
CFGVisualizer
CFAbstractStore
to visualize any information after the invocation of CFAbstractStore#internalVisualize()
.public void shutdown()
methods.txt
that contains a mapping from source code location to
generated dot file.protected java.lang.String visualizeGraphHeader()
AbstractCFGVisualizer
visualizeGraphHeader
in class AbstractCFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
protected java.lang.String visualizeGraphFooter()
AbstractCFGVisualizer
visualizeGraphFooter
in class AbstractCFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>