Class Call
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.Statement
-
- it.unive.lisa.program.cfg.statement.Expression
-
- it.unive.lisa.program.cfg.statement.NaryExpression
-
- it.unive.lisa.program.cfg.statement.call.Call
-
- All Implemented Interfaces:
ProgramPoint
,CodeElement
,CodeNode<CFG,Statement,Edge>
,Node<CFG,Statement,Edge>
,java.lang.Comparable<Statement>
- Direct Known Subclasses:
CallWithResult
,MultiCall
,NativeCall
,TruncatedParamsCall
,UnresolvedCall
public abstract class Call extends NaryExpression
A call to another cfg.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Call.CallType
Possible types of a call, identifying the type of targets (instance or static) it can have.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Call(CFG cfg, CodeLocation location, Call.CallType type, java.lang.String qualifier, java.lang.String targetName, EvaluationOrder order, Type staticType, Expression... parameters)
Builds a call happening at the given source location.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract int
compareCallAux(Call o)
Auxiliary method forStatement.compareTo(Statement)
that can safely assume that the two calls happen at the sameCodeLocation
, are instances of the same class, have the same parameters according to their implementation ofStatement.compareTo(Statement)
, and have all fields defined in theCall
class equal according to theirComparable.compareTo(Object)
.protected int
compareSameClassAndParams(Statement o)
Auxiliary method forStatement.compareTo(Statement)
that can safely assume that the two expressions happen at the sameCodeLocation
, are instances of the same class, and have the same parameters according to their implementation ofStatement.compareTo(Statement)
.boolean
equals(java.lang.Object obj)
Call.CallType
getCallType()
Yields the call type of this call.java.lang.String
getFullTargetName()
Yields the full name of the target of the call.Expression[]
getParameters()
Yields the parameters of this call.java.lang.String
getQualifier()
Yields the optional qualifier of the target of the call.UnresolvedCall
getSource()
Yields the call that this call originated from, if any.java.lang.String
getTargetName()
Yields the name of the target of the call.int
hashCode()
<A extends AbstractState<A>>
java.util.Set<Type>[]parameterTypes(StatementStore<A> expressions)
Yields an array containing the runtime types of the parameters of this call, retrieved by accessing the givenStatementStore
.void
setSource(UnresolvedCall source)
Sets the call that this call originated from.java.lang.String
toString()
-
Methods inherited from class it.unive.lisa.program.cfg.statement.NaryExpression
accept, backwardSemantics, backwardSemanticsAux, compareSameClass, forwardSemantics, forwardSemanticsAux, getConstructName, getOrder, getStatementEvaluatedAfter, getStatementEvaluatedBefore, getSubExpressions
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Expression
getMetaVariables, getParentStatement, getRootStatement, getStaticType, setParentStatement
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Statement
compareTo, getCFG, getEvaluationPredecessor, getEvaluationSuccessor, getLocation, stopsExecution, 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
-
Call
protected Call(CFG cfg, CodeLocation location, Call.CallType type, java.lang.String qualifier, java.lang.String targetName, EvaluationOrder order, Type staticType, Expression... parameters)
Builds a call happening at the given source location.- Parameters:
cfg
- the cfg that this expression belongs tolocation
- the location where the expression is defined within the programtype
- the call type of this callqualifier
- the optional qualifier of the call (can be null or empty - seegetFullTargetName()
for more info)targetName
- the name of the target of this callorder
- the evaluation order of the sub-expressionsstaticType
- the static type of this callparameters
- the parameters of this call
-
-
Method Detail
-
getSource
public final UnresolvedCall getSource()
Yields the call that this call originated from, if any. A call r originates from a call u if:- u is an
UnresolvedCall
, while r is not, and - a
CallGraph
resolved u to r, or - a
CallGraph
resolved u to a call c (e.g. aMultiCall
), and its semantics generated the call u
- Returns:
- the call that this one originated from
- u is an
-
getFullTargetName
public java.lang.String getFullTargetName()
Yields the full name of the target of the call. The full name of the target of a call follows the following structure:qualifier::targetName
, wherequalifier
is optional and, when it is not present (i.e. null or empty), the::
are omitted. This cfg returns is an alias ofNaryExpression.getConstructName()
.- Returns:
- the full name of the target of the call
-
getTargetName
public java.lang.String getTargetName()
Yields the name of the target of the call. The full name of the target of a call follows the following structure:qualifier::targetName
, wherequalifier
is optional and, when it is not present (i.e. null or empty), the::
are omitted.- Returns:
- the name of the target of the call
-
getQualifier
public java.lang.String getQualifier()
Yields the optional qualifier of the target of the call. The full name of the target of a call follows the following structure:qualifier::targetName
, wherequalifier
is optional and, when it is not present (i.e. null or empty), the::
are omitted.- Returns:
- the qualifier of the target of the call
-
getParameters
public final Expression[] getParameters()
Yields the parameters of this call. This is a shortcut to invokeNaryExpression.getSubExpressions()
.- Returns:
- the parameters of this call
-
getCallType
public Call.CallType getCallType()
Yields the call type of this call.- Returns:
- the call type
-
setSource
public void setSource(UnresolvedCall source)
Sets the call that this call originated from. A call r originates from a call u if:- u is an
UnresolvedCall
, while r is not, and - a
CallGraph
resolved u to r, or - a
CallGraph
resolved u to a call c (e.g. aMultiCall
), and its semantics generated the call u
- Parameters:
source
- the call that this one originated from
- u is an
-
toString
public java.lang.String toString()
- Overrides:
toString
in classNaryExpression
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classNaryExpression
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classNaryExpression
-
compareSameClassAndParams
protected int compareSameClassAndParams(Statement o)
Description copied from class:NaryExpression
Auxiliary method forStatement.compareTo(Statement)
that can safely assume that the two expressions happen at the sameCodeLocation
, are instances of the same class, and have the same parameters according to their implementation ofStatement.compareTo(Statement)
.- Specified by:
compareSameClassAndParams
in classNaryExpression
- Parameters:
o
- the other expression- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
-
compareCallAux
protected abstract int compareCallAux(Call o)
Auxiliary method forStatement.compareTo(Statement)
that can safely assume that the two calls happen at the sameCodeLocation
, are instances of the same class, have the same parameters according to their implementation ofStatement.compareTo(Statement)
, and have all fields defined in theCall
class equal according to theirComparable.compareTo(Object)
. This method is thus responsible for only comparing the implementation-specific fields.- Parameters:
o
- the other call- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
-
parameterTypes
public <A extends AbstractState<A>> java.util.Set<Type>[] parameterTypes(StatementStore<A> expressions) throws SemanticException
Yields an array containing the runtime types of the parameters of this call, retrieved by accessing the givenStatementStore
.- Type Parameters:
A
- the type ofAbstractState
- Parameters:
expressions
- the store containing the computed states for the parameters- Returns:
- the array of parameter types
- Throws:
SemanticException
- if an exception happens while retrieving the types
-
-