Class UnaryExpression
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.Statement
-
- it.unive.lisa.program.cfg.statement.Expression
-
- it.unive.lisa.program.cfg.statement.NaryExpression
-
- it.unive.lisa.program.cfg.statement.UnaryExpression
-
- All Implemented Interfaces:
ProgramPoint
,CodeElement
,CodeNode<CFG,Statement,Edge>
,Node<CFG,Statement,Edge>
,java.lang.Comparable<Statement>
- Direct Known Subclasses:
NamedParameterExpression
public abstract class UnaryExpression extends NaryExpression
AnNaryExpression
with a single sub-expression.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
UnaryExpression(CFG cfg, CodeLocation location, java.lang.String constructName, EvaluationOrder order, Expression subExpression)
Builds the untyped expression, happening at the given location in the program.protected
UnaryExpression(CFG cfg, CodeLocation location, java.lang.String constructName, EvaluationOrder order, Type staticType, Expression subExpression)
Builds the expression, happening at the given location in the program.protected
UnaryExpression(CFG cfg, CodeLocation location, java.lang.String constructName, Expression subExpression)
Builds the untyped expression, happening at the given location in the program.protected
UnaryExpression(CFG cfg, CodeLocation location, java.lang.String constructName, Type staticType, Expression subExpression)
Builds the expression, happening at the given location in the program.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <A extends AbstractState<A>>
AnalysisState<A>backwardSemanticsAux(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, ExpressionSet[] params, StatementStore<A> expressions)
Computes the backward semantics of the expression, after the semantics of all sub-expressions have been computed.<A extends AbstractState<A>>
AnalysisState<A>bwdUnarySemantics(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, SymbolicExpression expr, StatementStore<A> expressions)
Computes the backward semantics of the expression, after the semantics of the sub-expression has been computed.<A extends AbstractState<A>>
AnalysisState<A>forwardSemanticsAux(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, ExpressionSet[] params, StatementStore<A> expressions)
Computes the forward semantics of the expression, after the semantics of all sub-expressions have been computed.abstract <A extends AbstractState<A>>
AnalysisState<A>fwdUnarySemantics(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, SymbolicExpression expr, StatementStore<A> expressions)
Computes the forward semantics of the expression, after the semantics of the sub-expression has been computed.Expression
getSubExpression()
Yields the only sub-expression of this unary expression.-
Methods inherited from class it.unive.lisa.program.cfg.statement.NaryExpression
accept, backwardSemantics, compareSameClass, compareSameClassAndParams, equals, forwardSemantics, getConstructName, getOrder, getStatementEvaluatedAfter, getStatementEvaluatedBefore, getSubExpressions, hashCode, toString
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Expression
getMetaVariables, getParentStatement, getRootStatement, getStaticType, setParentStatement
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Statement
compareTo, getCFG, getEvaluationPredecessor, getEvaluationSuccessor, getLocation, stopsExecution, throwsError
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.program.cfg.ProgramPoint
getProgram
-
-
-
-
Constructor Detail
-
UnaryExpression
protected UnaryExpression(CFG cfg, CodeLocation location, java.lang.String constructName, Expression subExpression)
Builds the untyped expression, happening at the given location in the program. The static type of this expression isUntyped
. TheEvaluationOrder
isLeftToRightEvaluation
.- Parameters:
cfg
- the cfg that this expression belongs tolocation
- the location where the expression is defined within the programconstructName
- the name of the construct represented by this expressionsubExpression
- the sub-expression of this expression
-
UnaryExpression
protected UnaryExpression(CFG cfg, CodeLocation location, java.lang.String constructName, Type staticType, Expression subExpression)
Builds the expression, happening at the given location in the program. TheEvaluationOrder
isLeftToRightEvaluation
.- Parameters:
cfg
- the cfg that this expression belongs tolocation
- the location where the expression is defined within the programconstructName
- the name of the construct represented by this expressionstaticType
- the static type of this expressionsubExpression
- the sub-expression of this expression
-
UnaryExpression
protected UnaryExpression(CFG cfg, CodeLocation location, java.lang.String constructName, EvaluationOrder order, Expression subExpression)
Builds the untyped expression, happening at the given location in the program. The static type of this expression isUntyped
.- Parameters:
cfg
- the cfg that this expression belongs tolocation
- the location where the expression is defined within the programconstructName
- the name of the construct represented by this expressionorder
- the evaluation order of the sub-expressionssubExpression
- the sub-expression of this expression
-
UnaryExpression
protected UnaryExpression(CFG cfg, CodeLocation location, java.lang.String constructName, EvaluationOrder order, Type staticType, Expression subExpression)
Builds the expression, happening at the given location in the program.- Parameters:
cfg
- the cfg that this expression belongs tolocation
- the location where the expression is defined within the programconstructName
- the name of the construct represented by this expressionorder
- the evaluation order of the sub-expressionsstaticType
- the static type of this expressionsubExpression
- the sub-expression of this expression
-
-
Method Detail
-
getSubExpression
public Expression getSubExpression()
Yields the only sub-expression of this unary expression.- Returns:
- the only sub-expression
-
forwardSemanticsAux
public <A extends AbstractState<A>> AnalysisState<A> forwardSemanticsAux(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, ExpressionSet[] params, StatementStore<A> expressions) throws SemanticException
Description copied from class:NaryExpression
Computes the forward semantics of the expression, after the semantics of all sub-expressions have been computed. Meta variables from the sub-expressions will be forgotten after this call returns.- Specified by:
forwardSemanticsAux
in classNaryExpression
- Type Parameters:
A
- the type ofAbstractState
- Parameters:
interprocedural
- the interprocedural analysis of the program to analyzestate
- the state where the expression is to be evaluatedparams
- the symbolic expressions representing the computed values of the sub-expressions of this expressionexpressions
- the cache where analysis states of intermediate expressions are stored and that can be accessed to query for post-states of parameters expressions- Returns:
- the
AnalysisState
representing the abstract result of the execution of this expression - Throws:
SemanticException
- if something goes wrong during the computation
-
fwdUnarySemantics
public abstract <A extends AbstractState<A>> AnalysisState<A> fwdUnarySemantics(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, SymbolicExpression expr, StatementStore<A> expressions) throws SemanticException
Computes the forward semantics of the expression, after the semantics of the sub-expression has been computed. Meta variables from the sub-expression will be forgotten after this expression returns.- Type Parameters:
A
- the type ofAbstractState
- Parameters:
interprocedural
- the interprocedural analysis of the program to analyzestate
- the state where the expression is to be evaluatedexpr
- the symbolic expressions representing the computed value of the sub-expression of this expressionexpressions
- the cache where analysis states of intermediate expressions are stored and that can be accessed to query for post-states of parameters expressions- Returns:
- the
AnalysisState
representing the abstract result of the execution of this expression - Throws:
SemanticException
- if something goes wrong during the computation
-
backwardSemanticsAux
public <A extends AbstractState<A>> AnalysisState<A> backwardSemanticsAux(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, ExpressionSet[] params, StatementStore<A> expressions) throws SemanticException
Description copied from class:NaryExpression
Computes the backward semantics of the expression, after the semantics of all sub-expressions have been computed. Meta variables from the sub-expressions will be forgotten after this call returns. By default, this method delegates toNaryExpression.forwardSemanticsAux(InterproceduralAnalysis, AnalysisState, ExpressionSet[], StatementStore)
, as it is fine for most atomic statements. One should redefine this method if a statement's semantics is composed of a series of smaller operations.- Overrides:
backwardSemanticsAux
in classNaryExpression
- Type Parameters:
A
- the type ofAbstractState
- Parameters:
interprocedural
- the interprocedural analysis of the program to analyzestate
- the state where the expression is to be evaluatedparams
- the symbolic expressions representing the computed values of the sub-expressions of this expressionexpressions
- the cache where analysis states of intermediate expressions are stored and that can be accessed to query for post-states of parameters expressions- Returns:
- the
AnalysisState
representing the abstract result of the execution of this expression - Throws:
SemanticException
- if something goes wrong during the computation
-
bwdUnarySemantics
public <A extends AbstractState<A>> AnalysisState<A> bwdUnarySemantics(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, SymbolicExpression expr, StatementStore<A> expressions) throws SemanticException
Computes the backward semantics of the expression, after the semantics of the sub-expression has been computed. Meta variables from the sub-expression will be forgotten after this expression returns. By default, this method delegates tofwdUnarySemantics(InterproceduralAnalysis, AnalysisState, SymbolicExpression, StatementStore)
, as it is fine for most atomic statements. One should redefine this method if a statement's semantics is composed of a series of smaller operations.- Type Parameters:
A
- the type ofAbstractState
- Parameters:
interprocedural
- the interprocedural analysis of the program to analyzestate
- the state where the expression is to be evaluatedexpr
- the symbolic expressions representing the computed value of the sub-expression of this expressionexpressions
- the cache where analysis states of intermediate expressions are stored and that can be accessed to query for post-states of parameters expressions- Returns:
- the
AnalysisState
representing the abstract result of the execution of this expression - Throws:
SemanticException
- if something goes wrong during the computation
-
-