Previous: , Up: Functions   [Contents][Index]


10.8.2 Function Properties

To determine the scope of a function, you can use the DECL_CONTEXT macro. This macro will return the class (either a RECORD_TYPE or a UNION_TYPE) or namespace (a NAMESPACE_DECL) of which the function is a member. For a virtual function, this macro returns the class in which the function was actually defined, not the base class in which the virtual declaration occurred.

In C, the DECL_CONTEXT for a function maybe another function. This representation indicates that the GNU nested function extension is in use. For details on the semantics of nested functions, see the GCC Manual. The nested function can refer to local variables in its containing function. Such references are not explicitly marked in the tree structure; back ends must look at the DECL_CONTEXT for the referenced VAR_DECL. If the DECL_CONTEXT for the referenced VAR_DECL is not the same as the function currently being processed, and neither DECL_EXTERNAL nor TREE_STATIC hold, then the reference is to a local variable in a containing function, and the back end must take appropriate action.

DECL_EXTERNAL

This predicate holds if the function is undefined.

TREE_PUBLIC

This predicate holds if the function has external linkage.

TREE_STATIC

This predicate holds if the function has been defined.

TREE_THIS_VOLATILE

This predicate holds if the function does not return normally.

TREE_READONLY

This predicate holds if the function can only read its arguments.

DECL_PURE_P

This predicate holds if the function can only read its arguments, but may also read global memory.

DECL_VIRTUAL_P

This predicate holds if the function is virtual.

DECL_ARTIFICIAL

This macro holds if the function was implicitly generated by the compiler, rather than explicitly declared. In addition to implicitly generated class member functions, this macro holds for the special functions created to implement static initialization and destruction, to compute run-time type information, and so forth.

DECL_FUNCTION_SPECIFIC_TARGET

This macro returns a tree node that holds the target options that are to be used to compile this particular function or NULL_TREE if the function is to be compiled with the target options specified on the command line.

DECL_FUNCTION_SPECIFIC_OPTIMIZATION

This macro returns a tree node that holds the optimization options that are to be used to compile this particular function or NULL_TREE if the function is to be compiled with the optimization options specified on the command line.


Previous: , Up: Functions   [Contents][Index]