DFAOrder Evaluator
This class uses a DFA to evaluate if the order of statements in the CPG is correct. It needs the following inputs:
consideredBases: A set of the IDs of nodes (typically the VariableDeclaration) which are considered.
nodeToRelevantMethod: A mapping between CPG nodes and their operators used by the respective edges in the DFA. Currently, we only consider CallExpressions. If a node is not contained in this list, it is not considered by the evaluation as we assume that the method is not relevant.
thisPositionOfNode: If a non-object oriented language was used, this is a map from CPG nodes (i.e., the CallExpression) to the argument position serving as base of the operation.
To improve the results, it is useful to run de.fraunhofer.aisec.cpg.passes.UnreachableEOGPass prior to running the analysis and set the flag eliminateUnreachableCode to true. This removes results which may occur in unreachable code.
Constructors
Functions
Checks if a sequence of Nodes/statemets starting from startNode follows the sequence given by the dfa. If the sequence of statements violates the rules, the method returns false, if it is correct, the method returns true. The flag stopOnWrongBase makes the FSM stop evaluation of a base if an unexpected operation was observed for that base.
Returns the "base" node belonging to node, on which the DFA is based on. Ideally, this is a variable declaration in the end.