2000-05-23 Mark Mitchell <mark@codesourcery.com>
+ * 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
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)
if (is_overloaded_fn (fdecl))
flist = fdecl;
- else if (! DECL_LANG_SPECIFIC (fdecl))
- my_friendly_abort (20000221);
if (! old_value)
;
*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;
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);
{
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));
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.
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;
#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) \
/* 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. */
/* 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)
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);
{
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);
}
}
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;
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. */
/* 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. */
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. */
/* 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. */
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))
+ if (TREE_CODE (node) == FIELD_DECL)
{
- indent_to (file, indent + 3);
- fprintf (file, " mutable ");
+ if (DECL_MUTABLE_P (node))
+ {
+ indent_to (file, indent + 3);
+ fprintf (file, " mutable ");
+ }
+ return;
}
- if (TREE_CODE (node) == FIELD_DECL)
+
+ if (!DECL_LANG_SPECIFIC (node))
return;
indent_to (file, indent + 3);
if (TREE_CODE (node) == FUNCTION_DECL
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);
}
/* 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));)
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);
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;
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. */
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,
{
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);
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);
/* 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);
}