A - type of the abstract value that is trackedpublic class AnalysisResult<A extends AbstractValue<A>,S extends Store<S>> extends Object
AnalysisResult represents the result of a org.checkerframework.dataflow analysis by
providing the abstract values given a node or a tree. Note that it does not keep track of custom
results computed by some analysis.| Modifier and Type | Field and Description |
|---|---|
protected Map<TransferInput<A,S>,IdentityHashMap<Node,TransferResult<A,S>>> |
analysisCaches
Caches of the analysis results for each input for the block of the node and each node.
|
protected HashMap<Element,A> |
finalLocalValues
Map from (effectively final) local variable elements to their abstract value.
|
protected IdentityHashMap<Node,A> |
nodeValues
Abstract values of nodes.
|
protected IdentityHashMap<Block,TransferInput<A,S>> |
stores
The stores before every method call.
|
protected IdentityHashMap<Tree,Set<Node>> |
treeLookup
|
protected IdentityHashMap<UnaryTree,AssignmentNode> |
unaryAssignNodeLookup
Map from AST
UnaryTrees to corresponding AssignmentNodes. |
| Modifier | Constructor and Description |
|---|---|
|
AnalysisResult(Map<Node,A> nodeValues,
IdentityHashMap<Block,TransferInput<A,S>> stores,
IdentityHashMap<Tree,Set<Node>> treeLookup,
IdentityHashMap<UnaryTree,AssignmentNode> unaryAssignNodeLookup,
HashMap<Element,A> finalLocalValues)
Initialize with given mappings and empty cache.
|
protected |
AnalysisResult(Map<Node,A> nodeValues,
IdentityHashMap<Block,TransferInput<A,S>> stores,
IdentityHashMap<Tree,Set<Node>> treeLookup,
IdentityHashMap<UnaryTree,AssignmentNode> unaryAssignNodeLookup,
HashMap<Element,A> finalLocalValues,
Map<TransferInput<A,S>,IdentityHashMap<Node,TransferResult<A,S>>> analysisCaches)
Initialize with given mappings.
|
|
AnalysisResult(Map<TransferInput<A,S>,IdentityHashMap<Node,TransferResult<A,S>>> analysisCaches)
Initialize empty result with specified cache.
|
| Modifier and Type | Method and Description |
|---|---|
void |
combine(AnalysisResult<A,S> other)
Combine with another analysis result.
|
AssignmentNode |
getAssignForUnaryTree(UnaryTree tree) |
HashMap<Element,A> |
getFinalLocalValues() |
@Nullable Set<Node> |
getNodesForTree(Tree tree)
Returns the
Nodes corresponding to a particular Tree. |
S |
getStoreAfter(Node node) |
S |
getStoreAfter(Tree tree) |
S |
getStoreBefore(Node node) |
S |
getStoreBefore(Tree tree) |
A |
getValue(Node n) |
A |
getValue(Tree t) |
protected S |
runAnalysisFor(Node node,
boolean before)
Runs the analysis again within the block of
node and returns the store at the
location of node. |
static <A extends AbstractValue<A>,S extends Store<S>> |
runAnalysisFor(Node node,
boolean before,
TransferInput<A,S> transferInput,
IdentityHashMap<Node,A> nodeValues,
Map<TransferInput<A,S>,IdentityHashMap<Node,TransferResult<A,S>>> analysisCaches)
Runs the analysis again within the block of
node and returns the store at the
location of node. |
protected final IdentityHashMap<Node,A extends AbstractValue<A>> nodeValues
protected final IdentityHashMap<Tree,Set<Node>> treeLookup
protected final IdentityHashMap<UnaryTree,AssignmentNode> unaryAssignNodeLookup
UnaryTrees to corresponding AssignmentNodes.protected final HashMap<Element,A extends AbstractValue<A>> finalLocalValues
protected final IdentityHashMap<Block,TransferInput<A extends AbstractValue<A>,S extends Store<S>>> stores
protected final Map<TransferInput<A extends AbstractValue<A>,S extends Store<S>>,IdentityHashMap<Node,TransferResult<A extends AbstractValue<A>,S extends Store<S>>>> analysisCaches
protected AnalysisResult(Map<Node,A> nodeValues, IdentityHashMap<Block,TransferInput<A,S>> stores, IdentityHashMap<Tree,Set<Node>> treeLookup, IdentityHashMap<UnaryTree,AssignmentNode> unaryAssignNodeLookup, HashMap<Element,A> finalLocalValues, Map<TransferInput<A,S>,IdentityHashMap<Node,TransferResult<A,S>>> analysisCaches)
public AnalysisResult(Map<Node,A> nodeValues, IdentityHashMap<Block,TransferInput<A,S>> stores, IdentityHashMap<Tree,Set<Node>> treeLookup, IdentityHashMap<UnaryTree,AssignmentNode> unaryAssignNodeLookup, HashMap<Element,A> finalLocalValues)
public AnalysisResult(Map<TransferInput<A,S>,IdentityHashMap<Node,TransferResult<A,S>>> analysisCaches)
public void combine(AnalysisResult<A,S> other)
public HashMap<Element,A> getFinalLocalValues()
public A getValue(Node n)
Node n, or null if no information is
available.public A getValue(Tree t)
Tree t, or null if no information is
available.public @Nullable Set<Node> getNodesForTree(Tree tree)
Nodes corresponding to a particular Tree. Multiple Nodes
can correspond to a single Tree because of several reasons:
() -> 5 the 5 is both an IntegerLiteralNode and a LambdaResultExpressionNode.
NarrowingConversionNode and WideningConversionNode.
StringConversionNode.
finally blocks are cloned to achieve a precise CFG. Any Tree
within a finally block can have multiple corresponding Nodes attached to them.
Nodes they are not interested in.public AssignmentNode getAssignForUnaryTree(UnaryTree tree)
AssignmentNode for a given UnaryTree.public S getStoreBefore(Tree tree)
Tree.public S getStoreBefore(Node node)
Node.protected S runAnalysisFor(Node node, boolean before)
node and returns the store at the
location of node. If before is true, then the store immediately before the
Node node is returned. Otherwise, the store after node is returned.
If the given Node cannot be reached (in the control flow graph), then null
is returned.
public static <A extends AbstractValue<A>,S extends Store<S>> S runAnalysisFor(Node node, boolean before, TransferInput<A,S> transferInput, IdentityHashMap<Node,A> nodeValues, Map<TransferInput<A,S>,IdentityHashMap<Node,TransferResult<A,S>>> analysisCaches)
node and returns the store at the
location of node. If before is true, then the store immediately before the
Node node is returned. Otherwise, the store after node is returned.
If analysisCaches is not null, this method uses a cache. analysisCaches is a
map to a cache for analysis result from an input of the block of the node. If the cache for
transferInput is not in analysisCaches, this method create new cache and
store it in analysisCaches. The cache is a map from a node to the analysis result of
the node.