Class Substring
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.Statement
-
- it.unive.lisa.program.cfg.statement.Expression
-
- it.unive.lisa.program.cfg.statement.call.Call
-
- it.unive.lisa.program.cfg.statement.call.NativeCall
-
- it.unive.lisa.program.cfg.statement.call.TernaryNativeCall
-
- it.unive.lisa.program.cfg.statement.string.Substring
-
- All Implemented Interfaces:
ProgramPoint,CodeElement,Node<Statement,Edge,CFG>,java.lang.Comparable<Statement>
public class Substring extends TernaryNativeCall
An expression modeling the string substring operation. The type of the first operand must beStringType, while the other two operands' types must beInt32. The type of this expression is theStringType.
Since in most languages string operations are provided through calls to library functions, this class contains a fieldoriginatingwhose purpose is to optionally store aStatementthat is rewritten to an instance of this class (i.e., a call to aNativeCFGmodeling the library function). If present, such statement will be used asProgramPointfor semantics computations. This allows subclasses to implementPluggableStatementeasily without redefining the semantics provided by this class.
-
-
Field Summary
Fields Modifier and Type Field Description protected StatementoriginatingStatement that has been rewritten to this operation, if any.
-
Constructor Summary
Constructors Constructor Description Substring(CFG cfg, CodeLocation location, Expression left, Expression middle, Expression right)Builds the substring.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>>
AnalysisState<A,H,V>ternarySemantics(AnalysisState<A,H,V> entryState, InterproceduralAnalysis<A,H,V> interprocedural, AnalysisState<A,H,V> leftState, SymbolicExpression leftExp, AnalysisState<A,H,V> middleState, SymbolicExpression middleExp, AnalysisState<A,H,V> rightState, SymbolicExpression rightExp)Computes the semantics of the call, after the semantics of the parameters have been computed.-
Methods inherited from class it.unive.lisa.program.cfg.statement.call.TernaryNativeCall
callSemantics
-
Methods inherited from class it.unive.lisa.program.cfg.statement.call.NativeCall
equals, getConstructName, hashCode, toString
-
Methods inherited from class it.unive.lisa.program.cfg.statement.call.Call
accept, getParameters, semantics, 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
-
-
-
-
Field Detail
-
originating
protected Statement originating
Statement that has been rewritten to this operation, if any. This is to accomodate the fact that, in most languages, string operations are performed through calls, and one might want to provide the semantics of those calls throughNativeCFGthat rewrites to instances of this class.
-
-
Constructor Detail
-
Substring
public Substring(CFG cfg, CodeLocation location, Expression left, Expression middle, Expression right)
Builds the substring.- Parameters:
cfg- theCFGwhere this operation lieslocation- the location where this literal is definedleft- the left-hand side of this operationmiddle- the middle operand of this operationright- the right-hand side of this operation
-
-
Method Detail
-
ternarySemantics
protected <A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>> AnalysisState<A,H,V> ternarySemantics(AnalysisState<A,H,V> entryState, InterproceduralAnalysis<A,H,V> interprocedural, AnalysisState<A,H,V> leftState, SymbolicExpression leftExp, AnalysisState<A,H,V> middleState, SymbolicExpression middleExp, AnalysisState<A,H,V> rightState, SymbolicExpression rightExp) throws SemanticException
Description copied from class:TernaryNativeCallComputes the semantics of the call, after the semantics of the parameters have been computed. Meta variables from the parameters will be forgotten after this call returns.- Specified by:
ternarySemanticsin classTernaryNativeCall- Type Parameters:
A- the type ofAbstractStateH- the type of theHeapDomainV- the type of theValueDomain- Parameters:
entryState- the entry state of this binary callinterprocedural- the interprocedural analysis of the program to analyzeleftState- the state obtained by evaluatingleftinentryStateleftExp- the symbolic expression representing the computed value of the first parameter of this callmiddleState- the state obtained by evaluatingmiddleinleftStatemiddleExp- the symbolic expression representing the computed value of the second parameter of this callrightState- the state obtained by evaluatingrightinmiddleStaterightExp- the symbolic expression representing the computed value of the third parameter of this call- Returns:
- the
AnalysisStaterepresenting the abstract result of the execution of this call - Throws:
SemanticException- if something goes wrong during the computation
-
-