6.5.2.1. Views¶
C RFGs contain
a
Code Factsview,a
Moduleview,an
Environmentview,a
Callview,an
Entriesview,a
Declaration Factsview,a
Fileview,a
Declaration Callview,a
Declaration Environmentview, andan
Includeview.
Analyses might enrich the RFG with further views (e.g., a Dead / Alive view).
Code Facts View¶
The Code Facts view contains nodes and edges representing the definitions of the
analyzed system. It represents the global declarations and/or definitions extracted from
the source code together with their dependencies.
Module View¶
The Module view contains the file and directory hierarchy of the system
under analysis. The leaves are nodes from the Code Facts view. It groups
source entities by the translation unit (module) in which they are defined.
Environment View¶
The Environment view contains the subset of nodes from the
Code Facts view that stem from the environment (libraries, system headers,
etc.) rather than from the source code directly under analysis.
Call View¶
The Call view contains the subset of the Code Facts view
consisting of the
Routine nodes and
Call edges. It is useful for detecting call cycles in the program.
Entries View¶
The Entries view contains the entry points of the program. Initially, it
contains only the artificial
Routine node .entry,
from which artificial
Static_Call edges lead to
main and to the artificial routines .init and .fini. The
EntryPoints rules add further entry points to this view. Analyses such as
dead code analysis consider the nodes in this view to be initially alive.
Declaration Facts View¶
The Declaration Facts view contains nodes and edges for the declarations
and definitions of the analyzed system. Unlike the Code Facts view, which
focuses on definitions, the Declaration Facts view also captures forward
declarations, making it suitable for architecture analyses that treat header-file
interfaces as boundaries between components.
File View¶
The File view contains directory and file nodes representing the code files
of the analyzed project. All nodes representing
source entities from the
Declaration Facts view that are contained in a source file F are nested
within that file.
Declaration Call View¶
The Declaration Call view is the counterpart to the Call view for
the Declaration Facts view. It contains the routine nodes and
Call edges of the Declaration Facts view as well as the
Declare edges between these routine nodes.
Declaration Environment View¶
The Declaration Environment view contains the subset of nodes from the
Declaration Facts view that stem from the environment (libraries, system
headers, etc.) rather than from the source code directly under analysis.
Include View¶
The Include view contains directory and file nodes. It illustrates how code
files are included in one another, reflecting the #include directive relationships
between translation units.
Note
Some analyses require a pair of views: one containing dependency
information (i.e., source dependency edges) and another containing hierarchy
information. You can choose between the pairs Code Facts/
Module and Declaration Facts/ File. Other
combinations of these views are generally not meaningful.
The choice of pair depends on the appropriate elements for the analysis.
For example, if your architecture depends on “modules” that can be used as a whole, choose the
Code Facts/Modulepair.If, on the other hand, your architecture depends on declarations made visible in header files (acting as interfaces), choose the
Declaration Facts/Filepair.If your architecture actively uses declarations for interfacing (e.g., “I state my need for a function that must be defined elsewhere”), also choose the
Declaration Facts/Filepair.