- All Superinterfaces:
ASTNode,BlockItemNode,DeclarationNode,OrdinaryDeclarationNode
- All Known Subinterfaces:
AbstractFunctionDefinitionNode,FunctionDefinitionNode,PredicateNode
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.ASTNode
ASTNode.NodeKindNested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.statement.BlockItemNode
BlockItemNode.BlockItemKindNested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.declaration.OrdinaryDeclarationNode
OrdinaryDeclarationNode.OrdinaryDeclarationKind -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a deep copy of this AST node.Returns the contract node for this function declaration.Returns the entity whose existence is declared by this declaration.gets the library name of this system functionbooleanDoes the declaration include the$atomic_ffunction specifier?booleanDoes the declaration include the__device__CUDA function specifier?booleanDoes the declaration include the__global__CUDA function specifier?booleanDoes the declaration include theinlinefunction specifier?booleanDoes the declaration include the_Noreturnfunction specifier?booleanDoes the declaration include the$purefunction specifier? A $pure function is a function whose return value is only determined by its input values, without observable side effects.booleanDoes the declaration include the$state_ffunction 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.booleanDoes the declaration include the$systemfunction specifier?booleanvoidsetAtomicFunctionSpecifier(boolean value) Set the atomic function specifier bit to the given value.voidsetContract(SequenceNode<ContractNode> contract) Sets the contract node child of this node to the given node.voidsetDeviceFunctionSpecifier(boolean value) Set the device function specifier bit to the given value.voidsetGlobalFunctionSpecifier(boolean value) Set the global function specifier bit to the given value.voidsetInlineFunctionSpecifier(boolean value) Set the inline function specifier bit to the given value.voidsetIsLogicFunction(boolean isLogicFunction) Sets weather this function definition node represents a logic function declaration.voidsetNoreturnFunctionSpecifier(boolean value) Sets the_Noreturnbit to the given value.voidsetPureFunctionSpecifier(boolean value) Set the $pure function specifier bit to the given value.voidsetStatefFunctionSpecifier(boolean value) Set the $state_f function specifier bit to the given value.voidsetSystemFunctionSpecifier(boolean value) Set the system function specifier bit to the given value.voidsetSystemLibrary(String library) sets the library name of this system functionMethods inherited from interface dev.civl.abc.ast.node.IF.ASTNode
addAllTransformAnnotations, addTransformAnnotation, child, childIndex, children, diff, equiv, getAttribute, getOwner, getScope, getSource, id, keepOnly, nextDFS, nodeKind, numChildren, parent, prettyPrint, prettyRepresentation, prettyRepresentation, print, remove, removeChild, removeTransformAnnotation, setAttribute, setChild, setId, setOwner, setScope, toString, transformAnnotationsMethods inherited from interface dev.civl.abc.ast.node.IF.statement.BlockItemNode
blockItemKindMethods inherited from interface dev.civl.abc.ast.node.IF.declaration.DeclarationNode
getIdentifier, getName, isDefinition, setEntity, setIdentifier, setIsDefinitionMethods inherited from interface dev.civl.abc.ast.node.IF.declaration.OrdinaryDeclarationNode
getTypeNode, hasExternStorage, hasStaticStorage, ordinaryDeclarationKind, setExternStorage, setStaticStorage, setTypeNode
-
Method Details
-
getEntity
Function getEntity()Description copied from interface:DeclarationNodeReturns the entity whose existence is declared by this declaration. This is initiallynull, and can be changed byDeclarationNode.setEntity(Entity).- Specified by:
getEntityin interfaceDeclarationNode- Returns:
- the entity declared by this declaration
- See Also:
-
hasInlineFunctionSpecifier
boolean hasInlineFunctionSpecifier()Does the declaration include theinlinefunction specifier?- Returns:
trueiff declaration containsinline- See Also:
-
setInlineFunctionSpecifier
void setInlineFunctionSpecifier(boolean value) Set the inline function specifier bit to the given value.- Parameters:
value- iftrue, says that this function declaration contains theinlinespecifier, iffalse, it doesn't- See Also:
-
hasNoreturnFunctionSpecifier
boolean hasNoreturnFunctionSpecifier()Does the declaration include the_Noreturnfunction specifier?- Returns:
trueiff declaration contains_Noreturn- See Also:
-
setNoreturnFunctionSpecifier
void setNoreturnFunctionSpecifier(boolean value) Sets the_Noreturnbit to the given value.- Parameters:
value- iftrue, says that this function declaration contains the_Noreturnspecifier, iffalse, it doesn't- See Also:
-
hasGlobalFunctionSpecifier
boolean hasGlobalFunctionSpecifier()Does the declaration include the__global__CUDA function specifier?- Returns:
trueiff declaration contains__global__- See Also:
-
setGlobalFunctionSpecifier
void setGlobalFunctionSpecifier(boolean value) Set the global function specifier bit to the given value.- Parameters:
value- iftrue, says that this function declaration contains the__global__specifier, iffalse, it doesn't- See Also:
-
hasDeviceFunctionSpecifier
boolean hasDeviceFunctionSpecifier()Does the declaration include the__device__CUDA function specifier?- Returns:
trueiff declaration contains__device__- See Also:
-
setDeviceFunctionSpecifier
void setDeviceFunctionSpecifier(boolean value) Set the device function specifier bit to the given value.- Parameters:
value- iftrue, says that this function declaration contains the__device__specifier, iffalse, it doesn't- See Also:
-
hasPureFunctionSpecifier
boolean hasPureFunctionSpecifier()Does the declaration include the$purefunction specifier? A $pure function is a function whose return value is only determined by its input values, without observable side effects.- Returns:
trueiff declaration contains$pure- See Also:
-
setPureFunctionSpecifier
void setPureFunctionSpecifier(boolean value) Set the $pure function specifier bit to the given value.- Parameters:
value- iftrue, says that this function declaration contains the$purespecifier, iffalse, it doesn't- See Also:
-
hasStatefFunctionSpecifier
boolean hasStatefFunctionSpecifier()Does the declaration include the$state_ffunction 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:
trueiff declaration contains$state_f- See Also:
-
setStatefFunctionSpecifier
void setStatefFunctionSpecifier(boolean value) Set the $state_f function specifier bit to the given value.- Parameters:
value- iftrue, says that this function declaration contains the$state_fspecifier, iffalse, it doesn't- See Also:
-
hasAtomicFunctionSpecifier
boolean hasAtomicFunctionSpecifier()Does the declaration include the$atomic_ffunction specifier?- Returns:
trueiff declaration contains$atomic_f- See Also:
-
setAtomicFunctionSpecifier
void setAtomicFunctionSpecifier(boolean value) Set the atomic function specifier bit to the given value.- Parameters:
value- iftrue, says that this function declaration contains the$atomic_fspecifier, iffalse, it doesn't- See Also:
-
hasSystemFunctionSpecifier
boolean hasSystemFunctionSpecifier()Does the declaration include the$systemfunction specifier?- Returns:
trueiff declaration contains$system- See Also:
-
setSystemFunctionSpecifier
void setSystemFunctionSpecifier(boolean value) Set the system function specifier bit to the given value.- Parameters:
value- iftrue, says that this function declaration contains the$systemspecifier, iffalse, it doesn't- See Also:
-
getSystemLibrary
String getSystemLibrary()gets the library name of this system function- Returns:
-
setSystemLibrary
sets the library name of this system function- Parameters:
library-
-
getContract
SequenceNode<ContractNode> getContract()Returns the contract node for this function declaration. May benull. It is a child node of this node.- Returns:
- the contract node child of this node
- See Also:
-
setContract
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
FunctionDeclarationNode copy()Description copied from interface:ASTNodeReturns 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:
copyin interfaceASTNode- Specified by:
copyin interfaceBlockItemNode- Specified by:
copyin interfaceDeclarationNode- Specified by:
copyin interfaceOrdinaryDeclarationNode- 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.
-