Class Statement

    • 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 to
        location - the location where this statement is defined within the program
    • Method Detail

      • getCFG

        public final CFG getCFG()
        Description copied from interface: ProgramPoint
        Yields the CFG that this program point belongs to.
        Specified by:
        getCFG in interface ProgramPoint
        Returns:
        the containing cfg
      • 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, use throwsError().
        Returns:
        true only 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:
        true only if that condition holds
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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

        public abstract <A extends AbstractState<A>> AnalysisState<A> forwardSemantics​(AnalysisState<A> entryState,
                                                                                       InterproceduralAnalysis<A> interprocedural,
                                                                                       StatementStore<A> expressions)
                                                                                throws SemanticException
        Computes the forward semantics of the statement, expressing how semantic information is transformed by the execution of this statement. This method is also responsible for recursively invoking the forwardSemantics(AnalysisState, InterproceduralAnalysis, StatementStore) of each nested Expression, saving the result of each call in expressions.
        Type Parameters:
        A - the type of AbstractState
        Parameters:
        entryState - the entry state that represents the abstract values of each program variable and memory location when the execution reaches this statement
        interprocedural - the interprocedural analysis of the program to analyze
        expressions - the cache where analysis states of intermediate expressions must be stored
        Returns:
        the AnalysisState representing 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: CodeElement
        Yields the location where this code element appears in the program.
        Specified by:
        getLocation in interface CodeElement
        Returns:
        the location where this code element appears in the program
      • compareTo

        public final int compareTo​(Statement o)
        Specified by:
        compareTo in interface java.lang.Comparable<Statement>
      • compareSameClass

        protected abstract int compareSameClass​(Statement o)
        Auxiliary method for compareTo(Statement) that can safely assume that the two statements happen at the same CodeLocation and are instances of the same class.
        Parameters:
        o - the other statement
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
      • getEvaluationPredecessor

        public final Statement getEvaluationPredecessor()
        Yields the Statement that is evaluated right before this one, such that querying for the entry state of this statement is equivalent to querying the exit state of the returned one. If this method returns null, then this is the first expression evaluated when an entire statement is evaluated.
        Returns:
        the previous statement, or null
      • getStatementEvaluatedBefore

        public Statement getStatementEvaluatedBefore​(Statement other)
        Yields the Statement that precedes the given one, assuming that other is contained into this statement. If this method returns null, then other is the first expression evaluated when this statement is evaluated.
        Parameters:
        other - the other statement
        Returns:
        the previous statement, or null
      • getEvaluationSuccessor

        public final Statement getEvaluationSuccessor()
        Yields the Statement that is evaluated right after this one, such that querying for the exit state of this statement is equivalent to querying the entry state of the returned one. If this method returns null, then this is either a statement or the last expression evaluated when an entire statement is evaluated.
        Returns:
        the next statement, or null
      • getStatementEvaluatedAfter

        public Statement getStatementEvaluatedAfter​(Statement other)
        Yields the Statement that follows the given one, assuming that other is contained into this statement. If this method returns null, then other is the last expression evaluated when this statement is evaluated.
        Parameters:
        other - the other statement
        Returns:
        the next statement, or null