Class Ret
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.Statement
-
- it.unive.lisa.program.cfg.statement.Ret
-
- All Implemented Interfaces:
ProgramPoint
,CodeElement
,CodeNode<CFG,Statement,Edge>
,Node<CFG,Statement,Edge>
,java.lang.Comparable<Statement>
public class Ret extends Statement
Terminates the execution of the CFG where this statement lies, without returning anything to the caller. For terminating CFGs that must return a value, useReturn
.
-
-
Constructor Summary
Constructors Constructor Description Ret(CFG cfg, CodeLocation location)
Builds the return, happening at the given location in the program.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <V> boolean
accept(GraphVisitor<CFG,Statement,Edge,V> visitor, V tool)
Accepts the givenGraphVisitor
.protected int
compareSameClass(Statement o)
Auxiliary method forStatement.compareTo(Statement)
that can safely assume that the two statements happen at the sameCodeLocation
and are instances of the same class.boolean
equals(java.lang.Object obj)
<A extends AbstractState<A>>
AnalysisState<A>forwardSemantics(AnalysisState<A> entryState, InterproceduralAnalysis<A> interprocedural, StatementStore<A> expressions)
Computes the forward semantics of the statement, expressing how semantic information is transformed by the execution of this statement.int
hashCode()
boolean
stopsExecution()
Whether or not this statement stops the execution of the containing cfg, either by throwing an error or returning a value.java.lang.String
toString()
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Statement
backwardSemantics, compareTo, getCFG, getEvaluationPredecessor, getEvaluationSuccessor, getLocation, getStatementEvaluatedAfter, getStatementEvaluatedBefore, 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
-
Ret
public Ret(CFG cfg, CodeLocation location)
Builds the return, happening at the given location in the program.- Parameters:
cfg
- the cfg that this statement belongs tolocation
- the location where the statement is defined within the program
-
-
Method Detail
-
stopsExecution
public boolean stopsExecution()
Description copied from class:Statement
Whether 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:
stopsExecution
in classStatement
- Returns:
true
only if that condition holds
-
compareSameClass
protected int compareSameClass(Statement o)
Description copied from class:Statement
Auxiliary method forStatement.compareTo(Statement)
that can safely assume that the two statements happen at the sameCodeLocation
and are instances of the same class.- Specified by:
compareSameClass
in classStatement
- Parameters:
o
- the other statement- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
-
forwardSemantics
public <A extends AbstractState<A>> AnalysisState<A> forwardSemantics(AnalysisState<A> entryState, InterproceduralAnalysis<A> interprocedural, StatementStore<A> expressions) throws SemanticException
Description copied from class:Statement
Computes the forward 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.forwardSemantics(AnalysisState, InterproceduralAnalysis, StatementStore)
of each nestedExpression
, saving the result of each call inexpressions
.- Specified by:
forwardSemantics
in classStatement
- Type Parameters:
A
- the type ofAbstractState
- 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
AnalysisState
representing the abstract result of the execution of this statement - Throws:
SemanticException
- if something goes wrong during the computation
-
accept
public <V> boolean accept(GraphVisitor<CFG,Statement,Edge,V> visitor, V tool)
Description copied from interface:Node
Accepts the givenGraphVisitor
. Implementors of this method are responsible for invokingGraphVisitor.visit(Object, Graph, Node)
on this node afterNode.accept(GraphVisitor, Object)
has been invoked on all nested nodes, if any. The visiting should stop at the first of such calls that returnfalse
.- Type Parameters:
V
- the type of auxiliary tool thatvisitor
can use- Parameters:
visitor
- the visitor that is visiting theGraph
containing this nodetool
- the auxiliary tool thatvisitor
can use- Returns:
- whether or not the visiting should stop when this call returns, as decided by the visitor itself
-
-