Module dev.civl.abc

Interface ProgramEntity

All Superinterfaces:
Entity
All Known Subinterfaces:
EnumerationType, Enumerator, Function, Label, OrdinaryEntity, StructureOrUnionType, TaggedEntity, Typedef, Variable
All Known Implementing Classes:
CommonEntity

public interface ProgramEntity extends Entity
  • Method Details

    • getDeclarations

      Iterable<DeclarationNode> getDeclarations()
      Returns an iterator over all the known declarations of this entity. An entity may be declared multiple times. This includes the definition. The declarations will be returned in program order.
      Returns:
      iterator over declarations of this entity, in program order
    • getFirstDeclaration

      DeclarationNode getFirstDeclaration()
      Gets one of the declarations of this entity.
      Returns:
      a declaration of this entity or null if there aren't any
    • getNumDeclarations

      int getNumDeclarations()
      Returns the number of declarations of this entity.
      Returns:
      the number of declarations of this entity
    • getDeclaration

      DeclarationNode getDeclaration(int index)
      Returns the index-th declaration of this entity.
      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
    • addDeclaration

      void addDeclaration(DeclarationNode declaration)
      Adds a declaration to this entity.
      Parameters:
      declaration - a declaration of this entity
    • getDefinition

      DeclarationNode getDefinition()

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

      Returns:
      the definition of this entity or null
    • setDefinition

      void setDefinition(DeclarationNode declaration)

      Sets the definition for 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, and can be set using this method. Note that this does not affect the list of declarations of this entity. It is the client's responsibility to add the definition to the list of declarations as well as to invoke this method, to ensure that the definition occurs in the list of declarations.

      Parameters:
      declaration - the declaration node for the definition
    • getLinkage

      Returns the kind of linkage this entity has.
      Returns:
      the kind of linkage this entity has
    • setLinkage

      void setLinkage(ProgramEntity.LinkageKind linkage)
      Sets the linkage of this entity. It is initially ProgramEntity.LinkageKind.NONE .
      Parameters:
      linkage - the linkage kind of this entity
    • getType

      Type getType()

      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 setType(Type).

      Returns:
      the type of this entity or null
    • setType

      void setType(Type type)
      Sets the type of this entity.
      Parameters:
      type - the type of this entity
    • isSystem

      boolean isSystem()
      Is this a system-defined entity (as opposed to a user-defined one)? Examples include standard types, like size_t. The default is false; it can be changed using method setIsSystem(boolean).
    • setIsSystem

      void setIsSystem(boolean value)
      Declares that this entity is or is not a system-defined entity.
      Parameters:
      value - if true, declares this to be a system-defined entity; if false, declares this to be a user-defined entity. The default is false.