Class Assignment
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.Statement
-
- it.unive.lisa.program.cfg.statement.Expression
-
- it.unive.lisa.program.cfg.statement.BinaryExpression
-
- it.unive.lisa.program.cfg.statement.Assignment
-
- All Implemented Interfaces:
ProgramPoint,CodeElement,Node<Statement,Edge,CFG>,java.lang.Comparable<Statement>
public class Assignment extends BinaryExpression
A statement assigning the result of an expression to an assignable expression.
-
-
Constructor Summary
Constructors Constructor Description Assignment(CFG cfg, CodeLocation location, Expression target, Expression expression)Builds the assignment, assigningexpressiontotarget, happening at the given location in the program.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>>
AnalysisState<A,H,V>semantics(AnalysisState<A,H,V> entryState, InterproceduralAnalysis<A,H,V> interprocedural, StatementStore<A,H,V> expressions)Semantics of an assignment (left = right) is evaluated as follows: the semantic of therightis evaluated using the givenentryState, returning a new analysis stateas_r = <state_r, expr_r>the semantic of theleftis evaluated usingas_r, returning a new analysis stateas_l = <state_l, expr_l>the final post-state is evaluated throughAnalysisState.assign(Identifier, SymbolicExpression, ProgramPoint), usingexpr_lasidandexpr_rasvalueThis means that all side effects fromrightare evaluated before the ones fromleft.
Computes the semantics of the statement, expressing how semantic information is transformed by the execution of this statement.java.lang.StringtoString()-
Methods inherited from class it.unive.lisa.program.cfg.statement.BinaryExpression
accept, equals, getLeft, getRight, hashCode, setOffset
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Expression
getDynamicType, getMetaVariables, getParentStatement, getRootStatement, getRuntimeTypes, getStaticType, setParentStatement, setRuntimeTypes
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Statement
compareTo, getCFG, getLocation, getOffset, stopsExecution, throwsError
-
-
-
-
Constructor Detail
-
Assignment
public Assignment(CFG cfg, CodeLocation location, Expression target, Expression expression)
Builds the assignment, assigningexpressiontotarget, happening at the given location in the program.- Parameters:
cfg- the cfg that this statement belongs tolocation- the location where this statement is defined within the source file. If unknown, usenulltarget- the target of the assignmentexpression- the expression to assign totarget
-
-
Method Detail
-
semantics
public final <A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>> AnalysisState<A,H,V> semantics(AnalysisState<A,H,V> entryState, InterproceduralAnalysis<A,H,V> interprocedural, StatementStore<A,H,V> expressions) throws SemanticException
Semantics of an assignment (left = right) is evaluated as follows:- the semantic of the
rightis evaluated using the givenentryState, returning a new analysis stateas_r = <state_r, expr_r> - the semantic of the
leftis evaluated usingas_r, returning a new analysis stateas_l = <state_l, expr_l> - the final post-state is evaluated through
AnalysisState.assign(Identifier, SymbolicExpression, ProgramPoint), usingexpr_lasidandexpr_rasvalue
rightare evaluated before the ones fromleft.
Computes the semantics of the statement, expressing how semantic information is transformed by the execution of this statement. This method is also responsible for recursively invoking theStatement.semantics(AnalysisState, InterproceduralAnalysis, StatementStore)of each nestedExpression, saving the result of each call inexpressions.- Specified by:
semanticsin classStatement- Type Parameters:
A- the type ofAbstractStateH- the type of theHeapDomainV- the type of theValueDomain- Parameters:
entryState- the entry state that represents the abstract values of each program variable and memory location when the execution reaches this statementinterprocedural- the interprocedural analysis of the program to analyzeexpressions- the cache where analysis states of intermediate expressions must be stored- Returns:
- the
AnalysisStaterepresenting the abstract result of the execution of this statement - Throws:
SemanticException- if something goes wrong during the computation
- the semantic of the
-
-