Class Statement
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.Statement
-
- All Implemented Interfaces:
ProgramPoint,CodeElement,Node<Statement,Edge,CFG>,java.lang.Comparable<Statement>
- Direct Known Subclasses:
Expression,NoOp,Ret,UnaryStatement
public abstract class Statement extends java.lang.Object implements Node<Statement,Edge,CFG>, ProgramPoint, java.lang.Comparable<Statement>
A statement of the program to analyze.
-
-
Field Summary
Fields Modifier and Type Field Description protected intoffsetThe offset of the statement within the cfg.
-
Constructor Summary
Constructors Modifier Constructor Description protectedStatement(CFG cfg, CodeLocation location)Builds a statement happening at the given source location.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcompareTo(Statement o)booleanequals(java.lang.Object obj)CFGgetCFG()Yields theCFGthat this program point belongs to.CodeLocationgetLocation()Yields the location where this code element appears in the source file.intgetOffset()Yields the offset of this statement relative to its containing cfg.inthashCode()abstract <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.booleanthrowsError()Whether or not this statement throws an error, halting the normal execution of the containing cfg.abstract java.lang.StringtoString()
-
-
-
Constructor Detail
-
Statement
protected Statement(CFG cfg, CodeLocation location)
Builds a statement happening at the given source location.- Parameters:
cfg- the cfg that this statement belongs tolocation- the location where this statement is defined within the source file. If unknown, usenull
-
-
Method Detail
-
getCFG
public final CFG getCFG()
Description copied from interface:ProgramPointYields theCFGthat this program point belongs to.- Specified by:
getCFGin interfaceProgramPoint- Returns:
- the containing cfg
-
getOffset
public final int getOffset()
Yields the offset of this statement relative to its containing cfg.- Returns:
- the offset
-
stopsExecution
public boolean stopsExecution()
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, usethrowsError().- Returns:
trueonly if that condition holds
-
throwsError
public boolean throwsError()
Whether or not this statement throws an error, halting the normal execution of the containing cfg.- Returns:
trueonly if that condition holds
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public abstract java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
semantics
public abstract <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
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 thesemantics(AnalysisState, InterproceduralAnalysis, StatementStore)of each nestedExpression, saving the result of each call inexpressions.- 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
-
getLocation
public CodeLocation getLocation()
Description copied from interface:CodeElementYields the location where this code element appears in the source file.- Specified by:
getLocationin interfaceCodeElement- Returns:
- the location where this code element apperars in the source file
-
-