Module dev.civl.abc

Interface Variable

All Superinterfaces:
Entity, OrdinaryEntity, ProgramEntity

public interface Variable extends OrdinaryEntity
A variable ("object") entity.
  • Method Details

    • getStorageDuration

      Variable.StorageDurationKind getStorageDuration()
      Gets the storage duration associated to this variable.
      Returns:
      the storage duration
    • setStorageDuration

      void setStorageDuration(Variable.StorageDurationKind duration)
      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 null if no initializer is present
    • setInitializer

      void setInitializer(InitializerNode initializer)
      Sets the initializer for this variable.
      Parameters:
      initializer - node representing an initializer
    • getTypeAlignments

      Iterator<Type> 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 method addTypeAlignment(Type)
      Returns:
      the type alignments
    • addTypeAlignment

      void addTypeAlignment(Type type)
      Adds an alignment type to the list of type alignments associated to this node.
      Parameters:
      type - a type
      See Also:
    • getConstantAlignments

      Iterator<Value> 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 method addConstantAlignment(Value).
      Returns:
      constant alignments
    • addConstantAlignment

      void addConstantAlignment(Value constant)
      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: ProgramEntity

      Gets 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 method ProgramEntity.setDefinition(DeclarationNode).

      Specified by:
      getDefinition in interface ProgramEntity
      Returns:
      the definition of this entity or null
    • getType

      ObjectType getType()
      Description copied from interface: ProgramEntity

      Other than Label, and PragmaHandler, every kind of Entity has a type, returned by this method. For a Label or PragmaHandler, this returns null.

      The type is initially null. It can be set using method ProgramEntity.setType(Type).

      Specified by:
      getType in interface ProgramEntity
      Returns:
      the type of this entity or null
    • getDeclaration

      VariableDeclarationNode getDeclaration(int index)
      Description copied from interface: ProgramEntity
      Returns the index-th declaration of this entity.
      Specified by:
      getDeclaration in interface ProgramEntity
      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