6.5.2.3. Edges (Dependencies)

Edges in the RFG represent dependencies between the entities that are represented by nodes.

Note

The descriptions define a direction and the type of source and target nodes of an edge. However, in a lifted view, the source and target nodes of a lifted edge may also be nodes that hierarchically contain the entities the basic edge is situated between.

Attributes

Edges in C RFGs can have the following attributes:

Source.File, Source.Path, Source.Line, Source.Column

These four attributes characterize the source location of the relation.

Note

If the same relation occurs multiple times, the source location of an arbitrary occurrence is used as representation.

Address

edge-address

Possible Source and Target Nodes

Only subtypes of this edge appear in views.

Description

An edge-address Address edge represents the fact that the address of an entity is taken by another entity. The source of a edge-address Address edge is the entity that takes the address, the target is the entity whose address is taken.

Cast_Of_Type

edge-cast-of-type

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-class Class

Code Facts, Declaration Facts

node-macro Macro

node-type Type

Code Facts, Declaration Facts

node-routine Routine

node-class Class

Code Facts, Declaration Facts

node-routine Routine

node-type Type

Code Facts, Declaration Facts

Description

A edge-cast-of-type Cast_Of_Type edge e → T represents that within entity e a cast with target type t occurs.

Declare

edge-declare

Possible Source and Target Nodes

Source type

Target type

Views

node-class Class

node-class Class

Declaration Facts

node-macro Macro

node-routine Routine

Declaration Facts

node-routine Routine

node-routine Routine

Declaration Facts

node-type Type

node-type Type

Declaration Facts

node-variable Variable

node-variable Variable

Declaration Facts

Description

A edge-declare Declare edge e₁→ e₂ with entities e₁, e₂ of the same type denote that e₁ represents a declaration of an entity e whose definition is represented by e₂.

Dynamic_Call

edge-dynamic-call

Possible Source and Target Nodes

Source type

Target type

Views

node-routine Routine

node-routine Routine

Call, Code Facts, Declaration Facts

Description

A edge-dynamic-call Dynamic_Call edge represents a call via function pointer.

Note

edge-dynamic-call Dynamic_Call edges are inserted by a pointer analysis which has to be run in addition to the front end pass. This analysis may be not available depending on the structure and size of your analyzed system.

Enclosing

edge-enclosing

Possible Source and Target Nodes

Source type

Target type

Views

node-class Class

node-file File

all

node-class Class

node-member Member

all

node-class Class

node-module Module

all

node-class Class

node-routine Routine

all

node-class Class

node-variable Variable

all

node-constant Constant

node-class Class

all

node-constant Constant

node-type Type

all

node-directory Directory

node-directory Directory

all

node-file File

node-directory Directory

all

node-macro Macro

node-file File

all

node-macro Macro

node-module Module

all

node-member Member

node-class Class

all

node-module Module

node-directory Directory

all

node-routine Routine

node-file File

all

node-routine Routine

node-module Module

all

node-type Type

node-file File

all

node-type Type

node-module Module

all

node-type Type

node-routine Routine

all

node-variable Variable

node-file File

all

node-variable Variable

node-module Module

all

Description

A edge-enclosing Enclosing states that an entity is declared within another entity. The edge-enclosing Enclosing edge is directed from the contained entity towards the containing entity. See Section  Member for an example structure.

Note

The edge-enclosing Enclosing edges indicate the hierarchical containment of node-member Member and node-constant Constant within node-type Type.

Enumerator_Use

edge-enumerator-use

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-constant Constant

Code Facts, Declaration Facts

node-routine Routine

node-constant Constant

Code Facts, Declaration Facts

Description

An edge-enumerator-use Enumerator_Use edge e→ c (with c being a constant) represents the fact that entity e might use the value (of) c.

Note

Code Example

enum Enumeration { Enumerator };

void f(void) {
  enum Enumeration e = Enumerator;
}
Example: Accessing an enumerator in function :code:`f`.

Example: Accessing an enumerator in function f.

Include

edge-include

Possible Source and Target Nodes

Source type

Target type

Views

node-file File

node-file File

Include

Description

A edge-include Include edge f₁→ f₂ (with f₁, f₂ nodes representing files) states that f₂ is included in f₁.

Local_Var_Of_Type

edge-local-var-of-type

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-class Class

Code Facts, Declaration Facts

node-macro Macro

node-type Type

Code Facts, Declaration Facts

node-routine Routine

node-class Class

Code Facts, Declaration Facts

node-routine Routine

node-type Type

Code Facts, Declaration Facts

Description

A edge-local-var-of-type Local_Var_Of_Type edge e → T states that an entity e contains one or more local variables of type t.

Note

Code Example

struct T
{
    int m;
};

void f(void)
{
    struct T x;
}
Example: A local variable in function :code:`f` has type :code:`T`.

Example: A local variable in function f has type T.

Macro_Invocation

edge-macro-invocation

Possible Source and Target Nodes

Source type

Target type

Views

node-class Class

node-macro Macro

Code Facts, Declaration Facts

node-constant Constant

node-macro Macro

Code Facts, Declaration Facts

node-macro Macro

node-macro Macro

Call, Code Facts, Declaration Facts

node-member Member

node-macro Macro

Code Facts, Declaration Facts

node-routine Routine

node-macro Macro

Call, Code Facts, Declaration Facts

node-type Type

node-macro Macro

Code Facts, Declaration Facts

node-variable Variable

node-macro Macro

Code Facts, Declaration Facts

Description

A edge-macro-invocation Macro_Invocation represents the invocation of a macro.

Note

Code Example

#define SomeMacro(x,y) (((x)>(y))?(x):(y))

void invoker1 (void) 
{
  SomeMacro(21,21);
}

int f(void) { return 42; }

void invoker2 (void) 
{
  SomeMacro(f(),f());
}

int G = 84;

void invoker3 (void)
{
  SomeMacro(G, G);
}
Example: A macro :code:`SomeMacro` and its invocation from within some invoking routines.

Example: A macro SomeMacro and its invocation from within some invoking routines.

Member_Address

edge-member-address

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-member Member

Code Facts, Declaration Facts

node-routine Routine

node-member Member

Code Facts, Declaration Facts

Description

A edge-member-address Member_Address edge e→ m (with m being a member) represents the fact that the address of m is taken within entity e.

Note

Code Example

struct T
{
    int m;
};

void f(void) {
  struct T x;
  int *p;
  p = &(x.m); /* direction: g -> m */
}
Example: Taking the address of the member :code:`m` of struct :code:`T` in function :code:`f`.

Example: Taking the address of the member m of struct T in function f.

Member_Set

edge-member-set

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-member Member

Code Facts, Declaration Facts

node-routine Routine

node-member Member

Code Facts, Declaration Facts

Description

A edge-member-set Member_Set edge e→ m (with m being a member) represents the fact that entity e might overwrite the value of member m.

Note

Code Example

struct T
{
    int m;
};

void f(void) {
  struct T x;
  x.m = 2; /* direction: f -> m */
}
Example: Setting a member of struct :code:`T`.

Example: Setting a member of struct T.

Member_Use

edge-member-use

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-member Member

Code Facts, Declaration Facts

node-routine Routine

node-member Member

Code Facts, Declaration Facts

Description

A edge-member-use Member_Use edge e→ m (with m being a member) represents the fact that entity e might read the value of member m.

Note

Code Example

struct T
{
    int m;
};

void f(void) {
  struct T x;
  int y = x.m; /* direction: f -> m */
}
Example: Accessing a member of struct :code:`T` in function :code:`f`.

Example: Accessing a member of struct T in function f.

Of_Type

edge-of-type

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-class Class

Code Facts, Declaration Facts

node-macro Macro

node-type Type

Code Facts, Declaration Facts

node-member Member

node-class Class

Code Facts, Declaration Facts

node-member Member

node-type Type

Code Facts, Declaration Facts

node-variable Variable

node-class Class

Code Facts, Declaration Facts

node-variable Variable

node-type Type

Code Facts, Declaration Facts

Description

A edge-of-type Of_Type edge e → T states that an entity e (e.g. a variable) is of type t.

Note

Code Example

struct T
{
    int m;
};

struct T G;
Example: Global variable :code:`G` has type :code:`T`.

Example: Global variable G has type T.

Parameter_Of_Type

edge-parameter-of-type

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-class Class

Code Facts, Declaration Facts

node-macro Macro

node-type Type

Code Facts, Declaration Facts

node-routine Routine

node-class Class

Code Facts, Declaration Facts

node-routine Routine

node-type Type

Code Facts, Declaration Facts

Description

A edge-parameter-of-type Parameter_Of_Type edge e → T states that the signature of an entity e mentions a type t as type of a formal parameter.

Note

Code Example

struct T
{
    int m;
};

void f(struct T p) /* direction: f -> T */
{}
Example: Function :code:`f` has a parameter of type :code:`T`.

Example: Function f has a parameter of type T.

Reference

edge-reference

Possible Source and Target Nodes

Only subtypes of this edge appear in views.

Description

A edge-reference Reference edge represents the setting, using, or address-taking of an node-object Object or node-member Memberby a node-routine Routine. The edge is directed from the routine to the object/member. Similarly, address-taking of node-routine Routines is represented by edge-reference References between the routines.

Return_Type

edge-return-type

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-class Class

Code Facts, Declaration Facts

node-macro Macro

node-type Type

Code Facts, Declaration Facts

node-routine Routine

node-class Class

Code Facts, Declaration Facts

node-routine Routine

node-type Type

Code Facts, Declaration Facts

Description

A edge-return-type Return_Type edge e → T states that the signature of an entity e mentions a type t as return type.

Note

Code Example

struct T
{
    int m;
};

struct T f() /* direction: f -> T */
{
    struct T result;
    return result;
}
Example: Function :code:`f` has return type :code:`T`.

Example: Function f has return type T.

Routine_Address

edge-routine-address

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-routine Routine

Code Facts, Declaration Facts

node-routine Routine

node-routine Routine

Code Facts, Declaration Facts

Description

A edge-routine-address Routine_Address edge e→ r (with r being a routine) represents the fact that the address of r is taken within entity e.

Note

Code Example

void g() {}

void f(void) {
  &g; /* direction: f -> g */
}
Example: Taking the address of the function :code:`g` in function :code:`f`.

Example: Taking the address of the function g in function f.

Set

edge-set

Possible Source and Target Nodes

Only subtypes of this edge appear in views.

Description

A edge-set Set edge represents a setting access to an object or member by another entity.

Signature

edge-signature

Possible Source and Target Nodes

Only subtypes of this edge appear in views.

Description

A edge-signature Signature edge indicates that a type occurs in a signature of another entity (e.g. a routine). The direction of a edge-signature Signature edge is from the entity to the type mentioned in its signature.

Note

The meaning of signature here includes return type and parameter types and excludes thrown exceptions. In this sense, it does not reflect the language semantics of which information belongs to a signature and which does not.

Note

Modifiers to a base type like pointers ( *), references (in C++: &), arrays ( []), const, volatile etc. are ignored by a type node.

Sizeof_Of_Type

edge-sizeof-of-type

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-class Class

Code Facts, Declaration Facts

node-macro Macro

node-type Type

Code Facts, Declaration Facts

node-routine Routine

node-class Class

Code Facts, Declaration Facts

node-routine Routine

node-type Type

Code Facts, Declaration Facts

Description

An edge e → T of type edge-sizeof-of-type Sizeof_Of_Type represents the fact that entity e contains a sizeof expression using type T as operand.

Source_Dependency

edge-source-dependency

Possible Source and Target Nodes

Only subtypes of this edge appear in views.

Description

A edge-source-dependency Source_Dependency edge is a dependency between two entities that is directly apparent from the source code.

Static_Call

edge-static-call

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-routine Routine

Call, Code Facts, Declaration Facts

node-routine Routine

node-routine Routine

Call, Code Facts, Declaration Facts

Description

A edge-static-call Static_Call edge is an explicit call directly visible in source code (not including calls by pointer and virtual calls). The source of the edge is the caller and the target is the callee.

Note

Code Example

void g(void) {
  g(); // recursive call
}

void h(void) {
}

void f(void) {
  g(); // f calls g
  h();
}
Example: Calls from routine :code:`f` to routines :code:`g` and :code:`h`.

Example: Calls from routine f to routines g and h.

Type_Synonym_To

edge-type-synonym-to

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-class Class

Code Facts, Declaration Facts

node-macro Macro

node-type Type

Code Facts, Declaration Facts

node-type Type

node-class Class

Code Facts, Declaration Facts

node-type Type

node-type Type

Code Facts, Declaration Facts

Description

A edge-type-synonym-to Type_Synonym_To edge t₁→ t₂ states that a type t₁ is a typedef or type alias (and therefore a synonym) of type t₂.

Note

Modifiers to a base type like pointers ( *), references (in C++: &), arrays ( []), const, volatile etc. are ignored.

Note

Code Example

struct T
{
    int m;
};

typedef struct T S;
Example: :code:`S` is a typedef of struct :code:`T`.

Example: S is a typedef of struct T.

Use

edge-use

Possible Source and Target Nodes

Only subtypes of this edge appear in views.

Description

A edge-use Use edge represents that the value of an entity is read by another entity.

Variable_Address

edge-variable-address

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-variable Variable

Code Facts, Declaration Facts

node-routine Routine

node-variable Variable

Code Facts, Declaration Facts

Description

A edge-variable-address Variable_Address edge e→ v represents the fact that the address of a global variable v is taken by an entity e.

Note

Code Example

int G;

void f(void) {
    int *p;
    p = &G;  /* direction: f -> G*/
}
Example: Taking the address of the global variable :code:`G` in function :code:`f`.

Example: Taking the address of the global variable G in function f.

Variable_Set

edge-variable-set

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-variable Variable

Code Facts, Declaration Facts

node-routine Routine

node-variable Variable

Code Facts, Declaration Facts

Description

A edge-variable-set Variable_Set edge e→ v (with v being a variable) represents the fact that entity e might overwrite the value of variable v.

Note

Code Example

int G;

void f(void)
{
    G = 1;
}
Example: Setting the global variable :code:`G` in function :code:`f`.

Example: Setting the global variable G in function f.

Variable_Use

edge-variable-use

Possible Source and Target Nodes

Source type

Target type

Views

node-macro Macro

node-variable Variable

Code Facts, Declaration Facts

node-routine Routine

node-variable Variable

Code Facts, Declaration Facts

Description

A edge-variable-use Variable_Use edge e→ v (with v being a variable) represents the fact that entity e might read the value of variable v.

Note

Code Example

int G;

void f(void)
{
    int x = G;
}
Example: Reading the global variable :code:`G` in function :code:`f`.

Example: Reading the global variable G in function f.