Class Return
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.Statement
-
- it.unive.lisa.program.cfg.statement.UnaryStatement
-
- it.unive.lisa.program.cfg.statement.Return
-
- All Implemented Interfaces:
ProgramPoint,MetaVariableCreator,CodeElement,Node<Statement,Edge,CFG>,java.lang.Comparable<Statement>
public class Return extends UnaryStatement implements MetaVariableCreator
Returns an expression to the caller CFG, terminating the execution of the CFG where this statement lies. For terminating CFGs that do not return any value, useRet.
-
-
Constructor Summary
Constructors Constructor Description Return(CFG cfg, CodeLocation location, Expression expression)Builds the return, returningexpressionto the caller CFG, happening at the given location in the program.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IdentifiergetMetaVariable()Yields the meta variable that is introduced during the evaluation of the semantics of this object to store information about the value produced by this object.<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)Computes the semantics of the statement, expressing how semantic information is transformed by the execution of this statement.booleanstopsExecution()Whether or not this statement stops the execution of the containing cfg, either by throwing an error or returning a value.java.lang.StringtoString()-
Methods inherited from class it.unive.lisa.program.cfg.statement.UnaryStatement
accept, equals, getExpression, hashCode, setOffset
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Statement
compareTo, getCFG, getLocation, getOffset, throwsError
-
-
-
-
Constructor Detail
-
Return
public Return(CFG cfg, CodeLocation location, Expression expression)
Builds the return, returningexpressionto the caller CFG, 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, usenullexpression- the expression to return
-
-
Method Detail
-
stopsExecution
public boolean stopsExecution()
Description copied from class:StatementWhether or not this statement stops the execution of the containing cfg, either by throwing an error or returning a value. To distinguish error-raising halting statements and normal ones, useStatement.throwsError().- Overrides:
stopsExecutionin classStatement- Returns:
trueonly if that condition holds
-
getMetaVariable
public final Identifier getMetaVariable()
Description copied from interface:MetaVariableCreatorYields the meta variable that is introduced during the evaluation of the semantics of this object to store information about the value produced by this object. Since the meta variable simulates a value pushed on the stack, it should be forgotten after it is consumed.- Specified by:
getMetaVariablein interfaceMetaVariableCreator- Returns:
- the meta variable introduced by this object
-
semantics
public <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
Description copied from class:StatementComputes 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
-
-