XCSG:TypeAlias

From AtlasWiki
Jump to: navigation, search

A TypeAlias introduces a synonym for an existing type, representing a typedef in C or C++, or any similar language construct that creates a new name for a type, but not a new type.

A TypeAlias in XCSG is not considered a Type, but provides a synonym (alias) for a given type, the AliasedType. This type may be an existing type, or an instantiation of a type with template parameters.

A TypeAlias is never the TypeOf a Variable or DataFlow node, instead the TypeOf edge points directly to the aliased Type, while an additional DefinedAs edge points to the TypeAlias used to declare the type.

A TypeAlias defined using another TypeAlias points its AliasedType edge to that TypeAlias, rather than directly to the Type it is an alias of.

It is generally considered preferable that DataFlow nodes should be connected to a TypeAlias via a DefinedAs edge if they are closely associated with a Variable defined using a TypeAlias, such as Assignment nodes representing the static single assignment form of a LocalVariable (provided this is consistent with the language's rules regarding the type of the result of an assignment). Whether such information should be retained in forward data flow from that point is left to the analyzer (but, again, should never continue forward if doing so would violate the type rules of the language indexed).

Specification

Metaclass TypeAlias
Extends Node
Description An alias for an existing type.
Direct Subkinds C:Enum
All Superkinds Node, ModelElement
Specified In Edges
In Edge Predecessor Multiplicity Description
AliasedType TypeAlias Connects a TypeAlias to the Type or TypeAlias it was declared to duplicate.
DefinedAs Variable Connects a Variable or DataFlow node which received its Type via a TypeAlias (such as a C/C++ typedef) to that TypeAlias.
DataFlow (Node)
Specified Out Edges
Out Edge Successor Multiplicity Description
AliasedType Type 0..1 Connects a TypeAlias to the Type or TypeAlias it was declared to duplicate.
TypeAlias 0..1
Known Possible In Edges

Inherited From In Edge Predecessor Multiplicity Description
Node Contains Node 1 Indicates that the predecessor contains the successor in a sense specified by the specific type of Contains edge.
Known Possible Out Edges

Inherited From Out Edge Successor Multiplicity Description
Node Contains Node Indicates that the predecessor contains the successor in a sense specified by the specific type of Contains edge.