XCSG:Variable

From AtlasWiki
Jump to: navigation, search

A Variable in XCSG is a named assignable entity.

The semantics of Variable are those common to all its subtypes.

Specifications

Metaclass Variable
Extends Node
Description A named assignable entity that represents a portion of the system’s state.
Direct Subkinds CallInput, Field, ProgramVariable, StackVariable
All Superkinds Node, ModelElement
Specified In Edges
In Edge Predecessor Multiplicity Description
DataFlow (Edge) DataFlow (Node) Connects DataFlow nodes to one another and to Variables, linking the origin of data to locations that it is modified or consumed.
Specified Out Edges
Out Edge Successor Multiplicity Description
DataFlow (Edge) DataFlow (Node) Connects DataFlow nodes to one another and to Variables, linking the origin of data to locations that it is modified or consumed.
DefinedAs TypeAlias 0..1 Connects a Variable or DataFlow node which received its Type via a TypeAlias (such as a C/C++ typedef) to that TypeAlias.
InstanceVariableWritten InstanceVariableAssignment Connects a value (DataFlow (Node) or Variable) representing an object instance to an InstanceVariableAssignment representing a write to a field of that object.
TypeOf Type 1 Links a Variable or DataFlow node to its Type
Known Possible In Edges
In Edge Predecessor Multiplicity Description
HasVariable Namespace 1 Links a Classifier or Package to one of its Variables.
InterproceduralDataFlow Assignment Represents data flows between Functions, or involving Variables visible to multiple Functions.

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
Out Edge Successor Multiplicity Description
InterproceduralDataFlow DataFlow (Node) Represents data flows between Functions, or involving Variables visible to multiple Functions.

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.
Tag immutable
Description Present if the variable cannot be changed after initialization.
Tag volatileVariable
Description Present if the code indicates the variable requires special treatment because the variable's value can be changed externally, e.g. by hardware.
Tag happensBefore
Description Indicates that reading from the variable creates a "happens before" relationship to any code (in any thread) that previously wrote to the variable.
Tag restrict
Description Indicates a promise on the part of the programmer that the tagged Variable (which must be an instance of a Pointer type) is the only way to access the memory it points to; that is, that no other pointer will be used to alias the same range of memory, permitting the compiler to perform optimizations that would cause errors if the promise is not fulfilled.
Enumeration Visibility
Description The visibility of a Type, Variable, or Function in its Namespace.

Language mappings

The volatile tag maps exactly to the volatile keyword in C and C++. Note that other languages, notably Java (since 1.5), use the same keyword, but additionally require a memory barrier or "happens before" relationship between writes to the variable and later reads; for such variables, both the volatile and memoryBarrier tags should be present.

Individual language mappings are provided for each subtype of Variable (Attribute, AssociationEnd, ArrayElement, Parameter, and LocalVariable).