Search in sources :

Example 1 with CaseNode

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

the class UpperBoundTransfer method visitCase.

@Override
public TransferResult<CFValue, CFStore> visitCase(CaseNode n, TransferInput<CFValue, CFStore> in) {
    TransferResult<CFValue, CFStore> result = super.visitCase(n, in);
    // Refines subtrahend in the switch expression
    // TODO: this cannot be done in strengthenAnnotationOfEqualTo, because that does not provide transfer input
    Node caseNode = n.getCaseOperand();
    AssignmentNode assign = (AssignmentNode) n.getSwitchOperand();
    Node switchNode = assign.getExpression();
    refineSubtrahendWithOffset(switchNode, caseNode, false, in, result.getThenStore());
    return result;
}
Also used : CFValue(org.checkerframework.framework.flow.CFValue) CFStore(org.checkerframework.framework.flow.CFStore) AssignmentNode(org.checkerframework.dataflow.cfg.node.AssignmentNode) TypeCastNode(org.checkerframework.dataflow.cfg.node.TypeCastNode) NumericalMultiplicationNode(org.checkerframework.dataflow.cfg.node.NumericalMultiplicationNode) ArrayCreationNode(org.checkerframework.dataflow.cfg.node.ArrayCreationNode) AssignmentNode(org.checkerframework.dataflow.cfg.node.AssignmentNode) CaseNode(org.checkerframework.dataflow.cfg.node.CaseNode) FieldAccessNode(org.checkerframework.dataflow.cfg.node.FieldAccessNode) NumericalAdditionNode(org.checkerframework.dataflow.cfg.node.NumericalAdditionNode) NumericalSubtractionNode(org.checkerframework.dataflow.cfg.node.NumericalSubtractionNode) MethodInvocationNode(org.checkerframework.dataflow.cfg.node.MethodInvocationNode) Node(org.checkerframework.dataflow.cfg.node.Node)

Aggregations

ArrayCreationNode (org.checkerframework.dataflow.cfg.node.ArrayCreationNode)1 AssignmentNode (org.checkerframework.dataflow.cfg.node.AssignmentNode)1 CaseNode (org.checkerframework.dataflow.cfg.node.CaseNode)1 FieldAccessNode (org.checkerframework.dataflow.cfg.node.FieldAccessNode)1 MethodInvocationNode (org.checkerframework.dataflow.cfg.node.MethodInvocationNode)1 Node (org.checkerframework.dataflow.cfg.node.Node)1 NumericalAdditionNode (org.checkerframework.dataflow.cfg.node.NumericalAdditionNode)1 NumericalMultiplicationNode (org.checkerframework.dataflow.cfg.node.NumericalMultiplicationNode)1 NumericalSubtractionNode (org.checkerframework.dataflow.cfg.node.NumericalSubtractionNode)1 TypeCastNode (org.checkerframework.dataflow.cfg.node.TypeCastNode)1 CFStore (org.checkerframework.framework.flow.CFStore)1 CFValue (org.checkerframework.framework.flow.CFValue)1