Search in sources :

Example 16 with RegularTransferResult

use of org.checkerframework.dataflow.analysis.RegularTransferResult in project checker-framework by typetools.

the class LiveVarTransfer method visitObjectCreation.

@Override
public RegularTransferResult<LiveVarValue, LiveVarStore> visitObjectCreation(ObjectCreationNode n, TransferInput<LiveVarValue, LiveVarStore> p) {
    RegularTransferResult<LiveVarValue, LiveVarStore> transferResult = (RegularTransferResult<LiveVarValue, LiveVarStore>) super.visitObjectCreation(n, p);
    LiveVarStore store = transferResult.getRegularStore();
    for (Node arg : n.getArguments()) {
        store.addUseInExpression(arg);
    }
    return transferResult;
}
Also used : ObjectCreationNode(org.checkerframework.dataflow.cfg.node.ObjectCreationNode) ReturnNode(org.checkerframework.dataflow.cfg.node.ReturnNode) MethodInvocationNode(org.checkerframework.dataflow.cfg.node.MethodInvocationNode) AssignmentNode(org.checkerframework.dataflow.cfg.node.AssignmentNode) StringConcatenateAssignmentNode(org.checkerframework.dataflow.cfg.node.StringConcatenateAssignmentNode) Node(org.checkerframework.dataflow.cfg.node.Node) RegularTransferResult(org.checkerframework.dataflow.analysis.RegularTransferResult)

Example 17 with RegularTransferResult

use of org.checkerframework.dataflow.analysis.RegularTransferResult in project checker-framework by typetools.

the class ConstantPropagationTransfer method visitAssignment.

@Override
public TransferResult<Constant, ConstantPropagationStore> visitAssignment(AssignmentNode n, TransferInput<Constant, ConstantPropagationStore> pi) {
    ConstantPropagationStore p = pi.getRegularStore();
    Node target = n.getTarget();
    Constant info = null;
    if (target instanceof LocalVariableNode) {
        LocalVariableNode t = (LocalVariableNode) target;
        info = p.getInformation(n.getExpression());
        p.setInformation(t, info);
    }
    return new RegularTransferResult<>(info, p);
}
Also used : IntegerLiteralNode(org.checkerframework.dataflow.cfg.node.IntegerLiteralNode) AssignmentNode(org.checkerframework.dataflow.cfg.node.AssignmentNode) LocalVariableNode(org.checkerframework.dataflow.cfg.node.LocalVariableNode) EqualToNode(org.checkerframework.dataflow.cfg.node.EqualToNode) Node(org.checkerframework.dataflow.cfg.node.Node) LocalVariableNode(org.checkerframework.dataflow.cfg.node.LocalVariableNode) RegularTransferResult(org.checkerframework.dataflow.analysis.RegularTransferResult)

Example 18 with RegularTransferResult

use of org.checkerframework.dataflow.analysis.RegularTransferResult in project checker-framework by typetools.

the class ValueTransfer method stringConcatenation.

public TransferResult<CFValue, CFStore> stringConcatenation(Node leftOperand, Node rightOperand, TransferInput<CFValue, CFStore> p, TransferResult<CFValue, CFStore> result) {
    AnnotationMirror resultAnno = createAnnotationForStringConcatenation(leftOperand, rightOperand, p);
    TypeMirror underlyingType = result.getResultValue().getUnderlyingType();
    CFValue newResultValue = analysis.createSingleAnnotationValue(resultAnno, underlyingType);
    return new RegularTransferResult<>(newResultValue, result.getRegularStore());
}
Also used : CFValue(org.checkerframework.framework.flow.CFValue) AnnotationMirror(javax.lang.model.element.AnnotationMirror) TypeMirror(javax.lang.model.type.TypeMirror) RegularTransferResult(org.checkerframework.dataflow.analysis.RegularTransferResult)

Aggregations

RegularTransferResult (org.checkerframework.dataflow.analysis.RegularTransferResult)18 AssignmentNode (org.checkerframework.dataflow.cfg.node.AssignmentNode)8 Node (org.checkerframework.dataflow.cfg.node.Node)8 AnnotationMirror (javax.lang.model.element.AnnotationMirror)7 MethodInvocationNode (org.checkerframework.dataflow.cfg.node.MethodInvocationNode)6 ObjectCreationNode (org.checkerframework.dataflow.cfg.node.ObjectCreationNode)6 CFValue (org.checkerframework.framework.flow.CFValue)6 ReturnNode (org.checkerframework.dataflow.cfg.node.ReturnNode)5 StringConcatenateAssignmentNode (org.checkerframework.dataflow.cfg.node.StringConcatenateAssignmentNode)5 JavaExpression (org.checkerframework.dataflow.expression.JavaExpression)5 Tree (com.sun.source.tree.Tree)4 EqualToNode (org.checkerframework.dataflow.cfg.node.EqualToNode)4 LocalVariableNode (org.checkerframework.dataflow.cfg.node.LocalVariableNode)4 CFStore (org.checkerframework.framework.flow.CFStore)4 ClassTree (com.sun.source.tree.ClassTree)3 MethodTree (com.sun.source.tree.MethodTree)3 ExpressionTree (com.sun.source.tree.ExpressionTree)2 ConditionalTransferResult (org.checkerframework.dataflow.analysis.ConditionalTransferResult)2 ArrayAccessNode (org.checkerframework.dataflow.cfg.node.ArrayAccessNode)2 CaseNode (org.checkerframework.dataflow.cfg.node.CaseNode)2