Module dev.civl.abc

Interface FunctionDeclarationNode

All Superinterfaces:
ASTNode, BlockItemNode, DeclarationNode, OrdinaryDeclarationNode
All Known Subinterfaces:
AbstractFunctionDefinitionNode, FunctionDefinitionNode, PredicateNode

public interface FunctionDeclarationNode extends OrdinaryDeclarationNode

A node representing a function declaration. This includes a function prototype as well as a function definition.

The children include: (0) an identifier node, the name of the function; (1) a type node which is the type of the function (not necessarily a function type node; e.g., it could be a TypedefNameNode), and (2) a contract node for the function contract, which may be null.

A C function declaration may contain addition specifiers (e.g., _Noreturn). These specifiers are represented by boolean fields in this node; they do not require additional children nodes.

  • Method Details

    • getEntity

      Function 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:
    • hasInlineFunctionSpecifier

      boolean hasInlineFunctionSpecifier()
      Does the declaration include the inline function specifier?
      Returns:
      true iff declaration contains inline
      See Also:
    • setInlineFunctionSpecifier

      void setInlineFunctionSpecifier(boolean value)
      Set the inline function specifier bit to the given value.
      Parameters:
      value - if true, says that this function declaration contains the inline specifier, if false, it doesn't
      See Also:
    • hasNoreturnFunctionSpecifier

      boolean hasNoreturnFunctionSpecifier()
      Does the declaration include the _Noreturn function specifier?
      Returns:
      true iff declaration contains _Noreturn
      See Also:
    • setNoreturnFunctionSpecifier

      void setNoreturnFunctionSpecifier(boolean value)
      Sets the _Noreturn bit to the given value.
      Parameters:
      value - if true, says that this function declaration contains the _Noreturn specifier, if false, it doesn't
      See Also:
    • hasGlobalFunctionSpecifier

      boolean hasGlobalFunctionSpecifier()
      Does the declaration include the __global__ CUDA function specifier?
      Returns:
      true iff declaration contains __global__
      See Also:
    • setGlobalFunctionSpecifier

      void setGlobalFunctionSpecifier(boolean value)
      Set the global function specifier bit to the given value.
      Parameters:
      value - if true, says that this function declaration contains the __global__ specifier, if false, it doesn't
      See Also:
    • hasDeviceFunctionSpecifier

      boolean hasDeviceFunctionSpecifier()
      Does the declaration include the __device__ CUDA function specifier?
      Returns:
      true iff declaration contains __device__
      See Also:
    • setDeviceFunctionSpecifier

      void setDeviceFunctionSpecifier(boolean value)
      Set the device function specifier bit to the given value.
      Parameters:
      value - if true, says that this function declaration contains the __device__ specifier, if false, it doesn't
      See Also:
    • hasPureFunctionSpecifier

      boolean hasPureFunctionSpecifier()
      Does the declaration include the $pure function specifier? A $pure function is a function whose return value is only determined by its input values, without observable side effects.
      Returns:
      true iff declaration contains $pure
      See Also:
    • setPureFunctionSpecifier

      void setPureFunctionSpecifier(boolean value)
      Set the $pure function specifier bit to the given value.
      Parameters:
      value - if true, says that this function declaration contains the $pure specifier, if false, it doesn't
      See Also:
    • hasStatefFunctionSpecifier

      boolean hasStatefFunctionSpecifier()
      Does the declaration include the $state_f function specifier? A $state_f function is a function whose return value is only determined by its input values and the current state, without observable side effects.
      Returns:
      true iff declaration contains $state_f
      See Also:
    • setStatefFunctionSpecifier

      void setStatefFunctionSpecifier(boolean value)
      Set the $state_f function specifier bit to the given value.
      Parameters:
      value - if true, says that this function declaration contains the $state_f specifier, if false, it doesn't
      See Also:
    • hasAtomicFunctionSpecifier

      boolean hasAtomicFunctionSpecifier()
      Does the declaration include the $atomic_f function specifier?
      Returns:
      true iff declaration contains $atomic_f
      See Also:
    • setAtomicFunctionSpecifier

      void setAtomicFunctionSpecifier(boolean value)
      Set the atomic function specifier bit to the given value.
      Parameters:
      value - if true, says that this function declaration contains the $atomic_f specifier, if false, it doesn't
      See Also:
    • hasSystemFunctionSpecifier

      boolean hasSystemFunctionSpecifier()
      Does the declaration include the $system function specifier?
      Returns:
      true iff declaration contains $system
      See Also:
    • setSystemFunctionSpecifier

      void setSystemFunctionSpecifier(boolean value)
      Set the system function specifier bit to the given value.
      Parameters:
      value - if true, says that this function declaration contains the $system specifier, if false, it doesn't
      See Also:
    • getSystemLibrary

      String getSystemLibrary()
      gets the library name of this system function
      Returns:
    • setSystemLibrary

      void setSystemLibrary(String library)
      sets the library name of this system function
      Parameters:
      library -
    • getContract

      SequenceNode<ContractNode> getContract()
      Returns the contract node for this function declaration. May be null. It is a child node of this node.
      Returns:
      the contract node child of this node
      See Also:
    • setContract

      void setContract(SequenceNode<ContractNode> contract)
      Sets the contract node child of this node to the given node.
      Parameters:
      contract - the contract node to be made a child of this node
      See Also:
    • 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
    • isLogicFunction

      boolean isLogicFunction()
      Returns:
      true iff this function declaration node represents a logic function declaration. A logic function is a function declared to be logic (including predicates and functions defined in ACSL annotations). The function definition is optional but if it exists, the function defintion is a (return of a) side-effect free expression.
    • setIsLogicFunction

      void setIsLogicFunction(boolean isLogicFunction)
      Sets weather this function definition node represents a logic function declaration.
      Parameters:
      isLogicFunction - true if to set this node to be a logic function declaration, false otherwise.