Class Assignment

    • Constructor Detail

      • Assignment

        public Assignment​(CFG cfg,
                          CodeLocation location,
                          Expression target,
                          Expression expression)
        Builds the assignment, assigning expression to target, happening at the given location in the program.
        Parameters:
        cfg - the cfg that this statement belongs to
        location - the location where this statement is defined within the source file. If unknown, use null
        target - the target of the assignment
        expression - the expression to assign to target
    • Method Detail

      • toString

        public final java.lang.String toString()
        Specified by:
        toString in class Statement
      • semantics

        public final <A extends AbstractState<A,​H,​V>,​H extends HeapDomain<H>,​V extends ValueDomain<V>> AnalysisState<A,​H,​V> semantics​(AnalysisState<A,​H,​V> entryState,
                                                                                                                                                                          InterproceduralAnalysis<A,​H,​V> interprocedural,
                                                                                                                                                                          StatementStore<A,​H,​V> expressions)
                                                                                                                                                                   throws SemanticException
        Semantics of an assignment (left = right) is evaluated as follows:
        1. the semantic of the right is evaluated using the given entryState, returning a new analysis state as_r = <state_r, expr_r>
        2. the semantic of the left is evaluated using as_r, returning a new analysis state as_l = <state_l, expr_l>
        3. the final post-state is evaluated through AnalysisState.assign(Identifier, SymbolicExpression, ProgramPoint), using expr_l as id and expr_r as value
        This means that all side effects from right are evaluated before the ones from left.

        Computes the 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 Statement.semantics(AnalysisState, InterproceduralAnalysis, StatementStore) of each nested Expression, saving the result of each call in expressions.
        Specified by:
        semantics in class Statement
        Type Parameters:
        A - the type of AbstractState
        H - the type of the HeapDomain
        V - the type of the ValueDomain
        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