Class CFCFGBuilder.CFCFGTranslationPhaseOne

java.lang.Object
com.sun.source.util.TreeScanner<Node,Void>
org.checkerframework.dataflow.cfg.builder.CFGTranslationPhaseOne
org.checkerframework.framework.flow.CFCFGBuilder.CFCFGTranslationPhaseOne
All Implemented Interfaces:
TreeVisitor<Node,Void>
Enclosing class:
CFCFGBuilder

protected static class CFCFGBuilder.CFCFGTranslationPhaseOne extends CFGTranslationPhaseOne
A specialized phase-one CFG builder, with a few modifications that make use of the type factory. It is responsible for: 1) translating foreach loops so that the declarations of their iteration variables have the right annotations, 2) registering the containing elements of artificial trees with the relevant type factories, and 3) generating appropriate assertion CFG structure in the presence of @AssumeAssertion assertion strings which mention the checker or its supercheckers.
  • Field Details

    • checker

      protected final BaseTypeChecker checker
      The associated checker.
    • factory

      protected final AnnotatedTypeFactory factory
      Type factory to provide types used during CFG building.
  • Constructor Details

  • Method Details

    • assumeAssertionsEnabledFor

      protected boolean assumeAssertionsEnabledFor(AssertTree tree)
      Description copied from class: CFGTranslationPhaseOne
      Returns true if assertions should be assumed to be executed for a given AssertTree. False by default.
      Overrides:
      assumeAssertionsEnabledFor in class CFGTranslationPhaseOne
      Parameters:
      tree - an assert tree
      Returns:
      true if assertions should be assumed to be executed for tree
    • handleArtificialTree

      public void handleArtificialTree(Tree tree)
      Description copied from class: CFGTranslationPhaseOne
      Performs any actions required when CFG translation creates a new Tree that is not part of the original AST.
      Overrides:
      handleArtificialTree in class CFGTranslationPhaseOne
      Parameters:
      tree - the newly created Tree
    • createEnhancedForLoopIteratorVariable

      protected VariableTree createEnhancedForLoopIteratorVariable(MethodInvocationTree iteratorCall, VariableElement variableElement)
      Description copied from class: CFGTranslationPhaseOne
      Returns the declaration of a new, uniquely named variable that holds the iterator of an enhanced for loop over an Iterable.
      Overrides:
      createEnhancedForLoopIteratorVariable in class CFGTranslationPhaseOne
      Parameters:
      iteratorCall - a call to iterator() on the iterable expression of an enhanced for loop; the call initializes the new variable
      variableElement - the element of the loop variable of the enhanced for loop; the new variable has the same enclosing element
      Returns:
      the declaration of the new iterator variable
    • createEnhancedForLoopArrayVariable

      protected VariableTree createEnhancedForLoopArrayVariable(ExpressionTree expression, VariableElement variableElement)
      Description copied from class: CFGTranslationPhaseOne
      Returns the declaration of a new, uniquely named variable that holds the array of an enhanced for loop over an array.
      Overrides:
      createEnhancedForLoopArrayVariable in class CFGTranslationPhaseOne
      Parameters:
      expression - the expression, of array type, that an enhanced for loop iterates over; the expression initializes the new variable
      variableElement - the element of the loop variable of the enhanced for loop; the new variable has the same enclosing element
      Returns:
      the declaration of the new array variable