- All Superinterfaces:
Entity,OrdinaryEntity,ProgramEntity
A variable ("object") entity.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumAn enumerated type for the four different kinds of "storage duration" defined in the C11 Standard.Nested classes/interfaces inherited from interface dev.civl.abc.ast.entity.IF.Entity
Entity.EntityKindNested classes/interfaces inherited from interface dev.civl.abc.ast.entity.IF.ProgramEntity
ProgramEntity.LinkageKind -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConstantAlignment(Value constant) Adds a constant to the list of alignment constants assocaited to this variable.voidaddTypeAlignment(Type type) Adds an alignment type to the list of type alignments associated to this node.An object declaration may contain any number of alignment specifiers.getDeclaration(int index) Returns the index-th declaration of this entity.Gets the definition, i.e., the defining declaration of this entity.Gets the (optional) initializer for the object being declared.Gets the storage duration associated to this variable.getType()Other thanLabel, andPragmaHandler, every kind of Entity has a type, returned by this method.An object declaration may contain any number of alignment specifiers.voidsetInitializer(InitializerNode initializer) Sets the initializer for this variable.voidSets the storage duration assocaited to this variable.Methods inherited from interface dev.civl.abc.ast.entity.IF.Entity
getEntityKind, getNameMethods inherited from interface dev.civl.abc.ast.entity.IF.ProgramEntity
addDeclaration, getDeclarations, getFirstDeclaration, getLinkage, getNumDeclarations, isSystem, setDefinition, setIsSystem, setLinkage, setType
-
Method Details
-
getStorageDuration
Variable.StorageDurationKind getStorageDuration()Gets the storage duration associated to this variable.- Returns:
- the storage duration
-
setStorageDuration
Sets the storage duration assocaited to this variable.- Parameters:
duration- the storage duration
-
getInitializer
InitializerNode getInitializer()Gets the (optional) initializer for the object being declared.- Returns:
- the initializer for the new object, or
nullif no initializer is present
-
setInitializer
Sets the initializer for this variable.- Parameters:
initializer- node representing an initializer
-
getTypeAlignments
An object declaration may contain any number of alignment specifiers. These have the form_Alignas ( Type )and_Alignas ( constant-expression ). This method returns the types occurring in the first form (if any). This list is initially empty; types can be added to it using the methodaddTypeAlignment(Type)- Returns:
- the type alignments
-
addTypeAlignment
Adds an alignment type to the list of type alignments associated to this node.- Parameters:
type- a type- See Also:
-
getConstantAlignments
An object declaration may contain any number of alignment specifiers. These have the form_Alignas ( Type )and_Alignas ( constant-expression ). This method returns the constant expressions occurring in the second form (if any). The list of constant alignments is initially empty; constants are added to the list using methodaddConstantAlignment(Value).- Returns:
- constant alignments
-
addConstantAlignment
Adds a constant to the list of alignment constants assocaited to this variable.- Parameters:
constant- an integer constant- See Also:
-
getDefinition
VariableDeclarationNode getDefinition()Description copied from interface:ProgramEntityGets the definition, i.e., the defining declaration of this entity. Every entity has at most one definition. The definition is a declaration of a special kind. For example, for an object (variable), a definition is the declaration that allocates storage for that object. For a function, a definition is the declaration the contains the function body.
The definition is initially
null, but can be set using methodProgramEntity.setDefinition(DeclarationNode).- Specified by:
getDefinitionin interfaceProgramEntity- Returns:
- the definition of this entity or
null
-
getType
ObjectType getType()Description copied from interface:ProgramEntityOther than
Label, andPragmaHandler, every kind of Entity has a type, returned by this method. For aLabelorPragmaHandler, this returnsnull.The type is initially
null. It can be set using methodProgramEntity.setType(Type).- Specified by:
getTypein interfaceProgramEntity- Returns:
- the type of this entity or
null
-
getDeclaration
Description copied from interface:ProgramEntityReturns the index-th declaration of this entity.- Specified by:
getDeclarationin interfaceProgramEntity- Parameters:
index- an integer in the range [0,n), where n is the number of declarations of this entity- Returns:
- the index-th declaration of this entity
-