Skip to content

Improve CFA transformation and introduce `CfaNetwork` and `CfaMetadata`

Thomas Lemberger requested to merge cfa-transformer into trunk

A CFA transformer returns for a given CFA (the original CFA) a new CFA that may differ from the original CFA. CFA transformers are useful when we want to modify a CFA in a certain way, but also keep the original CFA (e.g., create a program slice CFA, but also keep the original CFA the represents that complete program).

Sometimes it's unnecessarily difficult to apply certain changes to a MutableCFA, because we have to keep its individual elements (i.e., its CFA nodes and edges) in sync (e.g., we cannot just replace a CFA node, but also have to adjust its entering and leaving edges). This difficulty arises from the fact that the connections of a MutableCFA are defined by its individual elements (e.g., references to entering and leaving edges are stored in a CFA node and vice versa). This is the reason why CfaNetwork is introduced by this merge request. The key idea is that all connections of a CFA are fully defined by a CfaNetwork (extends Guava's Network) instead of its individual elements. This offers a great amount of flexibility as different views of a CFA can be created without changing the original CFA (e.g., by applying on-the-fly filters) and makes modifying CFAs easier, because it isn't always necessary to keep its individual elements in sync. Additionally, this improves interoperability with other components that already use Guava's Network.

For the graph-like program representation of a CFA, we can now use CfaNetwork, but CFA instances also contain additional data. For this reason, a new class for storing the additional data is introduced, namely CfaMetadata. Instances of this new class are, in combination with the graph representation of a program, used to model CFAs. This also makes implementing the CFA interface easier, because we don't have to keep track of as many individual attributes.

Apart from CfaMetadata, usage of the new components is optional. It's highly recommended to first read and understand the documentation of the new components (including the package documentation) before using them for existing or new functionality.

Edited by Valentin Port

Merge request reports