Class Throw
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.Statement
-
- it.unive.lisa.program.cfg.statement.UnaryStatement
-
- it.unive.lisa.program.cfg.statement.Throw
-
- All Implemented Interfaces:
ProgramPoint
,CodeElement
,CodeNode<CFG,Statement,Edge>
,Node<CFG,Statement,Edge>
,java.lang.Comparable<Statement>
public class Throw extends UnaryStatement
A statement that raises an error, stopping the execution of the current CFG and propagating the error to among the call chain.
-
-
Constructor Summary
Constructors Constructor Description Throw(CFG cfg, CodeLocation location, Expression expression)
Builds the throw, raisingexpression
as error, 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,T>,H extends HeapDomain<H>,V extends ValueDomain<V>,T extends TypeDomain<T>>
AnalysisState<A,H,V,T>semantics(AnalysisState<A,H,V,T> entryState, InterproceduralAnalysis<A,H,V,T> interprocedural, StatementStore<A,H,V,T> expressions)
Computes the semantics of the statement, expressing how semantic information is transformed by the execution of this statement.boolean
stopsExecution()
Whether or not this statement stops the execution of the containing cfg, either by throwing an error or returning a value.boolean
throwsError()
Whether or not this statement throws an error, halting the normal execution of the containing cfg.java.lang.String
toString()
-
Methods inherited from class it.unive.lisa.program.cfg.statement.UnaryStatement
accept, equals, getExpression, getStatementEvaluatedBefore, hashCode, setOffset
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Statement
compareTo, getCFG, getEvaluationPredecessor, getLocation, getOffset
-
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
-
Throw
public Throw(CFG cfg, CodeLocation location, Expression expression)
Builds the throw, raisingexpression
as error, happening at the given location in the program.- Parameters:
cfg
- the cfg that this statement belongs tolocation
- the location where the expression is defined within the programexpression
- the expression to raise as error
-
-
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
-
throwsError
public boolean throwsError()
Description copied from class:Statement
Whether or not this statement throws an error, halting the normal execution of the containing cfg.- Overrides:
throwsError
in classStatement
- Returns:
true
only if that condition holds
-
semantics
public <A extends AbstractState<A,H,V,T>,H extends HeapDomain<H>,V extends ValueDomain<V>,T extends TypeDomain<T>> AnalysisState<A,H,V,T> semantics(AnalysisState<A,H,V,T> entryState, InterproceduralAnalysis<A,H,V,T> interprocedural, StatementStore<A,H,V,T> expressions) throws SemanticException
Description copied from class:Statement
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:
semantics
in classStatement
- Type Parameters:
A
- the type ofAbstractState
H
- the type of theHeapDomain
V
- the type of theValueDomain
T
- the type ofTypeDomain
- 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
-
-