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
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final BaseTypeCheckerThe associated checker.protected final AnnotatedTypeFactoryType factory to provide types used during CFG building.Fields inherited from class org.checkerframework.dataflow.cfg.builder.CFGTranslationPhaseOne
annotationProvider, arithmeticExceptionType, arrayAccessExceptionTypes, arrayIndexOutOfBoundsExceptionType, assertionErrorType, assumeAssertionsDisabled, assumeAssertionsEnabled, classCastExceptionType, classCircularityErrorType, classFormatErrorType, ea, elements, env, iterableType, negativeArraySizeExceptionType, newArrayExceptionTypes, noClassDefFoundErrorType, nullPointerExceptionType, outOfMemoryErrorType, stringType, treeBuilder, trees, types, uid, uncheckedExceptionTypes -
Constructor Summary
ConstructorsConstructorDescriptionCFCFGTranslationPhaseOne(CFTreeBuilder builder, BaseTypeChecker checker, AnnotatedTypeFactory factory, boolean assumeAssertionsEnabled, boolean assumeAssertionsDisabled, ProcessingEnvironment env) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanReturns true if assertions should be assumed to be executed for a givenAssertTree.protected VariableTreecreateEnhancedForLoopArrayVariable(ExpressionTree expression, VariableElement variableElement) Returns the declaration of a new, uniquely named variable that holds the array of an enhanced for loop over an array.protected VariableTreecreateEnhancedForLoopIteratorVariable(MethodInvocationTree iteratorCall, VariableElement variableElement) Returns the declaration of a new, uniquely named variable that holds the iterator of an enhanced for loop over anIterable.voidhandleArtificialTree(Tree tree) Performs any actions required when CFG translation creates a new Tree that is not part of the original AST.Methods inherited from class org.checkerframework.dataflow.cfg.builder.CFGTranslationPhaseOne
addLabelForNextNode, addToImplicitlyConvertedLookupMap, addToImplicitlyConvertedLookupMap, addToLookupMap, assignConvert, binaryNumericPromotion, binaryPromotedType, box, commonConvert, conditionalExprPromotion, convertCallArguments, convertNarrowableConstant, extendWithClassNameNode, extendWithExtendedNode, extendWithNode, extendWithNodeWithException, extendWithNodeWithExceptions, getAssertionsEnabledVariable, getAssertMethodTuple, getCurrentPath, getLabel, getTypeMirror, insertExtendedNodeAfter, insertNodeAfter, insertNodeWithExceptionsAfter, isNarrowableConstantConversion, isNumericOrBoxed, maybeGetTypeMirror, methodInvocationConvert, narrow, narrowAndBox, process, process, scan, stringConversion, translateAssertWithAssertionsEnabled, translateAssignment, translateAssignment, treatMethodAsAssert, unaryNumericPromotion, unbox, uniqueName, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBinary, visitBindingPattern, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDeconstructionPattern21, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitMethod, visitMethodInvocation, visitModifiers, visitNewArray, visitNewClass, visitOther, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitReturn, visitSwitch, visitSwitchExpression, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitVariable, visitWhileLoop, visitWildcard, visitYield, widen, withoutAssignmentMethods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitAnyPattern, visitConstantCaseLabel, visitDeconstructionPattern, visitDefaultCaseLabel, visitExports, visitIntersectionType, visitModule, visitOpens, visitPackage, visitPatternCaseLabel, visitProvides, visitRequires, visitStringTemplate, visitUses
-
Field Details
-
checker
The associated checker. -
factory
Type factory to provide types used during CFG building.
-
-
Constructor Details
-
CFCFGTranslationPhaseOne
public CFCFGTranslationPhaseOne(CFTreeBuilder builder, BaseTypeChecker checker, AnnotatedTypeFactory factory, boolean assumeAssertionsEnabled, boolean assumeAssertionsDisabled, ProcessingEnvironment env)
-
-
Method Details
-
assumeAssertionsEnabledFor
Description copied from class:CFGTranslationPhaseOneReturns true if assertions should be assumed to be executed for a givenAssertTree. False by default.- Overrides:
assumeAssertionsEnabledForin classCFGTranslationPhaseOne- Parameters:
tree- an assert tree- Returns:
- true if assertions should be assumed to be executed for
tree
-
handleArtificialTree
Description copied from class:CFGTranslationPhaseOnePerforms any actions required when CFG translation creates a new Tree that is not part of the original AST.- Overrides:
handleArtificialTreein classCFGTranslationPhaseOne- Parameters:
tree- the newly created Tree
-
createEnhancedForLoopIteratorVariable
protected VariableTree createEnhancedForLoopIteratorVariable(MethodInvocationTree iteratorCall, VariableElement variableElement) Description copied from class:CFGTranslationPhaseOneReturns the declaration of a new, uniquely named variable that holds the iterator of an enhanced for loop over anIterable.- Overrides:
createEnhancedForLoopIteratorVariablein classCFGTranslationPhaseOne- Parameters:
iteratorCall- a call toiterator()on the iterable expression of an enhanced for loop; the call initializes the new variablevariableElement- 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:CFGTranslationPhaseOneReturns the declaration of a new, uniquely named variable that holds the array of an enhanced for loop over an array.- Overrides:
createEnhancedForLoopArrayVariablein classCFGTranslationPhaseOne- Parameters:
expression- the expression, of array type, that an enhanced for loop iterates over; the expression initializes the new variablevariableElement- 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
-