Package it.unive.lisa.program.cfg
Class NativeCFG
- java.lang.Object
-
- it.unive.lisa.program.cfg.NativeCFG
-
- All Implemented Interfaces:
CodeMember
public class NativeCFG extends java.lang.Object implements CodeMember
A native cfg, representing a cfg that is usually provided by the runtime of the programming language. This types of cfg are not really subjects of the analysis, but they are nevertheless required for obtaining meaningful results.
NativeCFGs do not contain code, but they can be rewritten to aNaryExpression
(that must implementPluggableStatement
) providing their semantics throughrewrite(Statement, Expression...)
.
Note that this class does not implementObject.equals(Object)
norObject.hashCode()
since all constructs are unique.
-
-
Constructor Summary
Constructors Constructor Description NativeCFG(CodeMemberDescriptor descriptor, java.lang.Class<? extends NaryExpression> construct)
Builds the native control flow graph.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CodeMemberDescriptor
getDescriptor()
Yields theCodeMemberDescriptor
containing the signature of this code member.NaryExpression
rewrite(Statement original, Expression... params)
Produces anNaryExpression
providing the semantics of this native cfg.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.program.cfg.CodeMember
validate
-
-
-
-
Constructor Detail
-
NativeCFG
public NativeCFG(CodeMemberDescriptor descriptor, java.lang.Class<? extends NaryExpression> construct)
Builds the native control flow graph.- Parameters:
descriptor
- the descriptor of this cfgconstruct
- the class of theNaryExpression
that provides the semantics of this native cfg; the class of the construct must also be a subtype ofPluggableStatement
- Throws:
java.lang.IllegalArgumentException
- if the class of the construct does not implementPluggableStatement
-
-
Method Detail
-
getDescriptor
public CodeMemberDescriptor getDescriptor()
Description copied from interface:CodeMember
Yields theCodeMemberDescriptor
containing the signature of this code member.- Specified by:
getDescriptor
in interfaceCodeMember
- Returns:
- the descriptor of this code member
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
rewrite
public NaryExpression rewrite(Statement original, Expression... params) throws CallResolutionException
Produces anNaryExpression
providing the semantics of this native cfg. Such native call can be used when a call to this native cfg is found within the program to analyze.- Parameters:
original
- theStatement
that must be rewritten as a call to this native cfgparams
- the parameters of the call to this cfg- Returns:
- a
NaryExpression
providing the semantics of this native cfg, that can be used instead of calling this cfg - Throws:
CallResolutionException
- if something goes wrong while creating the native call
-
-