Search in sources :

Example 1 with EqualToNode

use of org.checkerframework.dataflow.cfg.node.EqualToNode in project bazel by bazelbuild.

the class ConstantPropagationTransfer method visitEqualTo.

@Override
public TransferResult<Constant, ConstantPropagationStore> visitEqualTo(EqualToNode n, TransferInput<Constant, ConstantPropagationStore> pi) {
    ConstantPropagationStore p = pi.getRegularStore();
    ConstantPropagationStore old = p.copy();
    Node left = n.getLeftOperand();
    Node right = n.getRightOperand();
    process(p, left, right);
    process(p, right, left);
    return new ConditionalTransferResult<>(null, p, old);
}
Also used : ConditionalTransferResult(org.checkerframework.dataflow.analysis.ConditionalTransferResult) 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)

Example 2 with EqualToNode

use of org.checkerframework.dataflow.cfg.node.EqualToNode in project checker-framework by typetools.

the class CFAbstractTransfer method visitEqualTo.

@Override
public TransferResult<V, S> visitEqualTo(EqualToNode n, TransferInput<V, S> p) {
    TransferResult<V, S> res = super.visitEqualTo(n, p);
    Node leftN = n.getLeftOperand();
    Node rightN = n.getRightOperand();
    V leftV = p.getValueOfSubNode(leftN);
    V rightV = p.getValueOfSubNode(rightN);
    // if annotations differ, use the one that is more precise for both
    // sides (and add it to the store if possible)
    res = strengthenAnnotationOfEqualTo(res, leftN, rightN, leftV, rightV, false);
    res = strengthenAnnotationOfEqualTo(res, rightN, leftN, rightV, leftV, false);
    return res;
}
Also used : ThisLiteralNode(org.checkerframework.dataflow.cfg.node.ThisLiteralNode) StringConversionNode(org.checkerframework.dataflow.cfg.node.StringConversionNode) WideningConversionNode(org.checkerframework.dataflow.cfg.node.WideningConversionNode) ClassNameNode(org.checkerframework.dataflow.cfg.node.ClassNameNode) ObjectCreationNode(org.checkerframework.dataflow.cfg.node.ObjectCreationNode) LocalVariableNode(org.checkerframework.dataflow.cfg.node.LocalVariableNode) NarrowingConversionNode(org.checkerframework.dataflow.cfg.node.NarrowingConversionNode) EqualToNode(org.checkerframework.dataflow.cfg.node.EqualToNode) VariableDeclarationNode(org.checkerframework.dataflow.cfg.node.VariableDeclarationNode) TernaryExpressionNode(org.checkerframework.dataflow.cfg.node.TernaryExpressionNode) AssignmentNode(org.checkerframework.dataflow.cfg.node.AssignmentNode) CaseNode(org.checkerframework.dataflow.cfg.node.CaseNode) FieldAccessNode(org.checkerframework.dataflow.cfg.node.FieldAccessNode) NotEqualNode(org.checkerframework.dataflow.cfg.node.NotEqualNode) ArrayAccessNode(org.checkerframework.dataflow.cfg.node.ArrayAccessNode) ConditionalNotNode(org.checkerframework.dataflow.cfg.node.ConditionalNotNode) ReturnNode(org.checkerframework.dataflow.cfg.node.ReturnNode) MethodInvocationNode(org.checkerframework.dataflow.cfg.node.MethodInvocationNode) StringConcatenateAssignmentNode(org.checkerframework.dataflow.cfg.node.StringConcatenateAssignmentNode) Node(org.checkerframework.dataflow.cfg.node.Node)

Example 3 with EqualToNode

use of org.checkerframework.dataflow.cfg.node.EqualToNode in project checker-framework by typetools.

the class ConstantPropagationTransfer method visitEqualTo.

@Override
public TransferResult<Constant, ConstantPropagationStore> visitEqualTo(EqualToNode n, TransferInput<Constant, ConstantPropagationStore> pi) {
    ConstantPropagationStore p = pi.getRegularStore();
    ConstantPropagationStore old = p.copy();
    Node left = n.getLeftOperand();
    Node right = n.getRightOperand();
    process(p, left, right);
    process(p, right, left);
    return new ConditionalTransferResult<>(null, p, old);
}
Also used : ConditionalTransferResult(org.checkerframework.dataflow.analysis.ConditionalTransferResult) 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)

Aggregations

AssignmentNode (org.checkerframework.dataflow.cfg.node.AssignmentNode)3 EqualToNode (org.checkerframework.dataflow.cfg.node.EqualToNode)3 LocalVariableNode (org.checkerframework.dataflow.cfg.node.LocalVariableNode)3 Node (org.checkerframework.dataflow.cfg.node.Node)3 ConditionalTransferResult (org.checkerframework.dataflow.analysis.ConditionalTransferResult)2 IntegerLiteralNode (org.checkerframework.dataflow.cfg.node.IntegerLiteralNode)2 ArrayAccessNode (org.checkerframework.dataflow.cfg.node.ArrayAccessNode)1 CaseNode (org.checkerframework.dataflow.cfg.node.CaseNode)1 ClassNameNode (org.checkerframework.dataflow.cfg.node.ClassNameNode)1 ConditionalNotNode (org.checkerframework.dataflow.cfg.node.ConditionalNotNode)1 FieldAccessNode (org.checkerframework.dataflow.cfg.node.FieldAccessNode)1 MethodInvocationNode (org.checkerframework.dataflow.cfg.node.MethodInvocationNode)1 NarrowingConversionNode (org.checkerframework.dataflow.cfg.node.NarrowingConversionNode)1 NotEqualNode (org.checkerframework.dataflow.cfg.node.NotEqualNode)1 ObjectCreationNode (org.checkerframework.dataflow.cfg.node.ObjectCreationNode)1 ReturnNode (org.checkerframework.dataflow.cfg.node.ReturnNode)1 StringConcatenateAssignmentNode (org.checkerframework.dataflow.cfg.node.StringConcatenateAssignmentNode)1 StringConversionNode (org.checkerframework.dataflow.cfg.node.StringConversionNode)1 TernaryExpressionNode (org.checkerframework.dataflow.cfg.node.TernaryExpressionNode)1 ThisLiteralNode (org.checkerframework.dataflow.cfg.node.ThisLiteralNode)1