Class 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 a NaryExpression (that must implement PluggableStatement) providing their semantics through rewrite(Statement, Expression...).

    Note that this class does not implement Object.equals(Object) nor Object.hashCode() since all constructs are unique.
    • 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 cfg
        construct - the class of the NaryExpression that provides the semantics of this native cfg; the class of the construct must also be a subtype of PluggableStatement
        Throws:
        java.lang.IllegalArgumentException - if the class of the construct does not implement PluggableStatement
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • rewrite

        public NaryExpression rewrite​(Statement original,
                                      Expression... params)
                               throws CallResolutionException
        Produces an NaryExpression 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 - the Statement that must be rewritten as a call to this native cfg
        params - 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