diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d9ebe0369e2..97b525dc4e8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,34 @@ 2000-05-23 Mark Mitchell + * cp-tree.h (lang_decl_flags): Rename mutable_flag to uninlinable + and bitfield to tinfo_fn_p. + (DECL_TINFO_FN_P): Adjust. + (SET_DECL_TINFO_FN_P): Likewise. + (DECL_MUTABLE_P): Likewise. + (DECL_C_BIT_FIELD): Likewise. + (SET_DECL_C_BIT_FIELD): Likewise. + (CLEAR_DECL_C_BIT_FIELD): Likewise. + (DECL_UNINLINABLE): Likewise. + * class.c (alter_access): Call retrofit_lang_decl if ncessary. + (handle_using_decl): Remove assertion. + (build_vtbl_or_vbase_field): Use build_decl, not build_lang_decl, + to build FIELD_DECLs. + (build_base_field): Likewise. + (layout_class_type): Likewise. + * decl.c (init_decl_processing): Likewise. + (build_ptrmemfunc_type): Likewise. + (grokdeclarator): Likewise. + * decl2.c (grok_x_components): Likewise. + * except.c (call_eh_info): Likewise. + * init.c (init_init_processing): Likewise. + * rtti.c (expand_class_desc): Likewise. + (create_pseudo_type_info): Likewise. + (get_vmi_pseudo_type_info): Likewise. + (create_tinfo_types): Likewise. + * ptree.c (print_lang_decl): Adjust. + * typeck.c (build_component_ref): Don't check DECL_LANG_SPECIFIC + before checking DECL_MUTABLE_P. + * decl2.c (maybe_retrofit_in_chrg): Don't create in-charge parameters for template functions. * pt.c (tsubst_decl): Make sure we call maybe_retrofit_in_chrg for diff --git a/gcc/cp/class.c b/gcc/cp/class.c index e83c916fe10..b86bac460c0 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1435,7 +1435,12 @@ alter_access (t, fdecl, access) tree fdecl; tree access; { - tree elem = purpose_member (t, DECL_ACCESS (fdecl)); + tree elem; + + if (!DECL_LANG_SPECIFIC (fdecl)) + retrofit_lang_decl (fdecl); + + elem = purpose_member (t, DECL_ACCESS (fdecl)); if (elem) { if (TREE_VALUE (elem) != access) @@ -1516,8 +1521,6 @@ handle_using_decl (using_decl, t) if (is_overloaded_fn (fdecl)) flist = fdecl; - else if (! DECL_LANG_SPECIFIC (fdecl)) - my_friendly_abort (20000221); if (! old_value) ; @@ -3540,7 +3543,7 @@ build_vtbl_or_vbase_field (name, assembler_name, type, class_type, fcontext, *empty_p = 0; /* Build the FIELD_DECL. */ - field = build_lang_decl (FIELD_DECL, name, type); + field = build_decl (FIELD_DECL, name, type); DECL_ASSEMBLER_NAME (field) = assembler_name; DECL_VIRTUAL_P (field) = 1; DECL_ARTIFICIAL (field) = 1; @@ -3760,7 +3763,7 @@ build_base_field (rli, binfo, empty_p, base_align, v) location information. */ return; - decl = build_lang_decl (FIELD_DECL, NULL_TREE, basetype); + decl = build_decl (FIELD_DECL, NULL_TREE, basetype); DECL_ARTIFICIAL (decl) = 1; DECL_FIELD_CONTEXT (decl) = rli->t; DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype); @@ -4755,7 +4758,7 @@ layout_class_type (t, empty_p, vfuns_p, { tree padding; - padding = build_lang_decl (FIELD_DECL, NULL_TREE, char_type_node); + padding = build_decl (FIELD_DECL, NULL_TREE, char_type_node); place_field (rli, padding); TYPE_NONCOPIED_PARTS (t) = tree_cons (NULL_TREE, padding, TYPE_NONCOPIED_PARTS (t)); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 1cc9740a3f7..d58a5a50fab 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -90,8 +90,10 @@ Boston, MA 02111-1307, USA. */ 0: DECL_ERROR_REPORTED (in VAR_DECL). DECL_TEMPLATE_PARM_P (in CONST_DECL, TYPE_DECL, or TEMPLATE_DECL) DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL) + DECL_MUTABLE_P (in FIELD_DECL) 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL). DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL) + DECL_C_BITFIELD (in FIELD_DECL) 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL). DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL) 3: DECL_IN_AGGR_P. @@ -1829,20 +1831,20 @@ struct lang_decl_flags unsigned static_function : 1; unsigned pure_virtual : 1; unsigned has_in_charge_parm_p : 1; - unsigned bitfield : 1; + unsigned uninlinable : 1; - unsigned mutable_flag : 1; unsigned deferred : 1; unsigned use_template : 2; unsigned nonconverting : 1; unsigned declared_inline : 1; unsigned not_really_extern : 1; unsigned needs_final_overrider : 1; - unsigned defined_in_class : 1; + unsigned pending_inline_p : 1; unsigned global_ctor_p : 1; unsigned global_dtor_p : 1; + unsigned tinfo_fn_p : 1; unsigned dummy : 4; tree context; @@ -1989,11 +1991,11 @@ struct lang_decl #define DECL_TINFO_FN_P(NODE) \ (TREE_CODE (NODE) == FUNCTION_DECL \ && DECL_ARTIFICIAL (NODE) \ - && DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag) + && DECL_LANG_SPECIFIC(NODE)->decl_flags.tinfo_fn_p) /* Mark NODE as a type-info function. */ #define SET_DECL_TINFO_FN_P(NODE) \ - (DECL_LANG_SPECIFIC((NODE))->decl_flags.mutable_flag = 1) + (DECL_LANG_SPECIFIC((NODE))->decl_flags.tinfo_fn_p = 1) /* Nonzero if NODE is an overloaded `operator delete[]' function. */ #define DECL_ARRAY_DELETE_OPERATOR_P(NODE) \ @@ -2055,7 +2057,7 @@ struct lang_decl /* Nonzero for _DECL means that this member object type is mutable. */ -#define DECL_MUTABLE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag) +#define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE)) /* Nonzero for _DECL means that this constructor is a non-converting constructor. */ @@ -2427,16 +2429,15 @@ extern int flag_new_for_scope; /* In a FIELD_DECL, nonzero if the decl was originally a bitfield. */ #define DECL_C_BIT_FIELD(NODE) \ - (DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE))\ - && DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield) + (DECL_LANG_FLAG_1 (FIELD_DECL_CHECK (NODE)) == 1) #define SET_DECL_C_BIT_FIELD(NODE) \ - (DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE))->decl_flags.bitfield = 1) + (DECL_LANG_FLAG_1 (FIELD_DECL_CHECK (NODE)) = 1) #define CLEAR_DECL_C_BIT_FIELD(NODE) \ - (DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE))->decl_flags.bitfield = 0) + (DECL_LANG_FLAG_1 (FIELD_DECL_CHECK (NODE)) = 0) /* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */ #define DECL_UNINLINABLE(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield) + (DECL_LANG_SPECIFIC (NODE)->decl_flags.uninlinable) #define INTEGRAL_CODE_P(CODE) \ (CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2fd0fe109e0..41cdb8cfed5 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6384,12 +6384,12 @@ init_decl_processing () else { vtable_entry_type = make_aggr_type (RECORD_TYPE); - fields[0] = build_lang_decl (FIELD_DECL, delta_identifier, - delta_type_node); - fields[1] = build_lang_decl (FIELD_DECL, index_identifier, - delta_type_node); - fields[2] = build_lang_decl (FIELD_DECL, pfn_identifier, - ptr_type_node); + fields[0] = build_decl (FIELD_DECL, delta_identifier, + delta_type_node); + fields[1] = build_decl (FIELD_DECL, index_identifier, + delta_type_node); + fields[2] = build_decl (FIELD_DECL, pfn_identifier, + ptr_type_node); finish_builtin_type (vtable_entry_type, VTBL_PTR_TYPE, fields, 2, double_type_node); @@ -9031,24 +9031,24 @@ build_ptrmemfunc_type (type) { u = make_aggr_type (UNION_TYPE); SET_IS_AGGR_TYPE (u, 0); - fields[0] = build_lang_decl (FIELD_DECL, pfn_identifier, type); - fields[1] = build_lang_decl (FIELD_DECL, delta2_identifier, - delta_type_node); + fields[0] = build_decl (FIELD_DECL, pfn_identifier, type); + fields[1] = build_decl (FIELD_DECL, delta2_identifier, + delta_type_node); finish_builtin_type (u, "__ptrmemfunc_type", fields, 1, ptr_type_node); TYPE_NAME (u) = NULL_TREE; - fields[0] = build_lang_decl (FIELD_DECL, delta_identifier, - delta_type_node); - fields[1] = build_lang_decl (FIELD_DECL, index_identifier, - delta_type_node); - fields[2] = build_lang_decl (FIELD_DECL, pfn_or_delta2_identifier, u); + fields[0] = build_decl (FIELD_DECL, delta_identifier, + delta_type_node); + fields[1] = build_decl (FIELD_DECL, index_identifier, + delta_type_node); + fields[2] = build_decl (FIELD_DECL, pfn_or_delta2_identifier, u); finish_builtin_type (t, "__ptrmemfunc_type", fields, 2, ptr_type_node); } else { - fields[0] = build_lang_decl (FIELD_DECL, pfn_identifier, type); - fields[1] = build_lang_decl (FIELD_DECL, delta_identifier, - delta_type_node); + fields[0] = build_decl (FIELD_DECL, pfn_identifier, type); + fields[1] = build_decl (FIELD_DECL, delta_identifier, + delta_type_node); finish_builtin_type (t, "__ptrmemfunc_type", fields, 1, ptr_type_node); } @@ -11411,7 +11411,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) } else { - decl = build_lang_decl (FIELD_DECL, declarator, type); + decl = build_decl (FIELD_DECL, declarator, type); if (RIDBIT_SETP (RID_MUTABLE, specbits)) { DECL_MUTABLE_P (decl) = 1; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index c88779ca7ad..f97397f1cfd 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -914,7 +914,7 @@ grok_x_components (specs) return; fixup_anonymous_aggr (t); - finish_member_declaration (build_lang_decl (FIELD_DECL, NULL_TREE, t)); + finish_member_declaration (build_decl (FIELD_DECL, NULL_TREE, t)); /* Ignore any inline function definitions in the anonymous union since an anonymous union may not have function members. */ diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 91f75c257fe..ca73686a9c0 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -210,13 +210,13 @@ call_eh_info () /* struct cp_eh_info. This must match exception.cc. Note that this type is not pushed anywhere. */ t1= make_aggr_type (RECORD_TYPE); - fields[0] = build_lang_decl (FIELD_DECL, + fields[0] = build_decl (FIELD_DECL, get_identifier ("handler_label"), ptr_type_node); - fields[1] = build_lang_decl (FIELD_DECL, + fields[1] = build_decl (FIELD_DECL, get_identifier ("dynamic_handler_chain"), ptr_type_node); - fields[2] = build_lang_decl (FIELD_DECL, + fields[2] = build_decl (FIELD_DECL, get_identifier ("info"), ptr_type_node); - fields[3] = build_lang_decl (FIELD_DECL, + fields[3] = build_decl (FIELD_DECL, get_identifier ("table_index"), ptr_type_node); /* N.B.: The fourth field LEN is expected to be the number of fields - 1, not the total number of fields. */ @@ -224,32 +224,32 @@ call_eh_info () t1 = build_pointer_type (t1); t1= make_aggr_type (RECORD_TYPE); - fields[0] = build_lang_decl (FIELD_DECL, + fields[0] = build_decl (FIELD_DECL, get_identifier ("match_function"), ptr_type_node); - fields[1] = build_lang_decl (FIELD_DECL, + fields[1] = build_decl (FIELD_DECL, get_identifier ("language"), short_integer_type_node); - fields[2] = build_lang_decl (FIELD_DECL, + fields[2] = build_decl (FIELD_DECL, get_identifier ("version"), short_integer_type_node); /* N.B.: The fourth field LEN is expected to be the number of fields - 1, not the total number of fields. */ finish_builtin_type (t1, "__eh_info", fields, 2, ptr_type_node); t = make_aggr_type (RECORD_TYPE); - fields[0] = build_lang_decl (FIELD_DECL, - get_identifier ("eh_info"), t1); - fields[1] = build_lang_decl (FIELD_DECL, get_identifier ("value"), - ptr_type_node); - fields[2] = build_lang_decl (FIELD_DECL, get_identifier ("type"), - ptr_type_node); - fields[3] = build_lang_decl + fields[0] = build_decl (FIELD_DECL, + get_identifier ("eh_info"), t1); + fields[1] = build_decl (FIELD_DECL, get_identifier ("value"), + ptr_type_node); + fields[2] = build_decl (FIELD_DECL, get_identifier ("type"), + ptr_type_node); + fields[3] = build_decl (FIELD_DECL, get_identifier ("cleanup"), build_pointer_type (build_function_type (ptr_type_node, tree_cons (NULL_TREE, ptr_type_node, void_list_node)))); - fields[4] = build_lang_decl (FIELD_DECL, get_identifier ("caught"), - boolean_type_node); - fields[5] = build_lang_decl (FIELD_DECL, get_identifier ("next"), - build_pointer_type (t)); - fields[6] = build_lang_decl + fields[4] = build_decl (FIELD_DECL, get_identifier ("caught"), + boolean_type_node); + fields[5] = build_decl (FIELD_DECL, get_identifier ("next"), + build_pointer_type (t)); + fields[6] = build_decl (FIELD_DECL, get_identifier ("handlers"), long_integer_type_node); /* N.B.: The fourth field LEN is expected to be the number of fields - 1, not the total number of fields. */ diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 3dbca4b2677..aece8ed4da3 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -68,7 +68,7 @@ void init_init_processing () /* Define the structure that holds header information for arrays allocated via operator new. */ BI_header_type = make_aggr_type (RECORD_TYPE); - fields[0] = build_lang_decl (FIELD_DECL, nelts_identifier, sizetype); + fields[0] = build_decl (FIELD_DECL, nelts_identifier, sizetype); /* Use the biggest alignment supported by the target to prevent operator new from returning misaligned pointers. */ diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c index 7a234a55a35..d3cd45eceac 100644 --- a/gcc/cp/ptree.c +++ b/gcc/cp/ptree.c @@ -32,16 +32,17 @@ print_lang_decl (file, node, indent) tree node; int indent; { - if (!DECL_LANG_SPECIFIC (node)) - return; - /* A FIELD_DECL only has the flags structure, which we aren't displaying - anyways. */ - if (DECL_MUTABLE_P (node)) - { - indent_to (file, indent + 3); - fprintf (file, " mutable "); - } if (TREE_CODE (node) == FIELD_DECL) + { + if (DECL_MUTABLE_P (node)) + { + indent_to (file, indent + 3); + fprintf (file, " mutable "); + } + return; + } + + if (!DECL_LANG_SPECIFIC (node)) return; indent_to (file, indent + 3); if (TREE_CODE (node) == FUNCTION_DECL diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index a7c13b52c4a..bde623f9eef 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -942,23 +942,23 @@ expand_class_desc (tdecl, type) base_desc_type_node = make_aggr_type (RECORD_TYPE); /* Actually const __user_type_info * */ - fields [0] = build_lang_decl + fields [0] = build_decl (FIELD_DECL, NULL_TREE, build_pointer_type (build_qualified_type (type_info_type_node, TYPE_QUAL_CONST))); - fields [1] = build_lang_decl + fields [1] = build_decl (FIELD_DECL, NULL_TREE, flag_new_abi ? intSI_type_node : unsigned_intSI_type_node); DECL_BIT_FIELD (fields[1]) = 1; DECL_SIZE (fields[1]) = bitsize_int (29); - fields [2] = build_lang_decl (FIELD_DECL, NULL_TREE, boolean_type_node); + fields [2] = build_decl (FIELD_DECL, NULL_TREE, boolean_type_node); DECL_BIT_FIELD (fields[2]) = 1; DECL_SIZE (fields[2]) = bitsize_one_node; /* Actually enum access */ - fields [3] = build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node); + fields [3] = build_decl (FIELD_DECL, NULL_TREE, integer_type_node); DECL_BIT_FIELD (fields[3]) = 1; DECL_SIZE (fields[3]) = bitsize_int (2); @@ -1758,7 +1758,7 @@ create_pseudo_type_info VPARAMS((const char *real_name, int ident, ...)) } /* First field is the pseudo type_info base class. */ - fields[0] = build_lang_decl (FIELD_DECL, NULL_TREE, ti_desc_type_node); + fields[0] = build_decl (FIELD_DECL, NULL_TREE, ti_desc_type_node); /* Now add the derived fields. */ for (ix = 0; (field_decl = va_arg (ap, tree));) @@ -1808,9 +1808,9 @@ get_vmi_pseudo_type_info (num_bases) desc = create_pseudo_type_info ("__vmi_class_type_info", num_bases, - build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node), - build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node), - build_lang_decl (FIELD_DECL, NULL_TREE, base_array), + build_decl (FIELD_DECL, NULL_TREE, integer_type_node), + build_decl (FIELD_DECL, NULL_TREE, integer_type_node), + build_decl (FIELD_DECL, NULL_TREE, base_array), NULL); pop_nested_namespace (abi_node); @@ -1841,8 +1841,8 @@ create_tinfo_types () tree fields[2]; ti_desc_type_node = make_aggr_type (RECORD_TYPE); - fields[0] = build_lang_decl (FIELD_DECL, NULL_TREE, const_ptr_type_node); - fields[1] = build_lang_decl (FIELD_DECL, NULL_TREE, const_string_type_node); + fields[0] = build_decl (FIELD_DECL, NULL_TREE, const_ptr_type_node); + fields[1] = build_decl (FIELD_DECL, NULL_TREE, const_string_type_node); finish_builtin_type (ti_desc_type_node, "__type_info_pseudo", fields, 1, ptr_type_node); TYPE_HAS_CONSTRUCTOR (ti_desc_type_node) = 1; @@ -1857,8 +1857,8 @@ create_tinfo_types () and pointer to the pointed to type. */ ptr_desc_type_node = create_pseudo_type_info ("__pointer_type_info", 0, - build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node), - build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info), + build_decl (FIELD_DECL, NULL_TREE, integer_type_node), + build_decl (FIELD_DECL, NULL_TREE, ptr_type_info), NULL); /* Array, function and enum type_info. No additional fields. */ @@ -1881,7 +1881,7 @@ create_tinfo_types () This is really a descendant of __class_type_info. */ si_class_desc_type_node = create_pseudo_type_info ("__si_class_type_info", 0, - build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info), + build_decl (FIELD_DECL, NULL_TREE, ptr_type_info), NULL); /* Base class internal helper. Pointer to base type, offset to base, @@ -1889,8 +1889,8 @@ create_tinfo_types () { tree fields[2]; - fields[0] = build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info); - fields[1] = build_lang_decl (FIELD_DECL, NULL_TREE, integer_types[itk_long]); + fields[0] = build_decl (FIELD_DECL, NULL_TREE, ptr_type_info); + fields[1] = build_decl (FIELD_DECL, NULL_TREE, integer_types[itk_long]); base_desc_type_node = make_aggr_type (RECORD_TYPE); finish_builtin_type (base_desc_type_node, "__base_class_type_info_pseudo", fields, 1, ptr_type_node); @@ -1905,9 +1905,9 @@ create_tinfo_types () This is really a descendant of __pointer_type_info. */ ptmd_desc_type_node = create_pseudo_type_info ("__pointer_to_member_type_info", 0, - build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node), - build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info), - build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info), + build_decl (FIELD_DECL, NULL_TREE, integer_type_node), + build_decl (FIELD_DECL, NULL_TREE, ptr_type_info), + build_decl (FIELD_DECL, NULL_TREE, ptr_type_info), NULL); pop_nested_namespace (abi_node); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 378fc6be6bd..c0927efbe00 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2242,7 +2242,7 @@ build_component_ref (datum, component, basetype_path, protect) /* A field is const (volatile) if the enclosing object, or the field itself, is const (volatile). But, a mutable field is not const, even within a const object. */ - if (DECL_LANG_SPECIFIC (field) && DECL_MUTABLE_P (field)) + if (DECL_MUTABLE_P (field)) type_quals &= ~TYPE_QUAL_CONST; field_type = cp_build_qualified_type (field_type, type_quals); }