#define _CP_TREE_H
/* Usage of TREE_LANG_FLAG_?:
- 0: TREE_NONLOCAL_FLAG (in TREE_LIST or _TYPE).
- BINFO_MARKED (BINFO nodes).
+ 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).
TREE_INDIRECT_USING (in NAMESPACE_DECL).
IDENTIFIER_MARKED (used by search routines).
LOCAL_BINDING_P (in CPLUS_BINDING)
- 1: IDENTIFIER_VIRTUAL_P.
+ 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.
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_id2
{
tree label_value, implicit_decl;
- tree type_desc, as_list, error_locus;
+ tree error_locus;
};
typedef struct
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
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)
? BINDING_VALUE (IDENTIFIER_BINDING (NODE)) \
: NULL_TREE)
-/* If we are currently in class scope, then IDENTIFIER_CLASS_VALUE
- indicates the class-scoped binding of NODE. 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 set so is
+/* 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)
#define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \
SET_LANG_ID(NODE, VALUE, implicit_decl)
-#define IDENTIFIER_AS_DESC(NODE) LANG_ID_FIELD(type_desc, NODE)
-#define SET_IDENTIFIER_AS_DESC(NODE,DESC) \
- SET_LANG_ID(NODE, DESC, type_desc)
-
-#define IDENTIFIER_AS_LIST(NODE) LANG_ID_FIELD(as_list, NODE)
-#define SET_IDENTIFIER_AS_LIST(NODE,LIST) \
- SET_LANG_ID(NODE, LIST, as_list)
-
#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)
unsigned non_aggregate : 1;
unsigned is_partial_instantiation : 1;
unsigned has_mutable : 1;
+ unsigned com_interface : 1;
+ /* When adding a flag here, consider whether or not it ought to
+ apply to a template instance if it applies to the template.
+ If so, make sure to copy it in instantiate_class_template! */
/* The MIPS compiler gets it wrong if this struct also
does not fill out to a multiple of 4 bytes. Add a
member `dummy' with new bits if you go over the edge. */
- unsigned dummy : 11;
+ unsigned dummy : 10;
} type_flags;
- int n_ancestors;
- int n_vancestors;
int vsize;
- int max_depth;
int vfield_parent;
- union tree_node *baselink_vec;
union tree_node *vfields;
union tree_node *vbases;
union tree_node *size;
- union tree_node *base_init_list;
union tree_node *abstract_virtuals;
- union tree_node *as_list;
- union tree_node *id_as_list;
- union tree_node *binfo_as_list;
union tree_node *friend_classes;
union tree_node *rtti;
(TYPE_NEEDS_DESTRUCTOR (NODE) \
|| (TYPE_LANG_SPECIFIC (NODE) && TYPE_VEC_DELETE_TAKES_SIZE (NODE)))
-/* Nonzero for TREE_LIST or _TYPE node means that this node is class-local. */
-#define TREE_NONLOCAL_FLAG(NODE) (TREE_LANG_FLAG_0 (NODE))
-
/* Nonzero means that this _CLASSTYPE node defines ways of converting
itself to other types. */
#define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
signature reference type. */
#define SIGNATURE_REFERENCE_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_reference_to)
-/* The is the VAR_DECL that contains NODE's rtti. */
+/* The is the basetype that contains NODE's rtti. */
#define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC(NODE)->rtti)
/* Nonzero means that this _CLASSTYPE node overloads operator(). */
? TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), 2) \
: NULL_TREE;
-/* Pointer from any member function to the head of the list of
- member functions of the type that member function belongs to. */
-#define CLASSTYPE_BASELINK_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->baselink_vec)
-
/* Mark bits for depth-first and breath-first searches. */
/* Get the value of the Nth mark bit. */
#define CLASSTYPE_N_BASECLASSES(NODE) \
(TYPE_BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0)
-/* Memoize the number of super classes (base classes) that this node
- has. That way we can know immediately (albeit conservatively how
- large a multiple-inheritance matrix we need to build to find
- derivation information. */
-#define CLASSTYPE_N_SUPERCLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_ancestors)
-#define CLASSTYPE_N_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_vancestors)
-
-/* Record how deep the inheritance is for this class so `void*' conversions
- are less favorable than a conversion to the most base type. */
-#define CLASSTYPE_MAX_DEPTH(NODE) (TYPE_LANG_SPECIFIC(NODE)->max_depth)
-
/* Used for keeping search-specific information. Any search routine
which uses this must define what exactly this slot is used for. */
#define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)
#define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
#define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
-/* A cons list of structure elements which either have constructors
- to be called, or virtual function table pointers which
- need initializing. Depending on what is being initialized,
- the TREE_PURPOSE and TREE_VALUE fields have different meanings:
-
- Member initialization: <FIELD_DECL, TYPE>
- Base class construction: <NULL_TREE, BASETYPE>
- Base class initialization: <BASE_INITIALIZATION, THESE_INITIALIZATIONS>
- Whole type: <MEMBER_INIT, BASE_INIT>. */
-#define CLASSTYPE_BASE_INIT_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->base_init_list)
-
/* A cons list of virtual functions which cannot be inherited by
derived classes. When deriving from this type, the derived
class must provide its own definition for each of these functions. */
#define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_mutable)
#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
-/* Many routines need to cons up a list of basetypes for access
- checking. This field contains a TREE_LIST node whose TREE_VALUE
- is the main variant of the type, and whose TREE_VIA_PUBLIC
- and TREE_VIA_VIRTUAL bits are correctly set. */
-#define CLASSTYPE_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->as_list)
-/* Same, but cache a list whose value is the name of this type. */
-#define CLASSTYPE_ID_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->id_as_list)
-/* Same, but cache a list whose value is the binfo of this type. */
-#define CLASSTYPE_BINFO_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->binfo_as_list)
+/* Nonzero means that this type is meant for communication via COM. */
+#define CLASSTYPE_COM_INTERFACE(NODE) \
+ (TYPE_LANG_SPECIFIC(NODE)->type_flags.com_interface)
/* A list of class types of which this type is a friend. The
TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
equivalently, no throw specification. */
#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
+/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */
+#define TYPE_NOTHROW_P(NODE) \
+ (TYPE_RAISES_EXCEPTIONS (NODE) \
+ && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE)
+
/* The binding level associated with the namespace. */
#define NAMESPACE_LEVEL(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.level)
\f
unsigned operator_attr : 1;
unsigned constructor_attr : 1;
- unsigned returns_first_arg : 1;
- unsigned preserves_first_arg : 1;
unsigned friend_attr : 1;
unsigned static_function : 1;
unsigned const_memfunc : 1;
unsigned needs_final_overrider : 1;
unsigned bitfield : 1;
unsigned defined_in_class : 1;
- unsigned dummy : 1;
+ unsigned dummy : 3;
tree access;
tree context;
for an object with virtual baseclasses. */
#define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
+/* Non-zero for a FUNCTION_DECL that declares a type-info function. */
+#define DECL_TINFO_FN_P(NODE) \
+ (TREE_CODE (NODE) == FUNCTION_DECL \
+ && DECL_ARTIFICIAL (NODE) \
+ && DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
+
+/* Mark NODE as a type-info function. */
+#define SET_DECL_TINFO_FN_P(NODE) \
+ (DECL_LANG_SPECIFIC((NODE))->decl_flags.mutable_flag = 1)
+
/* For FUNCTION_DECLs: nonzero means that this function is a default
implementation of a signature method. */
#define IS_DEFAULT_IMPLEMENTATION(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_default_implementation)
-/* For FUNCTION_DECLs: nonzero means that the constructor
- is known to return a non-zero `this' unchanged. */
-#define DECL_RETURNS_FIRST_ARG(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.returns_first_arg)
-
-/* Nonzero for FUNCTION_DECL means that this constructor is known to
- not make any assignment to `this', and therefore can be trusted
- to return it unchanged. Otherwise, we must re-assign `current_class_ptr'
- after performing base initializations. */
-#define DECL_PRESERVES_THIS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.preserves_first_arg)
-
/* Nonzero for _DECL means that this decl appears in (or will appear
in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
detecting circularity in case members are multiply defined. In the
#define ORIGINAL_NAMESPACE(NODE) \
(DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
+/* In a non-local VAR_DECL with static storage duration, this is the
+ initialization priority. If this value is zero, the NODE will be
+ initialized at the DEFAULT_INIT_PRIORITY. */
+#define DECL_INIT_PRIORITY(NODE) (DECL_FIELD_SIZE ((NODE)))
+
/* In a TREE_LIST concatenating using directives, indicate indirekt
directives */
#define TREE_INDIRECT_USING(NODE) ((NODE)->common.lang_flag_0)
#define COMPARE_REDECLARATION 4 /* The comparsion is being done when
another declaration of an existing
entity is seen. */
+#define COMPARE_NO_ATTRIBUTES 8 /* The comparison should ignore
+ extra-linguistic type attributes. */
/* Used with push_overloaded_decl. */
#define PUSH_GLOBAL 0 /* Push the DECL into namespace scope,
extern int enforce_access PROTO((tree, tree));
extern tree convert_default_arg PROTO((tree, tree, tree));
extern tree convert_arg_to_ellipsis PROTO((tree));
+extern int is_properly_derived_from PROTO((tree, tree));
/* in class.c */
extern tree build_vbase_path PROTO((enum tree_code, tree, tree, tree, int));
extern tree get_vfield_offset PROTO((tree));
extern void duplicate_tag_error PROTO((tree));
extern tree finish_struct PROTO((tree, tree, int));
-extern tree finish_struct_1 PROTO((tree, int));
+extern void finish_struct_1 PROTO((tree, int));
extern int resolves_to_fixed_type_p PROTO((tree, int *));
extern void init_class_processing PROTO((void));
extern int is_empty_class PROTO((tree));
extern void pushclass PROTO((tree, int));
-extern void popclass PROTO((int));
+extern void popclass PROTO((void));
extern void push_nested_class PROTO((tree, int));
-extern void pop_nested_class PROTO((int));
+extern void pop_nested_class PROTO((void));
extern void push_lang_context PROTO((tree));
extern void pop_lang_context PROTO((void));
extern tree instantiate_type PROTO((tree, tree, int));
extern void print_class_statistics PROTO((void));
extern void maybe_push_cache_obstack PROTO((void));
-extern unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *));
+extern unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *, tree));
extern void build_self_reference PROTO((void));
extern void warn_hidden PROTO((tree));
extern tree get_enclosing_class PROTO((tree));
int is_base_of_enclosing_class PROTO((tree, tree));
extern void unreverse_member_declarations PROTO((tree));
+extern void invalidate_class_lookup_cache PROTO((void));
+extern void maybe_note_name_used_in_class PROTO((tree, tree));
+extern void note_name_declared_in_class PROTO((tree, tree));
/* in cvt.c */
extern tree convert_to_reference PROTO((tree, tree, int, int, tree));
extern void add_block_current_level PROTO((tree));
extern void set_block PROTO((tree));
extern void pushlevel_class PROTO((void));
-extern tree poplevel_class PROTO((int));
extern void print_binding_stack PROTO((void));
extern void print_binding_level PROTO((struct binding_level *));
extern void push_namespace PROTO((tree));
extern tree push_using_decl PROTO((tree, tree));
extern tree push_using_directive PROTO((tree));
extern void push_class_level_binding PROTO((tree, tree));
-extern tree push_using_decl PROTO((tree, tree));
extern tree implicitly_declare PROTO((tree));
extern tree lookup_label PROTO((tree));
extern tree shadow_label PROTO((tree));
extern tree maybe_build_cleanup PROTO((tree));
extern void cplus_expand_expr_stmt PROTO((tree));
extern void finish_stmt PROTO((void));
-extern int id_in_current_class PROTO((tree));
extern void push_cp_function_context PROTO((tree));
extern void pop_cp_function_context PROTO((tree));
extern int in_function_p PROTO((void));
extern void replace_defarg PROTO((tree, tree));
extern void print_other_binding_stack PROTO((struct binding_level *));
extern void revert_static_member_fn PROTO((tree*, tree*, tree*));
-extern void cat_namespace_levels PROTO((void));
extern void fixup_anonymous_union PROTO((tree));
extern int check_static_variable_definition PROTO((tree, tree));
extern void push_local_binding PROTO((tree, tree, int));
-extern void push_class_binding PROTO((tree, tree));
+extern int push_class_binding PROTO((tree, tree));
extern tree check_default_argument PROTO((tree, tree));
extern tree push_overloaded_decl PROTO((tree, int));
+extern void clear_identifier_class_values PROTO((void));
+extern void storetags PROTO((tree));
+extern int vtable_decl_p PROTO((tree, void *));
+extern int vtype_decl_p PROTO((tree, void *));
+extern int sigtable_decl_p PROTO((tree, void *));
+typedef int (*walk_globals_pred) PROTO((tree, void *));
+typedef int (*walk_globals_fn) PROTO((tree *, void *));
+extern int walk_globals PROTO((walk_globals_pred,
+ walk_globals_fn,
+ void *));
+typedef int (*walk_namespaces_fn) PROTO((tree, void *));
+extern int walk_namespaces PROTO((walk_namespaces_fn,
+ void *));
+extern int wrapup_globals_for_namespace PROTO((tree, void *));
/* in decl2.c */
extern int check_java_method PROTO((tree));
extern void comdat_linkage PROTO((tree));
extern void import_export_class PROTO((tree));
extern void import_export_vtable PROTO((tree, tree, int));
-extern int walk_vtables PROTO((void (*)(tree, tree),
- int (*)(tree, tree)));
-extern void walk_sigtables PROTO((void (*)(tree, tree),
- void (*)(tree, tree)));
extern void import_export_decl PROTO((tree));
extern tree build_cleanup PROTO((tree));
extern void finish_file PROTO((void));
extern void mark_used PROTO((tree));
extern tree handle_class_head PROTO((tree, tree, tree));
extern tree lookup_arg_dependent PROTO((tree, tree, tree));
+extern void finish_static_data_member_decl PROTO((tree, tree, tree, int, int));
/* in errfn.c */
/* The cp_* functions aren't suitable for ATTRIBUTE_PRINTF. */
extern void cp_pedwarn_at PVPROTO((const char *, ...));
extern void cp_compiler_error PVPROTO((const char *, ...));
extern void cp_sprintf PVPROTO((const char *, ...));
+extern void cp_deprecated PROTO((const char*));
/* in error.c */
extern void init_error PROTO((void));
/* friend.c */
extern int is_friend PROTO((tree, tree));
extern void make_friend_class PROTO((tree, tree));
+extern void add_friend PROTO((tree, tree));
+extern void add_friends PROTO((tree, tree, tree));
extern tree do_friend PROTO((tree, tree, tree, tree, enum overload_flags, tree, int));
/* in init.c */
extern void maybe_check_template_type PROTO((tree));
extern tree most_specialized_instantiation PROTO((tree, tree));
extern void print_candidates PROTO((tree));
+extern int instantiate_pending_templates PROTO((void));
extern int processing_specialization;
extern int processing_explicit_instantiation;
extern int get_base_distance PROTO((tree, tree, int, tree *));
extern int accessible_p PROTO((tree, tree));
extern tree lookup_field PROTO((tree, tree, int, int));
-extern tree lookup_nested_field PROTO((tree, int));
extern int lookup_fnfields_1 PROTO((tree, tree));
extern tree lookup_fnfields PROTO((tree, tree, int));
extern tree lookup_member PROTO((tree, tree, int, int));
extern tree lookup_nested_tag PROTO((tree, tree));
extern tree get_matching_virtual PROTO((tree, tree, int));
extern tree get_abstract_virtuals PROTO((tree));
-extern tree get_baselinks PROTO((tree, tree, tree));
-extern tree next_baselink PROTO((tree));
extern tree init_vbase_pointers PROTO((tree, tree));
extern void expand_indirect_vtbls_init PROTO((tree, tree, tree));
extern void clear_search_slots PROTO((tree));
extern tree finish_template_template_parm PROTO((tree, tree));
extern tree finish_parmlist PROTO((tree, int));
extern tree begin_class_definition PROTO((tree));
-extern tree finish_class_definition PROTO((tree, tree, int));
+extern tree finish_class_definition PROTO((tree, tree, int, int));
extern void finish_default_args PROTO((void));
extern void begin_inline_definitions PROTO((void));
+extern void finish_inline_definitions PROTO((void));
extern tree finish_member_class_template PROTO((tree));
extern void finish_template_decl PROTO((tree));
extern tree finish_template_type PROTO((tree, tree, int));
extern int layout_basetypes PROTO((tree, int));
extern tree build_vbase_pointer_fields PROTO((tree));
extern tree build_base_fields PROTO((tree));
-extern tree hash_tree_cons PROTO((int, int, int, tree, tree, tree));
+extern tree hash_tree_cons PROTO((tree, tree, tree));
extern tree hash_tree_chain PROTO((tree, tree));
extern tree hash_chainon PROTO((tree, tree));
-extern tree get_decl_list PROTO((tree));
extern tree make_binfo PROTO((tree, tree, tree, tree));
extern tree binfo_value PROTO((tree, tree));
extern tree reverse_path PROTO((tree));
extern tree maybe_dummy_object PROTO((tree, tree *));
extern int is_dummy_object PROTO((tree));
extern tree search_tree PROTO((tree, tree (*)(tree)));
+extern int cp_valid_lang_attribute PROTO((tree, tree, tree, tree));
+
#define scratchalloc expralloc
#define scratch_tree_cons expr_tree_cons
#define build_scratch_list build_expr_list
#define make_scratch_vec make_temp_vec
#define push_scratch_obstack push_expression_obstack
-#define hash_tree_cons_simple(PURPOSE, VALUE, CHAIN) \
- hash_tree_cons (0, 0, 0, (PURPOSE), (VALUE), (CHAIN))
/* in typeck.c */
extern int string_conv_p PROTO((tree, tree, int));
extern tree build_function_call_maybe PROTO((tree, tree));
extern tree convert_arguments PROTO((tree, tree, tree, int));
extern tree build_x_binary_op PROTO((enum tree_code, tree, tree));
-extern tree build_binary_op PROTO((enum tree_code, tree, tree, int));
+extern tree build_binary_op PROTO((enum tree_code, tree, tree));
extern tree build_binary_op_nodefault PROTO((enum tree_code, tree, tree, enum tree_code));
-extern tree build_component_addr PROTO((tree, tree, const char *));
extern tree build_x_unary_op PROTO((enum tree_code, tree));
extern tree build_unary_op PROTO((enum tree_code, tree, int));
extern tree unary_complex_lvalue PROTO((enum tree_code, tree));