6.5.2.2. Nodes (Entities)¶
The following describes the possible types of nodes contained in C RFGs. Generally, if node type B inherits from node type A, nodes of type B can also have the attributes defined for A.
A node either represents an entity in the source code (e.g., a global variable) or describes one or more file system units, such as a file, a directory, or a module.
Common Attributes for all Node Types¶
- Source.Name
The
Source.Name(of typestring) is the name of the entity in the source code. If an entity does not have a name (for instance, anonymousstructsorunions), its name will be a question mark?.- Linkage.Name
The
Linkage.Name(of typestring) unambiguously identifies the entity within a single RFG.- Source.File, Source.Path, Source.Line, Source.Column
These four attributes characterize the source location of the entity’s definition, or one of its declarations if no definition has been found.
Source.FileandSource.Pathare of typestring;Source.LineandSource.Columnare of typeint.The
cafeCCoption-Binfluences the path prefix used in the source location information; see Tool Reference.Note
If there is no definition, one of the multiple potential declarations is arbitrarily chosen for the source location. This occurs if a system is only partially analyzed, or for elements originating in a library where only the header files, and not the source code, are available.
Caution
Note that types in C/C++ generally do not have a single point of definition throughout a system unless they are defined in a single header file; therefore, one of the source locations of their definitions is arbitrarily chosen.
Note
As long as an entity has a unique point of declaration (in only one header or C source file), the source location information remains the same, regardless of the order in which the system is translated and linked.
- Source.Region_Start, Source.Region_Length
: These attributes specify the starting line and length (in lines) of the source entity. Both attributes are of type
int.- Source.Physical_File, Source.Physical_Path
: These attributes specify the actual source location when
#linedirectives are present.- Source.Physical_Region_Start, Source.Physical_Region_Length
: These attributes specify the actual starting line and length (in lines) of the source entity when
#linedirectives are present.- Element.Has_Ambiguous_Declaration
This
toggleattribute indicates that there is more than one declaration for the represented entity. This is only used for typedefs and undefined entities.Note
Nodes with
Element.Has_Ambiguous_Declarationare ignored during architecture analysis because they would likely lead to confusing results.- Linkage.Is_Definition
This
toggleattribute indicates whether the node represents a definition (set) or a declaration (unset).For nodes in the
Code Factsview, the following applies: nodes that do not possess this attribute are from the environment (e.g.,printf) or are in parts of the system that have not yet been analyzed. If partial RFG files are created for IR libraries or single unit files, the parts outside the partial RFG are also not marked withLinkage.Is_Definition.For nodes in the
Declaration Factsview, the following applies: nodes that possess this attribute are definitions, and nodes that do not possess this attribute are declarations. There is a
Declareedge from a declaration to its matching definition.- Linkage.LIR_Node, Linkage.PIR_Node
In an RFG generated by Architecture-Dependencies, nodes in the
Code Factsview have theLinkage.LIR_Nodeattribute. Nodes in theDeclaration Factsview have theLinkage.PIR_Nodeattribute. These attributes map nodes in the RFG file to the nodes in the IR file from which it was created.
Class¶
Class (inherits from:
Type)
Subtypes
none
Containing Views
Code Facts, Declaration Facts, File, Module
Description
A
Class represents the user-defined C type constructs
struct, union, and enum.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Anonymous |
Toggle |
- |
Element.Is_Enum |
Toggle |
- |
Element.Is_Struct |
Toggle |
- |
Element.Is_Typedef_To_Anonymous |
Toggle |
- |
Element.Is_Union |
Toggle |
- |
Linkage.Is_Definition |
Toggle |
- |
Element.Has_Ambiguous_Declaration |
Toggle |
Type |
Element.Is_Anonymous |
Toggle |
Type |
Element.Is_Enum |
Toggle |
Type |
Element.Is_Struct |
Toggle |
Type |
Element.Is_Typedef_To_Anonymous |
Toggle |
Type |
Element.Is_Union |
Toggle |
Type |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.LIR_Node |
Integer |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Linkage.PIR_Node |
Integer |
Source_Entity |
Source.Body_End_Column |
Integer |
Source_Entity |
Source.Body_End_Line |
Integer |
Source_Entity |
Source.Body_Start_Column |
Integer |
Source_Entity |
Source.Body_Start_Line |
Integer |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
The appropriate toggle attribute Element.Is_Struct
,
Element.Is_Union
, and Element.Is_Enum
is set to indicate the exact kind of modeled type.
Note
The struct, union, and enum constructs are represented as
classes to facilitate linking of parts of a system written in C and C++.
Constant¶
Constant (inherits from:
Object)
Subtypes
none
Containing Views
Code Facts, Declaration Facts, File, Module
Description
A
Constant represents an enumerator constant; it is
contained in the node representing its enumeration type by
Enclosing edges.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Static |
Toggle |
Object |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.LIR_Node |
Integer |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Linkage.PIR_Node |
Integer |
Source_Entity |
Source.Body_End_Column |
Integer |
Source_Entity |
Source.Body_End_Line |
Integer |
Source_Entity |
Source.Body_Start_Column |
Integer |
Source_Entity |
Source.Body_Start_Line |
Integer |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Note
Code Example
enum NameOfEnum
{
someEnumerator,
anotherName
// ...
};
Example: Enum type with two enumerator values.¶
Directory¶
Directory (inherits from:
File_System_Entity)
Subtypes
none
Containing Views
File, Include, Module
Description
In addition to the language representation, the Axivion Suite captures the containment of declarations/definitions in modules, files, and directories.
A
Directory represents a directory in the file system. A
Directory node can contain
File
nodes,
Module nodes, and
Directory nodes depending on the kind of view.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Linkage.Name |
String |
File_System_Entity |
Linkage.PIR_Node |
Integer |
File_System_Entity |
Source.Column |
Integer |
File_System_Entity |
Source.File |
String |
File_System_Entity |
Source.Line |
Integer |
File_System_Entity |
Source.Name |
String |
File_System_Entity |
Source.Path |
String |
File_System_Entity |
Source.Physical_File |
String |
File_System_Entity |
Source.Physical_Path |
String |
File_System_Entity |
Source.Physical_Region_Length |
Integer |
File_System_Entity |
Source.Physical_Region_Start |
Integer |
File_System_Entity |
Source.Region_Length |
Integer |
File_System_Entity |
Source.Region_Start |
Integer |
File_System_Entity |
File¶
File (inherits from:
File_System_Entity)
Subtypes
none
Containing Views
File, Include
Description
A
File node represents a source file. It contains all
declarations and definitions by incoming
Enclosing edges.
A
File node itself may be contained in a
Directory node. The path is expressed by the hierarchy of
Directory nodes.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Preinclude_File |
Toggle |
- |
Element.Is_System_Header |
Toggle |
- |
Linkage.Name |
String |
File_System_Entity |
Linkage.PIR_Node |
Integer |
File_System_Entity |
Source.Column |
Integer |
File_System_Entity |
Source.File |
String |
File_System_Entity |
Source.Line |
Integer |
File_System_Entity |
Source.Name |
String |
File_System_Entity |
Source.Path |
String |
File_System_Entity |
Source.Physical_File |
String |
File_System_Entity |
Source.Physical_Path |
String |
File_System_Entity |
Source.Physical_Region_Length |
Integer |
File_System_Entity |
Source.Physical_Region_Start |
Integer |
File_System_Entity |
Source.Region_Length |
Integer |
File_System_Entity |
Source.Region_Start |
Integer |
File_System_Entity |
The Source.Name of a
File node is the name of
the file in the file system (with extension).
File_System_Entity¶
File_System_Entity
Subtypes
Directory,
File,
Module
Containing Views
none (only subtypes of
File_System_Entity are contained in views)
Description
The
File_System_Entity node type is the base
type of all nodes representing entities of the file system, like directories, files, and
modules.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Linkage.Name |
String |
- |
Linkage.PIR_Node |
Integer |
- |
Source.Column |
Integer |
- |
Source.File |
String |
- |
Source.Line |
Integer |
- |
Source.Name |
String |
- |
Source.Path |
String |
- |
Source.Physical_File |
String |
- |
Source.Physical_Path |
String |
- |
Source.Physical_Region_Length |
Integer |
- |
Source.Physical_Region_Start |
Integer |
- |
Source.Region_Length |
Integer |
- |
Source.Region_Start |
Integer |
- |
Macro¶
Macro (inherits from:
Source_Entity)
Subtypes
none
Containing Views
Call, Code Facts, Declaration Facts, File, Module
Description
A
Macro node represents a macro in the C/C++ language.
Macros are often used like constants and inline functions and the Axivion Suite tries to get as close as possible to allow analyzing such code. On the other hand, heavy use of token pasting etc. leads to very detailed invocation trees.
The treatment of macros can be configured, see option macro_options.represent_macros of rule Architecture-Dependencies.
Note
Because macro expansion can lead to different expansions in different contexts, you may see more macro nodes than you would expect on first sight from the source code.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.LIR_Node |
Integer |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Linkage.PIR_Node |
Integer |
Source_Entity |
Source.Body_End_Column |
Integer |
Source_Entity |
Source.Body_End_Line |
Integer |
Source_Entity |
Source.Body_Start_Column |
Integer |
Source_Entity |
Source.Body_Start_Line |
Integer |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Member¶
Member (inherits from:
Source_Entity)
Subtypes
none
Containing Views
Code Facts, Declaration Facts, File, Module
Description
A
Member represents components of structs and
unions. Member nodes are contained in the respective type by
Enclosing edges leading from the member to the type as depicted
in Figure Example: Type with enclosed member nodes shown flat and hierarchically.. In hierarchical graph windows
of gravis, the containment is shown by the layout of the members inside the
rectangle representing the interior of a type.
Note
A component of an enum is represented as a Constant.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Has_Public_Visibility |
Toggle |
- |
Element.Is_Anonymous |
Toggle |
- |
Element.Is_Const |
Toggle |
- |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.LIR_Node |
Integer |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Linkage.PIR_Node |
Integer |
Source_Entity |
Source.Body_End_Column |
Integer |
Source_Entity |
Source.Body_End_Line |
Integer |
Source_Entity |
Source.Body_Start_Column |
Integer |
Source_Entity |
Source.Body_Start_Line |
Integer |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
A
Member in a C RFG is always tagged with the attribute
Element.Has_Public_Visibility (
).
Module¶
Module (inherits from:
File_System_Entity)
Subtypes
none
Containing Views
Module
Description
A
Module M represents the combination of a C source
file M.c and its corresponding header file M.h. A
Module contains all definitions in the corresponding files by incoming
Enclosing edges. It may be contained in a
Directory node.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Linkage.Name |
String |
File_System_Entity |
Linkage.PIR_Node |
Integer |
File_System_Entity |
Source.Column |
Integer |
File_System_Entity |
Source.File |
String |
File_System_Entity |
Source.Line |
Integer |
File_System_Entity |
Source.Name |
String |
File_System_Entity |
Source.Path |
String |
File_System_Entity |
Source.Physical_File |
String |
File_System_Entity |
Source.Physical_Path |
String |
File_System_Entity |
Source.Physical_Region_Length |
Integer |
File_System_Entity |
Source.Physical_Region_Start |
Integer |
File_System_Entity |
Source.Region_Length |
Integer |
File_System_Entity |
Source.Region_Start |
Integer |
File_System_Entity |
The Source.Name of a
Module is the name of the
corresponding source file(s) without extension.
Object¶
Object (inherits from:
Source_Entity)
Subtypes
Constant,
Variable
Containing Views
none (only subtypes of
Object are contained in views)
Description
Object specializes into
Variable which represents global variables and
Constant which represents global constants and enumerator constants.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Static |
Toggle |
- |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.LIR_Node |
Integer |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Linkage.PIR_Node |
Integer |
Source_Entity |
Source.Body_End_Column |
Integer |
Source_Entity |
Source.Body_End_Line |
Integer |
Source_Entity |
Source.Body_Start_Column |
Integer |
Source_Entity |
Source.Body_Start_Line |
Integer |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
The toggle attribute Element.Is_Static (
) indicates
whether the variable is declared static.
Routine¶
Routine (inherits from:
Source_Entity)
Subtypes
none
Containing Views
Call, Code Facts, Declaration Facts, File, Module
Description
A
Routine represents a C function.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Analysis.Dead_Code |
Toggle |
- |
Element.Has_Ambiguous_Declaration |
Toggle |
- |
Element.Has_Ellipsis |
Toggle |
- |
Element.Is_Anonymous |
Toggle |
- |
Element.Is_Artificial |
Toggle |
- |
Element.Is_Destructor |
Toggle |
- |
Element.Is_Inline |
Toggle |
- |
Element.Is_Interrupt |
Toggle |
- |
Element.Is_Static |
Toggle |
- |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.LIR_Node |
Integer |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Linkage.PIR_Node |
Integer |
Source_Entity |
Source.Body_End_Column |
Integer |
Source_Entity |
Source.Body_End_Line |
Integer |
Source_Entity |
Source.Body_Start_Column |
Integer |
Source_Entity |
Source.Body_Start_Line |
Integer |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
A
Routine has the attribute
Element.Number_Of_Parameters of type Integer which contains
the number of parameters of the routine. The toggle attribute
Element.Is_Static (
) indicates whether the function is
declared static.
Source_Entity¶
Source_Entity
Subtypes
Macro,
Member,
Object,
Routine,
Type
Containing Views
none (only subtypes of
Source_Entity are contained in views)
Description
The
Source_Entity node type is the base type of all
source-related entities like types, routines, variables, and members.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Linkage.Is_Definition |
Toggle |
- |
Linkage.LIR_Node |
Integer |
- |
Linkage.Name |
String |
- |
Linkage.PIR_Node |
Integer |
- |
Source.Body_End_Column |
Integer |
- |
Source.Body_End_Line |
Integer |
- |
Source.Body_Start_Column |
Integer |
- |
Source.Body_Start_Line |
Integer |
- |
Source.Column |
Integer |
- |
Source.Declaration_Start |
Integer |
- |
Source.File |
String |
- |
Source.Line |
Integer |
- |
Source.Name |
String |
- |
Source.Path |
String |
- |
Source.Physical_File |
String |
- |
Source.Physical_Path |
String |
- |
Source.Physical_Region_Length |
Integer |
- |
Source.Physical_Region_Start |
Integer |
- |
Source.Region_Length |
Integer |
- |
Source.Region_Start |
Integer |
- |
Source.Signature_Start |
Integer |
- |
Type¶
Type (inherits from:
Source_Entity)
Subtypes
Class
Containing Views
Code Facts, Declaration Facts, File, Module
Description
A
Type represents a user-defined C type alias introduced by
typedef, as well as enum types.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Has_Ambiguous_Declaration |
Toggle |
- |
Element.Is_Anonymous |
Toggle |
- |
Element.Is_Enum |
Toggle |
- |
Element.Is_Struct |
Toggle |
- |
Element.Is_Typedef_To_Anonymous |
Toggle |
- |
Element.Is_Union |
Toggle |
- |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.LIR_Node |
Integer |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Linkage.PIR_Node |
Integer |
Source_Entity |
Source.Body_End_Column |
Integer |
Source_Entity |
Source.Body_End_Line |
Integer |
Source_Entity |
Source.Body_Start_Column |
Integer |
Source_Entity |
Source.Body_Start_Line |
Integer |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
If the configuration option
node_options.merge_typedef_to_anonymous
of rule Architecture-Dependencies is set to True (which is the default),
the node for the typedef defining a type name for an anonymous
struct or union subsumes the definition of the anonymous type and gets
the toggle Element.Is_Typedef_To_Anonymous attached. If the configuration
key is set to False, the type node representing the typedef is not marked by the
above mentioned toggle.
If toggle attribute Element.Is_Anonymous is attached, the type has been
declared without a name (see the following example).
Note
The RFG does not represent primitive types such as float and int.
However, typedefs to primitive types are represented.
Note
Code Example
struct Struct {
int field;
// ...
};
union Union {
int field;
// ...
};
enum Enum {
enumerator
// ...
};
Example: Structures, unions, and enumerations in C.¶
Variable¶
Variable (inherits from:
Object)
Subtypes
none
Containing Views
Code Facts, Declaration Facts, File, Module
Description
A
Variable represents global variables (also
const, static and volatile ones).
Note
Bauhaus does not extract local variables at the RFG level because they are the secret of routines and therefore not relevant at the architectural level.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Has_Ambiguous_Declaration |
Toggle |
- |
Element.Is_Const |
Toggle |
- |
Element.Is_Static |
Toggle |
- |
Element.Is_Volatile |
Toggle |
- |
Element.Is_Static |
Toggle |
Object |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.LIR_Node |
Integer |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Linkage.PIR_Node |
Integer |
Source_Entity |
Source.Body_End_Column |
Integer |
Source_Entity |
Source.Body_End_Line |
Integer |
Source_Entity |
Source.Body_Start_Column |
Integer |
Source_Entity |
Source.Body_Start_Line |
Integer |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |