Module dev.civl.abc

Interface VariableDeclarationNode

All Superinterfaces:
ASTNode, BlockItemNode, DeclarationNode, OrdinaryDeclarationNode

public interface VariableDeclarationNode extends OrdinaryDeclarationNode
A declaration of a variable ("object").
  • Method Details

    • getEntity

      Variable getEntity()
      Description copied from interface: DeclarationNode
      Returns the entity whose existence is declared by this declaration. This is initially null, and can be changed by DeclarationNode.setEntity(Entity).
      Specified by:
      getEntity in interface DeclarationNode
      Returns:
      the entity declared by this declaration
      See Also:
    • hasAutoStorage

      boolean hasAutoStorage()

      Does the declaration include the auto storage class specifier? Default value is false, it can be changed using setAutoStorage(boolean).

      Returns:
      true if declaration contains auto
      See Also:
    • setAutoStorage

      void setAutoStorage(boolean value)
      Sets the value that will be returned by hasAutoStorage().
      Parameters:
      value - true if declaration contains auto
    • hasRegisterStorage

      boolean hasRegisterStorage()

      Does the declaration include the register storage class specifier?. Initially false, the value can be changed using setRegisterStorage(boolean).

      C11 6.9(2): "The storage-class specifiers auto and register shall not appear in the declaration specifiers in an external declaration."

      C11 6.7.1(7): "The declaration of an identifier for a function that has block scope shall have no explicit storage-class specifier other than extern."

      Since the only remaining kinds of scopes are function prototype and function, neither of which can contain function declarations, I conclude that auto and register can never occur in a function declaration.

      Ergo: this is for objects only, not functions.

      Returns:
      true iff declaration contains register
    • setRegisterStorage

      void setRegisterStorage(boolean value)
      Sets the value that will be returned by hasRegisterStorage().
      Parameters:
      value - true iff declaration contains register
    • hasSharedStorage

      boolean hasSharedStorage()
      Does this declaration have shared storage scope? Having shared scope means that this declaration declares a variable with workgroup scope. It can be access by threads inside the workgroup, but not outside the workgroup. Each workgroup has its own copy.
      Returns:
      true iff declaration contains __shared__
    • setSharedStorage

      void setSharedStorage(boolean value)
      Sets the value that will be returned by
      invalid reference
      #hasRSharedStorage()
      .
      Parameters:
      value - true iff declaration contains register
    • getInitializer

      InitializerNode getInitializer()
      Gets the (optional) initializer for the object being declared. Returns null if the declaration does not use an initializer. Default value is null; it can be changed using setInitializer(InitializerNode).
      Returns:
      the initializer for the object, or null if no initializer is present
    • setInitializer

      void setInitializer(InitializerNode initializer)
      Sets the value that will be returned by getInitializer().
      Parameters:
      initializer - the initializer for the object, or null if no initializer is present
    • hasThreadLocalStorage

      boolean hasThreadLocalStorage()
      Does the declaration include the _Thread_local storage class specifier? Default value is null; it can be changed using setThreadLocalStorage(boolean).
      Returns:
      true iff declaration contains _Thread_local
    • setThreadLocalStorage

      void setThreadLocalStorage(boolean value)
      Sets the value that will be returned by hasThreadLocalStorage().
      Parameters:
      value - true iff declaration contains _Thread_local
    • typeAlignmentSpecifiers

      SequenceNode<TypeNode> typeAlignmentSpecifiers()
      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). Initially null, this node can be set using setTypeAlignmentSpecifiers(SequenceNode).
      Returns:
      sequence node of type alignments
    • setTypeAlignmentSpecifiers

      void setTypeAlignmentSpecifiers(SequenceNode<TypeNode> specifiers)
      Sets the node that will be returned by typeAlignmentSpecifiers() .
      Parameters:
      specifiers - sequence node of type alignments
    • constantAlignmentSpecifiers

      SequenceNode<ExpressionNode> constantAlignmentSpecifiers()
      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). Default value is null, the node can be set using setConstantAlignmentSpecifiers(SequenceNode).
      Returns:
      sequence node of constant alignments
    • setConstantAlignmentSpecifiers

      void setConstantAlignmentSpecifiers(SequenceNode<ExpressionNode> specifiers)
      Sets the node that will be returned by method constantAlignmentSpecifiers().
      Parameters:
      specifiers - sequence node of constant alignments
    • copy

      Description copied from interface: ASTNode
      Returns a deep copy of this AST node. The node and all of its descendants will be cloned. The cloning does not copy analysis or attribute information.
      Specified by:
      copy in interface ASTNode
      Specified by:
      copy in interface BlockItemNode
      Specified by:
      copy in interface DeclarationNode
      Specified by:
      copy in interface OrdinaryDeclarationNode
      Returns:
      deep copy of this node
    • isRefParameter

      boolean isRefParameter()
      Only used when this VariableDeclarationNode is used as a parameter in FORTRAN program. Usually, the type of a parameter in FORTRAN is call by reference. However, for improving the performance, ABC will treat not-modified parameters as call by value.
      Returns:
      true , if this parameter variable is called by reference;
      false , if it is called by value (or call by reference without being modified).
    • setIsRefParameter

      void setIsRefParameter(boolean isRefParameter)
      Sets the boolean field representing the type of this node.
      [Only when this node is used as a parameter in a FORTRAN program]
      Parameters:
      isRefParameter -