📄 cp-tree.h
字号:
/* Definitions for C++ parsing and type checking. Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc. Hacked by Michael Tiemann (tiemann@cygnus.com)This file is part of GNU CC.GNU CC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU CC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU CC; see the file COPYING. If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330,Boston, MA 02111-1307, USA. */#ifndef _CP_TREE_H#define _CP_TREE_H/* Usage of TREE_LANG_FLAG_?: 0: BINFO_MARKED (BINFO nodes). COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT). NEW_EXPR_USE_GLOBAL (in NEW_EXPR). DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR). LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR). TREE_NEGATED_INT (in INTEGER_CST). TREE_INDIRECT_USING (in NAMESPACE_DECL). IDENTIFIER_MARKED (used by search routines). LOCAL_BINDING_P (in CPLUS_BINDING) 1: IDENTIFIER_VIRTUAL_P. TI_PENDING_TEMPLATE_FLAG. TEMPLATE_PARMS_FOR_INLINE. DELETE_EXPR_USE_VEC (in DELETE_EXPR). (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out). TYPE_USES_COMPLEX_INHERITANCE (in _TYPE). C_DECLARED_LABEL_FLAG. INHERITED_VALUE_BINDING_P (in CPLUS_BINDING) BASELINK_P (in TREE_LIST) 2: IDENTIFIER_OPNAME_P. BINFO_VBASE_MARKED. BINFO_FIELDS_MARKED. TYPE_VIRTUAL_P. 3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE). BINFO_VTABLE_PATH_MARKED. BINFO_PUSHDECLS_MARKED. (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out). 4: BINFO_NEW_VTABLE_MARKED. TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR, or FIELD_DECL). 5: TYPE_USES_PVBASES (in a class TYPE). 6: Not used. Usage of TYPE_LANG_FLAG_?: 0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE). 1: TYPE_HAS_CONSTRUCTOR. 2: TYPE_HAS_DESTRUCTOR. 3: TYPE_FOR_JAVA. 4: TYPE_NEEDS_DESTRUCTOR. 5: IS_AGGR_TYPE. 6: TYPE_BUILT_IN. Usage of DECL_LANG_FLAG_?: 0: DECL_ERROR_REPORTED (in VAR_DECL). DECL_TEMPLATE_PARM_P (in CONST_DECL, TYPE_DECL, or TEMPLATE_DECL) 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL). DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL) 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL). 3: DECL_IN_AGGR_P. 4: DECL_MAYBE_TEMPLATE. 5: DECL_INTERFACE_KNOWN. 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL). 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL). Usage of language-independent fields in a language-dependent manner: TYPE_ALIAS_SET This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so forth as a substitute for the mark bits provided in `lang_type'. At present, only the six low-order bits are used. TYPE_BINFO For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO. For a TYPENAME_TYPE, this is TYPENAME_TYPE_FULLNAME. For a TEMPLATE_TEMPLATE_PARM, this is TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. DECL_SAVED_INSNS/DECL_FIELD_SIZE For a static VAR_DECL, this is DECL_INIT_PRIORITY.*//* Language-dependent contents of an identifier. */struct lang_identifier{ struct tree_identifier ignore; tree namespace_bindings; tree bindings; tree class_value; tree class_template_info; struct lang_id2 *x;};struct lang_id2{ tree label_value, implicit_decl; tree error_locus;};typedef struct { tree t; int new_type_flag;} flagged_type_tree;typedef struct { char common[sizeof (struct tree_common)]; struct rtx_def *rtl; /* Unused, but required to match up with what the middle-end expects. */ HOST_WIDE_INT index; HOST_WIDE_INT level; HOST_WIDE_INT orig_level; tree decl;} template_parm_index;typedef struct ptrmem_cst{ char common[sizeof (struct tree_common)]; tree member;}* ptrmem_cst_t;/* Nonzero if this binding is for a local scope, as opposed to a class or namespace scope. */#define LOCAL_BINDING_P(NODE) TREE_LANG_FLAG_0(NODE)/* Nonzero if BINDING_VALUE is from a base class of the class which is currently being defined. */#define INHERITED_VALUE_BINDING_P(NODE) TREE_LANG_FLAG_1(NODE)/* For a binding between a name and an entity at a non-local scope, defines the scope where the binding is declared. (Either a class _TYPE node, or a NAMESPACE_DECL.) This macro should be used only for namespace-level bindings; on the IDENTIFIER_BINDING list BINDING_LEVEL is used instead. */#define BINDING_SCOPE(NODE) (((struct tree_binding*)NODE)->scope.scope)/* This is the declaration bound to the name. Possible values: variable, overloaded function, namespace, template, enumerator. */#define BINDING_VALUE(NODE) (((struct tree_binding*)NODE)->value)/* If name is bound to a type, this is the type (struct, union, enum). */#define BINDING_TYPE(NODE) TREE_TYPE(NODE)#define IDENTIFIER_GLOBAL_VALUE(NODE) \ namespace_binding (NODE, global_namespace)#define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \ set_namespace_binding (NODE, global_namespace, VAL)#define IDENTIFIER_NAMESPACE_VALUE(NODE) \ namespace_binding (NODE, current_namespace)#define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \ set_namespace_binding (NODE, current_namespace, VAL)struct tree_binding{ char common[sizeof (struct tree_common)]; union { tree scope; struct binding_level *level; } scope; tree value;};/* The overloaded FUNCTION_DECL. */#define OVL_FUNCTION(NODE) (((struct tree_overload*)NODE)->function)#define OVL_CHAIN(NODE) TREE_CHAIN(NODE)/* Polymorphic access to FUNCTION and CHAIN. */#define OVL_CURRENT(NODE) \ ((TREE_CODE(NODE)==OVERLOAD) ? OVL_FUNCTION(NODE) : NODE)#define OVL_NEXT(NODE) \ ((TREE_CODE(NODE)==OVERLOAD) ? TREE_CHAIN(NODE) : NULL_TREE)/* If set, this was imported in a using declaration. This is not to confuse with being used somewhere, which is not important for this node. */#define OVL_USED(NODE) TREE_USED(NODE)struct tree_overload{ char common[sizeof (struct tree_common)]; tree function;};/* A `baselink' is a TREE_LIST whose TREE_PURPOSE is a BINFO indicating a particular base class, and whose TREE_VALUE is a (possibly overloaded) function from that base class. */#define BASELINK_P(NODE) \ (TREE_CODE ((NODE)) == TREE_LIST && TREE_LANG_FLAG_1 ((NODE)))#define SET_BASELINK_P(NODE) \ (TREE_LANG_FLAG_1 ((NODE)) = 1)#define WRAPPER_PTR(NODE) (((struct tree_wrapper*)NODE)->u.ptr)#define WRAPPER_INT(NODE) (((struct tree_wrapper*)NODE)->u.i)struct tree_wrapper{ char common[sizeof (struct tree_common)]; union { void *ptr; int i; } u;};#define SRCLOC_FILE(NODE) (((struct tree_srcloc*)NODE)->filename)#define SRCLOC_LINE(NODE) (((struct tree_srcloc*)NODE)->linenum)struct tree_srcloc{ char common[sizeof (struct tree_common)]; char *filename; int linenum;};/* To identify to the debug emitters if it should pay attention to the flag `-Wtemplate-debugging'. */#define HAVE_TEMPLATES 1/* Macros for access to language-specific slots in an identifier. */#define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \ (((struct lang_identifier *)(NODE))->namespace_bindings)#define IDENTIFIER_TEMPLATE(NODE) \ (((struct lang_identifier *)(NODE))->class_template_info)/* The IDENTIFIER_BINDING is the innermost CPLUS_BINDING for the identifier. It's TREE_CHAIN is the next outermost binding. Each BINDING_VALUE is a DECL for the associated declaration. Thus, name lookup consists simply of pulling off the node at the front of the list (modulo oddities for looking up the names of types, and such.) You can use BINDING_SCOPE or BINDING_LEVEL to determine the scope that bound the name. */#define IDENTIFIER_BINDING(NODE) \ (((struct lang_identifier*) (NODE))->bindings)/* The IDENTIFIER_VALUE is the value of the IDENTIFIER_BINDING, or NULL_TREE if there is no binding. */#define IDENTIFIER_VALUE(NODE) \ (IDENTIFIER_BINDING (NODE) \ ? BINDING_VALUE (IDENTIFIER_BINDING (NODE)) \ : NULL_TREE)/* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current class, and IDENTIFIER_CLASS_VALUE is the value binding. This is just a pointer to the BINDING_VALUE of one of the bindings in the IDENTIFIER_BINDINGs list, so any time that this is non-NULL so is IDENTIFIER_BINDING. */#define IDENTIFIER_CLASS_VALUE(NODE) \ (((struct lang_identifier *) (NODE))->class_value)/* The amount of time used by the file whose special "time identifier" is NODE, represented as an INTEGER_CST. See get_time_identifier. */#define TIME_IDENTIFIER_TIME(NODE) IDENTIFIER_BINDING(NODE)/* For a "time identifier" this is a INTEGER_CST. The TREE_INT_CST_LOW is 1 if the corresponding file is "interface only". The TRE_INT_CST_HIGH is 1 if it is "interface unknown". */#define TIME_IDENTIFIER_FILEINFO(NODE) IDENTIFIER_CLASS_VALUE (NODE)/* TREE_TYPE only indicates on local and class scope the current type. For namespace scope, the presence of a type in any namespace is indicated with global_type_node, and the real type behind must be found through lookup. */#define IDENTIFIER_TYPE_VALUE(NODE) (identifier_type_value(NODE))#define REAL_IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE))#define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE)#define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)#define LANG_ID_FIELD(NAME,NODE) \ (((struct lang_identifier *)(NODE))->x \ ? ((struct lang_identifier *)(NODE))->x->NAME : 0)#define SET_LANG_ID(NODE,VALUE,NAME) \ (((struct lang_identifier *)(NODE))->x == 0 \ ? ((struct lang_identifier *)(NODE))->x \ = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \ ((struct lang_identifier *)(NODE))->x->NAME = (VALUE))#define IDENTIFIER_LABEL_VALUE(NODE) LANG_ID_FIELD(label_value, NODE)#define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE) \ SET_LANG_ID(NODE, VALUE, label_value)#define IDENTIFIER_IMPLICIT_DECL(NODE) LANG_ID_FIELD(implicit_decl, NODE)#define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \ SET_LANG_ID(NODE, VALUE, implicit_decl)#define IDENTIFIER_ERROR_LOCUS(NODE) LANG_ID_FIELD(error_locus, NODE)#define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE) \ SET_LANG_ID(NODE, VALUE, error_locus)#define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE)/* Nonzero if this identifier is the prefix for a mangled C++ operator name. */#define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE)/* Nonzero if this identifier is the name of a type-conversion operator. */#define IDENTIFIER_TYPENAME_P(NODE) \ (! strncmp (IDENTIFIER_POINTER (NODE), \ OPERATOR_TYPENAME_FORMAT, \ strlen (OPERATOR_TYPENAME_FORMAT)))/* Nonzero means reject anything that ANSI standard C forbids. */extern int pedantic;/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */#define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -