Class AliasingTransfer
java.lang.Object
org.checkerframework.dataflow.cfg.node.AbstractNodeVisitor<TransferResult<CFValue,CFStore>,TransferInput<CFValue,CFStore>>
org.checkerframework.framework.flow.CFAbstractTransfer<CFValue,CFStore,CFTransfer>
org.checkerframework.framework.flow.CFTransfer
org.checkerframework.common.aliasing.AliasingTransfer
- All Implemented Interfaces:
ForwardTransferFunction<CFValue,,CFStore> TransferFunction<CFValue,,CFStore> NodeVisitor<TransferResult<CFValue,CFStore>, TransferInput<CFValue, CFStore>>
Type refinement is treated in the usual way, except that at (pseudo-)assignments the RHS might
lose its type refinement, before the LHS is type-refined.
The RHS always loses its type refinement (it is widened to @MaybeAliased, and its declared type must have been @MaybeAliased) except in the following cases:
- The RHS is a fresh expression.
- The LHS is a @NonLeaked formal parameter and the RHS is an argument in a method call or constructor invocation.
- The LHS is a @LeakedToResult formal parameter, the RHS is an argument in a method call or constructor invocation, and the method's return value is discarded.
-
Field Summary
Fields inherited from class org.checkerframework.framework.flow.CFAbstractTransfer
analysis, sequentialSemantics -
Constructor Summary
ConstructorsConstructorDescriptionAliasingTransfer(CFAbstractAnalysis<CFValue, CFStore, CFTransfer> analysis) Creates a new AliasingTransfer. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprocessCommonAssignment(TransferInput<CFValue, CFStore> in, Node lhs, Node rhs, CFStore store, CFValue rhsValue) If the RHS is not a fresh@Uniqueexpression, widens the LHS and the RHS, which are aliases of one another, in the store.protected voidprocessPostconditions(Node n, CFStore store, ExecutableElement executableElement, ExpressionTree tree) Handles pseudo-assignments.Case 1: For every assignment, the LHS is refined if the RHS has type@Uniqueand is a method or constructor invocation.Case 3: Given a method invocation expression, if the parent of the expression is not a statement, checks whether any arguments of the method call are annotated as @LeakedToResult and removes them from the store, since they might be leaked.Methods inherited from class org.checkerframework.framework.flow.CFAbstractTransfer
addInformationFromPreconditions, createTransferResult, createTransferResult, finishValue, finishValue, getNarrowedValue, getValueFromFactory, getWidenedValue, initialStore, insertIntoStores, insertIntoStoresPermitNonDeterministic, isNotFullyInitializedReceiver, moreSpecificValue, processConditionalPostconditions, recreateTransferResult, recreateTransferResult, refineCaseLabelBindingVariable, setFixedInitialStore, shouldPerformWholeProgramInference, shouldPerformWholeProgramInference, splitAssignments, strengthenAnnotationOfEqualTo, usesSequentialSemantics, visitAnyPattern, visitArrayAccess, visitCase, visitClassName, visitConditionalNot, visitDeconstructorPattern, visitEqualTo, visitExpressionStatement, visitFieldAccess, visitInstanceOf, visitLambdaResultExpression, visitLocalVariable, visitNarrowingConversion, visitNode, visitNotEqual, visitObjectCreation, visitReturn, visitStringConversion, visitSwitchExpressionNode, visitTernaryExpression, visitThis, visitVariableDeclaration, visitWideningConversionMethods inherited from class org.checkerframework.dataflow.cfg.node.AbstractNodeVisitor
visitArrayCreation, visitArrayType, visitAssertionError, visitBitwiseAnd, visitBitwiseComplement, visitBitwiseOr, visitBitwiseXor, visitBooleanLiteral, visitCharacterLiteral, visitClassDeclaration, visitConditionalAnd, visitConditionalOr, visitDoubleLiteral, visitExplicitThis, visitFloatingDivision, visitFloatingRemainder, visitFloatLiteral, visitGreaterThan, visitGreaterThanOrEqual, visitImplicitThis, visitIntegerDivision, visitIntegerLiteral, visitIntegerRemainder, visitLeftShift, visitLessThan, visitLessThanOrEqual, visitLongLiteral, visitMarker, visitMemberReference, visitMethodAccess, visitNullChk, visitNullLiteral, visitNumericalAddition, visitNumericalMinus, visitNumericalMultiplication, visitNumericalPlus, visitNumericalSubtraction, visitPackageName, visitParameterizedType, visitPrimitiveType, visitShortLiteral, visitSignedRightShift, visitStringConcatenate, visitStringLiteral, visitSuper, visitSynchronized, visitThrow, visitTypeCast, visitUnsignedRightShift, visitValueLiteralMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.checkerframework.dataflow.cfg.node.NodeVisitor
visitArrayCreation, visitArrayType, visitAssertionError, visitBitwiseAnd, visitBitwiseComplement, visitBitwiseOr, visitBitwiseXor, visitBooleanLiteral, visitCharacterLiteral, visitClassDeclaration, visitConditionalAnd, visitConditionalOr, visitDoubleLiteral, visitExplicitThis, visitFloatingDivision, visitFloatingRemainder, visitFloatLiteral, visitGreaterThan, visitGreaterThanOrEqual, visitImplicitThis, visitIntegerDivision, visitIntegerLiteral, visitIntegerRemainder, visitLeftShift, visitLessThan, visitLessThanOrEqual, visitLongLiteral, visitMarker, visitMemberReference, visitMethodAccess, visitNullChk, visitNullLiteral, visitNumericalAddition, visitNumericalMinus, visitNumericalMultiplication, visitNumericalPlus, visitNumericalSubtraction, visitPackageName, visitParameterizedType, visitPrimitiveType, visitShortLiteral, visitSignedRightShift, visitStringConcatenate, visitStringLiteral, visitSuper, visitSynchronized, visitThrow, visitTypeCast, visitUnsignedRightShift
-
Constructor Details
-
AliasingTransfer
Creates a new AliasingTransfer.- Parameters:
analysis- the CFAbstractAnalysis
-
-
Method Details
-
visitAssignment
public TransferResult<CFValue,CFStore> visitAssignment(AssignmentNode n, TransferInput<CFValue, CFStore> in) Case 1: For every assignment, the LHS is refined if the RHS has type@Uniqueand is a method or constructor invocation. Otherwise, neither the LHS nor the RHS keeps a refinement, nor does any expression that depends on the LHS or might alias it; seeprocessCommonAssignment(org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue, org.checkerframework.framework.flow.CFStore>, org.checkerframework.dataflow.cfg.node.Node, org.checkerframework.dataflow.cfg.node.Node, org.checkerframework.framework.flow.CFStore, org.checkerframework.framework.flow.CFValue).- Specified by:
visitAssignmentin interfaceNodeVisitor<TransferResult<CFValue,CFStore>, TransferInput<CFValue, CFStore>> - Overrides:
visitAssignmentin classCFAbstractTransfer<CFValue,CFStore, CFTransfer>
-
processCommonAssignment
protected void processCommonAssignment(TransferInput<CFValue, CFStore> in, Node lhs, Node rhs, CFStore store, CFValue rhsValue) If the RHS is not a fresh@Uniqueexpression, widens the LHS and the RHS, which are aliases of one another, in the store. Widening the LHS also removes the refinements of expressions in the store that depend on the LHS or that might alias it, such asx.fafter an assignment tox. The value of the assignment expression is also an alias, but the store cannot represent it;visitAssignment(org.checkerframework.dataflow.cfg.node.AssignmentNode, org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue, org.checkerframework.framework.flow.CFStore>)discards that value.- Overrides:
processCommonAssignmentin classCFAbstractTransfer<CFValue,CFStore, CFTransfer> - Parameters:
in- the store(s) before the assignmentlhs- the left-hand side of the assignmentrhs- the right-hand side of the assignmentstore- the regular input store (fromin)rhsValue- the value of the right-hand side of the assignment
-
processPostconditions
protected void processPostconditions(Node n, CFStore store, ExecutableElement executableElement, ExpressionTree tree) Handles pseudo-assignments. Called byCFAbstractTransfer.visitMethodInvocation().Case 2: Given a method call, traverses all formal parameters of the method declaration, and if a parameter doesn't have the @NonLeaked or @LeakedToResult annotations, removes the node of the respective argument in the method call from the store. If a parameter has @LeakedToResult,
visitMethodInvocation()handles it.- Overrides:
processPostconditionsin classCFAbstractTransfer<CFValue,CFStore, CFTransfer> - Parameters:
n- a method call or an object creationstore- a store; is side-effected by this methodexecutableElement- the method or constructor being calledtree- the tree for the method call or the object creation
-
visitMethodInvocation
public TransferResult<CFValue,CFStore> visitMethodInvocation(MethodInvocationNode n, TransferInput<CFValue, CFStore> in) Case 3: Given a method invocation expression, if the parent of the expression is not a statement, checks whether any arguments of the method call are annotated as @LeakedToResult and removes them from the store, since they might be leaked.- Specified by:
visitMethodInvocationin interfaceNodeVisitor<TransferResult<CFValue,CFStore>, TransferInput<CFValue, CFStore>> - Overrides:
visitMethodInvocationin classCFAbstractTransfer<CFValue,CFStore, CFTransfer>
-