1996-02-01 20:33:01 +01:00
|
|
|
|
/* RunTime Type Identification
|
builtins.c (c_strlen): Use size_diffop and return ssizetype value.
* builtins.c (c_strlen): Use size_diffop and return ssizetype value.
(expand_builtin_strcpy): Pass correct type to size_binop.
(expand_builtin_strcmp): Likewise.
Clean up conditional structure.
* c-decl.c (init_decl_processing): Don't call set_sizetype twice.
(complete_array_type): Don't use size_binop for MAXINDEX.
* c-typeck.c (c_sizeof): Use size_one_node and TYPE_SIZE_UNIT.
(c_sizeof_nowarn, c_size_in_bytes): Likewise.
(c_alignof): Use size_one_node.
(build_unary_op): Pass arg of proper type to size_binop.
(really_start_incremental_init, push_init_level): Use sizetype for
constructor{,_bit,_unfilled}_index.
(pop_init_label, output_init_element): Likewise.
(output_pending_init_elements, process_init_element): Likewise.
* calls.c (compute_argument_block_size): Field VAR is ssizetype.
* expr.c (store_expr): Use size_int.
(store_constructor): Use proper types for size_binop args.
(get_inner_reference, expand_expr, case ARRAY_REF): Likewise.
(expand_expr_unaligned): Likewise.
(string_contant): Return object of sizetype.
* expr.h (SUB_PARM_SIZE): Call size_diffop and pass proper types.
(ARGS_SIZE_RTX): Call ARGS_SIZE_TREE.
(ARGS_SIZE_TREE): Pass proper types to size_binop.
* fold-const.c (int_const_binop): Refine when size_int is called.
(fold_convert): Likewise.
(size_int_wide): Rework to take KIND as arg, only take low order
bits, handle new sizetype_tab datatype, and chain entries in
size_table.
(size_int_type_wide): New function.
(size_binop): Validate types of arguments.
(ssize_binop): Deleted.
(size_diffop): New function.
(extract_muldiv): Only fold division into multiplication for sizetypes.
* function.c (assign_parms): Use size_diffop and make sure
VAR field is of ssizetype; also pass proper type to size_binop.
(locate_and_pad_parm, pad_to_arg_alignment): Likewise.
(round_down): Deleted from here.
* store-layout.c (sizetype_tab): Now an array.
(sizetype_set, early_root_list): New variables.
(variable_size): Use size_one_node.
(round_up): Pass proper type to size_binop.
(round_down): Moved to here and corrected as above.
(layout_record): Pass proper arg types to size_binop.
(layout_type): Likewise.
If sizetype_set is zero, record the type just laid out.
(make_unsigned_type): Don't call set_sizetype;
(make_signed_type): Likewise; also, call fixup_signed_type.
(initialize_sizetypes): New function.
(set_sizetype): Make copy of types, set TYPE_IS_SIZETYPE, and
set name of bitsizetype to "bit_size_type".
Fix up type of sizes of all types made before call.
* tm.texi (ROUND_TYPE_SIZE_UNIT): New macro.
* tree.c (fix_sizetype): Deleted.
(build_common_tree_nodes): Call initialize_sizetypes.
(build_common_tree_nodes_2): Don't call fix_sizetype.
* tree.h (TYPE_IS_SIZETYPE): New macro.
(initialize_sizetype): New declaration.
(enum size_type_kind): New type.
(struct sizetype_tab): Deleted.
(sizetype_tab): Now array; adjust sizetype macros.
(size_diffop, size_int_type_wide): New functions.
(size_int_wide): Change number of args and type; access macros changed.
(ssize_int, sbitsize_int): New macros.
* config/i960/i960.h (ROUND_TYPE_SIZE): Use size_int.
(ROUND_TYPE_SIZE_UNIT): New macro.
* ch/actions.c (chill_convert_for_assignment): Don't use size_binop
for things that aren't sizes.
(expand_varying_length_assignment): Likewise.
* ch/convert.c (digest_array_tuple, convert): Likewise.
* ch/typeck.c (build_chill_slice, smash_dummy_type): Likewise.
(build_chill_slice_with_range): Likewise.
(build_chill_slice_with_length): Likewise.
(build_array_from_set): Adjust types for size_binop.
* ch/expr.c (build_concat_expr, build_chill_repetition_op): Likewise.
(build_chill_sizeof): Use TYPE_SIZE_UNIT.
* ch/tree.c (build_string_type): Pass proper type to size_binop.
* cp/class.c (dfs_build_vtable_offset_vtbl_entries): Don't use
size_binop on things that are not sizes; ssize_binop deleted.
Call size_diffop when appropriate.
(dfs_build_vcall_offset_vtbl_entries): Likewise.
(build_primary_vtable, build_secondary_vtable): Likewise.
(dfs_set_offset_for_unshared_vbases, dfs_modify_vtables): Likewise.
Variable I is HOST_WIDE_INT.
(get_vfield_offset): Pass proper types to size_binop.
(size_extra_vtbl_entries, layout_virtual_bases): Likewise.
(finish_struct_1): Likewise.
(skip_rtti_stuff): Arg N is now pointer to signed.
(layout_class_type): Use size_zero_node.
* cp/cp-tree.h (skip_rtti_stuff): Arg N is pointer to signed.
* cp/cvt.c (cp_convert_to_pointer): Pass proper types to size_binop.
* cp/decl.c (complete_arry_type): Pass proper types to size_binop.
(xref_basetypes): BINFO_OFFSET is sizetype.
* cp/error.c (dump_expr): Don't use size_binop non-sizes.
* cp/expr.c (cplus_expand_constant): Pass proper types to size_binop.
* cp/init.c (construct_virtual_bases): Fix type error.
(build_vec_delete_1): Pass proper type to size_binop and don't
fold result.
* cp/lex.c (cp_make_lang_type): BINFO_OFFSET is sizetype.
* cp/rtti.c (get_base_offset): Pass proper type to size_binop.
* cp/search.c (dfs_find_vbases): Fix type error.
(expand_upcast_fixups): Arg to skip_rtti_stuff is pointer to signed.
(dfs_get_vbase_types): BINFO_OFFSET is sizetype.
* cp/tree.c (debug_binfo): Variable N is signed.
Use HOST_WIDE_INT_PRINT_DEC.
* cp/typeck.c (comptypes): sizetype is same as equivalent integer type.
(c_sizeof, c_sizeof_nowarn, expr_sizeof): Use TYPE_SIZE_UNIT,
size_one_node and size_zero_node.
(c_alignof): Use size_one_node.
(build_component_addr): Pass proper types to size_binop.
(expand_ptrmemfunc_cst): Don't use size_binop on non-sizes.
* f/com.c (ffecom_arrayref_): Convert args to size_binop to proper
type.
(ffecom_tree_canonize_ptr_): Don't use size_binop for non-sizes.
(ffecom_tree_canonize_ref_): Likewise.
(type_for_mode): Handle TImode.
* f/ste.c (ffeste_io_dofio_, ffeste_io_douio_): Use TYPE_SIZE_UNIT.
(ffeste_io_ciclist_): Likewise.
* java/expr.c (build_java_ret): Pass proper type to size_binop.
From-SVN: r32225
2000-02-27 22:39:40 +01:00
|
|
|
|
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
|
|
|
|
|
Free Software Foundation, Inc.
|
1996-04-13 01:55:07 +02:00
|
|
|
|
Mostly written by Jason Merrill (jason@cygnus.com).
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
|
|
|
|
This file is part of GNU CC.
|
|
|
|
|
|
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the 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 of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with GNU CC; see the file COPYING. If not, write to
|
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
call.c: Include system.h.
* call.c: Include system.h. Remove includes, declarations and
defines provided by system.h.
* class.c, cvt.c, decl.c, decl2.c, errfn.c error.c: Likewise.
* except.c, expr.c friend.c, g++spec.c, init.c, input.c: Likewise.
* lex.c, parse.y, pt.c, ptree.c repo.c rtti.c, search.c: Likewise.
* semantics.c, sig.c, spew.c, tree.c, typeck.c: Likewise.
* typeck2.c, xref.c: Likewise.
* Makefile.in: Dependencies updated as appropriate.
* Make-lang.in: Likewise.
system.h cutover from the cp subdir
From-SVN: r18917
1998-03-31 15:25:46 +02:00
|
|
|
|
#include "system.h"
|
1996-02-01 20:33:01 +01:00
|
|
|
|
#include "tree.h"
|
|
|
|
|
#include "cp-tree.h"
|
|
|
|
|
#include "flags.h"
|
|
|
|
|
#include "output.h"
|
1996-09-12 21:19:15 +02:00
|
|
|
|
#include "assert.h"
|
call.c, [...]: Add include of toplev.h.
Wed May 6 06:36:41 1998 Robert Lipe <robertl@dgii.com>
* cp/call.c, cp/class.c, cp/decl.c, cp/decl2.c,
cp/errfn.c, cp/error.c, cp/except.c, cp/expr.c,
cp/friend.c, cp/init.c, cp/lex.c, cp/method.c,
cp/pt.c, cp/repo.c, cp/rtti.c, cp/search.c,
cp/semantics.c, cp/sig.c, cp/tree.c, cp/typeck.c,
cp/typeck2.c, cp/xref.c: Add include of toplev.h.
From-SVN: r19565
1998-05-06 07:01:35 +02:00
|
|
|
|
#include "toplev.h"
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-09-30 23:34:04 +02:00
|
|
|
|
#ifndef INT_TYPE_SIZE
|
|
|
|
|
#define INT_TYPE_SIZE BITS_PER_WORD
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-01-28 14:30:13 +01:00
|
|
|
|
/* Accessors for the type_info objects. We need to remember several things
|
|
|
|
|
about each of the type_info types. The global tree nodes such as
|
|
|
|
|
bltn_desc_type_node are TREE_LISTs, and these macros are used to access
|
|
|
|
|
the required information. */
|
|
|
|
|
/* The RECORD_TYPE of a type_info derived class. */
|
|
|
|
|
#define TINFO_PSEUDO_TYPE(NODE) TREE_TYPE (NODE)
|
|
|
|
|
/* The VAR_DECL of the vtable for the type_info derived class. */
|
|
|
|
|
#define TINFO_VTABLE_DECL(NODE) TREE_VALUE (NODE)
|
|
|
|
|
|
1997-08-20 00:37:19 +02:00
|
|
|
|
extern struct obstack permanent_obstack;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
2000-01-28 14:30:13 +01:00
|
|
|
|
static tree build_headof_sub PARAMS((tree));
|
|
|
|
|
static tree build_headof PARAMS((tree));
|
|
|
|
|
static tree get_tinfo_var PARAMS((tree));
|
|
|
|
|
static tree ifnonnull PARAMS((tree, tree));
|
|
|
|
|
static tree tinfo_name PARAMS((tree));
|
|
|
|
|
static tree get_base_offset PARAMS((tree, tree));
|
|
|
|
|
static tree build_dynamic_cast_1 PARAMS((tree, tree));
|
|
|
|
|
static void expand_si_desc PARAMS((tree, tree));
|
|
|
|
|
static void expand_class_desc PARAMS((tree, tree));
|
|
|
|
|
static void expand_attr_desc PARAMS((tree, tree));
|
|
|
|
|
static void expand_ptr_desc PARAMS((tree, tree));
|
|
|
|
|
static void expand_generic_desc PARAMS((tree, tree, const char *));
|
|
|
|
|
static tree throw_bad_cast PARAMS((void));
|
|
|
|
|
static tree throw_bad_typeid PARAMS((void));
|
|
|
|
|
static tree get_tinfo_decl_dynamic PARAMS((tree));
|
|
|
|
|
static tree tinfo_from_decl PARAMS((tree));
|
|
|
|
|
static int qualifier_flags PARAMS((tree));
|
|
|
|
|
static tree tinfo_base_init PARAMS((tree, tree));
|
|
|
|
|
static tree generic_initializer PARAMS((tree, tree));
|
2000-03-15 11:40:27 +01:00
|
|
|
|
static tree ptr_initializer PARAMS((tree, tree));
|
2000-01-28 14:30:13 +01:00
|
|
|
|
static tree ptmd_initializer PARAMS((tree, tree));
|
|
|
|
|
static int class_hint_flags PARAMS((tree));
|
|
|
|
|
static tree class_initializer PARAMS((tree, tree, tree));
|
|
|
|
|
static tree synthesize_tinfo_var PARAMS((tree, tree));
|
|
|
|
|
static tree create_real_tinfo_var PARAMS((tree, tree, tree));
|
|
|
|
|
static tree create_pseudo_type_info PARAMS((const char *, int, ...));
|
|
|
|
|
static tree get_vmi_pseudo_type_info PARAMS((int));
|
|
|
|
|
static void create_tinfo_types PARAMS((void));
|
|
|
|
|
|
|
|
|
|
static int doing_runtime = 0;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
void
|
|
|
|
|
init_rtti_processing ()
|
|
|
|
|
{
|
1998-05-08 04:06:26 +02:00
|
|
|
|
if (flag_honor_std)
|
|
|
|
|
push_namespace (get_identifier ("std"));
|
1996-04-13 01:55:07 +02:00
|
|
|
|
type_info_type_node = xref_tag
|
1998-08-27 12:17:48 +02:00
|
|
|
|
(class_type_node, get_identifier ("type_info"), 1);
|
1998-05-08 04:06:26 +02:00
|
|
|
|
if (flag_honor_std)
|
|
|
|
|
pop_namespace ();
|
2000-01-28 14:30:13 +01:00
|
|
|
|
if (!new_abi_rtti_p ())
|
|
|
|
|
{
|
|
|
|
|
tinfo_decl_id = get_identifier ("__tf");
|
|
|
|
|
tinfo_decl_type = build_function_type
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
(build_reference_type
|
|
|
|
|
(build_qualified_type
|
|
|
|
|
(type_info_type_node, TYPE_QUAL_CONST)),
|
|
|
|
|
void_list_node);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tinfo_decl_id = get_identifier ("__ti");
|
|
|
|
|
tinfo_decl_type = build_qualified_type
|
|
|
|
|
(type_info_type_node, TYPE_QUAL_CONST);
|
|
|
|
|
}
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
tinfo_var_id = get_identifier ("__ti");
|
1996-04-13 01:55:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a pointer to an object with at least one virtual table
|
|
|
|
|
pointer somewhere, return a pointer to a possible sub-object that
|
|
|
|
|
has a virtual table pointer in it that is the vtable parent for
|
|
|
|
|
that sub-object. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
static tree
|
|
|
|
|
build_headof_sub (exp)
|
|
|
|
|
tree exp;
|
|
|
|
|
{
|
|
|
|
|
tree type = TREE_TYPE (TREE_TYPE (exp));
|
|
|
|
|
tree basetype = CLASSTYPE_RTTI (type);
|
|
|
|
|
tree binfo = get_binfo (basetype, type, 0);
|
|
|
|
|
|
|
|
|
|
exp = convert_pointer_to_real (binfo, exp);
|
|
|
|
|
return exp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given the expression EXP of type `class *', return the head of the
|
|
|
|
|
object pointed to by EXP with type cv void*, if the class has any
|
1999-12-21 01:19:01 +01:00
|
|
|
|
virtual functions (TYPE_POLYMORPHIC_P), else just return the
|
1996-04-13 01:55:07 +02:00
|
|
|
|
expression. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1996-02-28 23:01:56 +01:00
|
|
|
|
static tree
|
1996-02-01 20:33:01 +01:00
|
|
|
|
build_headof (exp)
|
|
|
|
|
tree exp;
|
|
|
|
|
{
|
|
|
|
|
tree type = TREE_TYPE (exp);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree aref;
|
1997-01-21 22:32:30 +01:00
|
|
|
|
tree offset;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
my_friendly_assert (TREE_CODE (type) == POINTER_TYPE, 20000112);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
type = TREE_TYPE (type);
|
|
|
|
|
|
1999-12-21 01:19:01 +01:00
|
|
|
|
if (!TYPE_POLYMORPHIC_P (type))
|
1996-02-01 20:33:01 +01:00
|
|
|
|
return exp;
|
1999-04-13 02:39:32 +02:00
|
|
|
|
if (CLASSTYPE_COM_INTERFACE (type))
|
|
|
|
|
{
|
|
|
|
|
cp_error ("RTTI not supported for COM interface type `%T'", type);
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
/* If we don't have rtti stuff, get to a sub-object that does. */
|
|
|
|
|
if (!CLASSTYPE_VFIELDS (TREE_TYPE (TREE_TYPE (exp))))
|
|
|
|
|
exp = build_headof_sub (exp);
|
|
|
|
|
|
|
|
|
|
/* We use this a couple of times below, protect it. */
|
|
|
|
|
exp = save_expr (exp);
|
|
|
|
|
|
|
|
|
|
aref = build_vtbl_ref (build_indirect_ref (exp, NULL_PTR), integer_zero_node);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
|
|
|
|
if (flag_vtable_thunks)
|
1996-04-13 01:55:07 +02:00
|
|
|
|
offset = aref;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else
|
1996-04-13 01:55:07 +02:00
|
|
|
|
offset = build_component_ref (aref, delta_identifier, NULL_TREE, 0);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
cplus-dem.c (work_stuff): Replace const_type and volatile_type with type_quals.
* cplus-dem.c (work_stuff): Replace const_type and volatile_type
with type_quals.
(TYPE_UNQUALIFIED): New macro.
(TYPE_QUAL_CONST): Likewise.
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(code_for_qualifier): New function.
(qualifier_string): Likewise.
(demangle_qualifier): Likewise.
(internal_cplus_demangle): Use them.
(demangle_signature): Likewise.
(demangle_template_value_parm): Likewise.
(do_type): Likewise.
(demangle_fund_type)): Likewise.
* Makefile.in (hash.h): Run gperf when necessary.
* cp-tree.h (CP_TYPE_READONLY): Remove.
(CP_TYPE_VOLATILE): Likewise.
(CP_TYPE_QUALS): New macro.
(CP_TYPE_CONST_P): Likewise.
(CP_TYPE_VOLATILE_P): Likewise.
(CP_TYPE_RESTRICT_P): Likewise.
(CP_TYPE_CONST_NON_VOLATILE_P): Likewise.
(cp_build_type_variant): Rename to ...
(cp_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Declare.
(SIGNATURE_POINTER_NAME_FORMAT): Modify to allow `restrict'.
(SIGNATURE_REFERENCE_NAME_FORMAT): Likewise.
(cp_type_qual_from_rid): New function.
(compparms): Remove unused parameter. All callers changed.
(cp_type_quals): New function.
(at_least_as_qualified_p): Likewise.
(more_qualified_p): Likewise.
* call.c (standard_conversion): Replace calls to
cp_build_type_variant with cp_build_qualified_type. Use
CP_TYPE_QUALS to get qualifiers and at_least_as_qualified_p to
compare them. Use CP_TYPE_* macros to check qualifiers.
(reference_binding): Likewise.
(implicit_conversion): Likewise.
(add_builtin_candidates): Likewise.
(build_over_call): Likewise.
* class.c (overrides): Compare all qualifiers, not just `const',
on method declarations.
* cvt.c (convert_to_reference): More CP_TYPE_QUALS conversion, etc.
(convert_pointer_to_real): Likewise.
(type_promotes_to): Likewise.
* decl.c (check_for_uninitialized_const_var): New function.
(init_decl_processing): More CP_TYPE_QUALS conversion, etc.
(cp_finish_decl): Use check_for_uninitialized_const_var.
(grokdeclarator): More CP_TYPE_QUALS conversion, etc. Update to
handle `restrict'.
(grok_ctor_properties): Likewise.
(grok_op_properties): Likewise.
(start_function): Likewise.
(rever_static_member_fn): Likewise.
* decl2.c (grok_method_quals): Likewise.
(grokfield): Likewise.
* error.c (dump_readonly_or_volatile): Rename to ...
(dump_qualifiers): New function. Handle `restrict'.
(dump_type_real): Use it.
(dump_aggr_type): Likewise.
(dump_type_prefix): Likewise.
(dump_type_suffix): Likewise.
(dump_function_decl): Likewise.
(cv_as_string): Likewise.
* gxx.gperf: Add __restrict and __restrict__.
* gxxint.texi: Document `u' as used for `__restrict', and a few
other previously undocumented codes.
* hash.h: Regenerated.
* init.c (expand_aggr_init): More CP_TYPE_QUALS conversion, etc.
(build_member_call): Likewise.
(build_new_1): Likewise.
* lex.c (init_parse): Add entry for RID_RESTRICT.
(cons_up_default_function): More CP_TYPE_QUALS conversion, etc.
(cp_type_qual_from_rid): Define.
* lex.h (enum rid): Add RID_RESTRICT.
* method.c (process_modifiers): Deal with `restrict'.
* parse.y (primary): More CP_TYPE_QUALS conversion, etc.
* parse.c: Regenerated.
* pt.c (convert_nontype_argument): More CP_TYPE_QUALS conversion, etc.
(tsubst_aggr_type): Likewise.
(tsubst): Likewise.
(check_cv_quals_for_unify): Likewise.
(unify): Likewise.
* rtti.c (init_rtti_processing): Likewise.
(build_headof): Likewise.
(get_tinfo_var): Likewise.
(buidl_dynamic_cast_1): Likewise. Fix `volatile' handling.
(expand_class_desc): Likewise.
(expand_attr_desc): Likewise.
(synthesize_tinfo_fn): Likewise.
* search.c (covariant_return_p): Likewise. Fix `volatile' handling.
(get_matching_virtual): Likewise.
(expand_upcast_fixups): Likewise.
* sig.c (build_signature_pointer_or_reference_name): Take
type_quals, not constp and volatilep.
(build_signature_pointer_or_reference_type): Likewise.
(match_method_types): More CP_TYPE_QUALS conversion, etc.
(build_signature_pointer_constructor): Likewise.
(build_signature_method_call): Likewise.
* tree.c (build_cplus_array_type): Likewise.
(cp_build_type_variant): Rename to ...
(cp_build_qualified_type): New function. Deal with `__restrict'.
(canonical_type_variant): More CP_TYPE_QUALS conversion, etc.
(build_exception_variant): Likewise.
(mapcar): Likewise.
* typeck.c (qualif_type): Likewise.
(common_type): Likewise.
(comptypes): Likewise.
(comp_cv_target_types): Likewise.
(at_least_as_qualified_p): Define.
(more_qualified_p): Likewise.
(comp_cv_qualification): More CP_TYPE_QUALS conversion, etc.
(compparms): Likewise.
(inline_conversion): Likewise.
(string_conv_p): Likewise.
(build_component_ref): Likewise.
(build_indirect_ref): Likewise.
(build_array_ref): Likewise.
(build_unary_op): Likewise.
(build_conditional_expr): Likewise.
(build_static_cast): Likewise.
(build_c_cast): Likewise.
(build_modify_expr): Likewise.
(convert_For_assignment): Likewise.
(comp_ptr_ttypes_real): Likewise.
(cp_type_quals): New function.
From-SVN: r23258
1998-10-23 16:53:28 +02:00
|
|
|
|
type = build_qualified_type (ptr_type_node,
|
|
|
|
|
CP_TYPE_QUALS (TREE_TYPE (exp)));
|
1996-02-01 20:33:01 +01:00
|
|
|
|
return build (PLUS_EXPR, type, exp,
|
1997-05-29 01:20:02 +02:00
|
|
|
|
cp_convert (ptrdiff_type_node, offset));
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
1996-09-30 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
/* Get a bad_cast node for the program to throw...
|
|
|
|
|
|
|
|
|
|
See libstdc++/exception.cc for __throw_bad_cast */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
throw_bad_cast ()
|
|
|
|
|
{
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
tree fn = get_identifier ("__throw_bad_cast");
|
|
|
|
|
if (IDENTIFIER_GLOBAL_VALUE (fn))
|
|
|
|
|
fn = IDENTIFIER_GLOBAL_VALUE (fn);
|
|
|
|
|
else
|
2000-03-11 01:23:18 +01:00
|
|
|
|
fn = push_throw_library_fn (fn, build_function_type (ptr_type_node,
|
|
|
|
|
void_list_node));
|
2000-01-24 13:16:59 +01:00
|
|
|
|
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
return build_call (fn, NULL_TREE);
|
1996-09-30 23:34:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
throw_bad_typeid ()
|
|
|
|
|
{
|
2000-03-11 11:14:13 +01:00
|
|
|
|
tree fn = get_identifier ("__throw_bad_typeid");
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
if (IDENTIFIER_GLOBAL_VALUE (fn))
|
|
|
|
|
fn = IDENTIFIER_GLOBAL_VALUE (fn);
|
|
|
|
|
else
|
2000-03-11 01:23:18 +01:00
|
|
|
|
{
|
|
|
|
|
tree t = build_qualified_type (type_info_type_node, TYPE_QUAL_CONST);
|
|
|
|
|
t = build_function_type (build_reference_type (t), void_list_node);
|
|
|
|
|
fn = push_throw_library_fn (fn, t);
|
|
|
|
|
}
|
2000-01-24 13:16:59 +01:00
|
|
|
|
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
return build_call (fn, NULL_TREE);
|
1996-09-30 23:34:04 +02:00
|
|
|
|
}
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
/* Return a pointer to type_info function associated with the expression EXP.
|
|
|
|
|
If EXP is a reference to a polymorphic class, return the dynamic type;
|
1996-09-30 23:34:04 +02:00
|
|
|
|
otherwise return the static type of the expression. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
static tree
|
|
|
|
|
get_tinfo_decl_dynamic (exp)
|
1996-02-01 20:33:01 +01:00
|
|
|
|
tree exp;
|
|
|
|
|
{
|
|
|
|
|
tree type;
|
2000-01-18 11:23:31 +01:00
|
|
|
|
|
1996-02-01 20:33:01 +01:00
|
|
|
|
if (exp == error_mark_node)
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
type = TREE_TYPE (exp);
|
|
|
|
|
|
1996-07-11 03:13:25 +02:00
|
|
|
|
/* peel back references, so they match. */
|
1996-02-01 20:33:01 +01:00
|
|
|
|
if (TREE_CODE (type) == REFERENCE_TYPE)
|
|
|
|
|
type = TREE_TYPE (type);
|
|
|
|
|
|
1996-07-11 03:13:25 +02:00
|
|
|
|
/* Peel off cv qualifiers. */
|
1996-02-01 20:33:01 +01:00
|
|
|
|
type = TYPE_MAIN_VARIANT (type);
|
2000-01-18 11:23:31 +01:00
|
|
|
|
|
|
|
|
|
if (type != void_type_node)
|
|
|
|
|
type = complete_type_or_else (type, exp);
|
|
|
|
|
|
|
|
|
|
if (!type)
|
|
|
|
|
return error_mark_node;
|
1998-11-16 21:45:16 +01:00
|
|
|
|
|
1996-02-01 20:33:01 +01:00
|
|
|
|
/* If exp is a reference to polymorphic type, get the real type_info. */
|
1999-12-21 01:19:01 +01:00
|
|
|
|
if (TYPE_POLYMORPHIC_P (type) && ! resolves_to_fixed_type_p (exp, 0))
|
1996-02-01 20:33:01 +01:00
|
|
|
|
{
|
|
|
|
|
/* build reference to type_info from vtable. */
|
|
|
|
|
tree t;
|
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
if (! flag_rtti)
|
1998-11-16 21:45:16 +01:00
|
|
|
|
error ("taking dynamic typeid of object with -fno-rtti");
|
1999-04-13 02:39:32 +02:00
|
|
|
|
if (CLASSTYPE_COM_INTERFACE (type))
|
|
|
|
|
{
|
|
|
|
|
cp_error ("RTTI not supported for COM interface type `%T'", type);
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
|
|
|
|
/* If we don't have rtti stuff, get to a sub-object that does. */
|
1996-09-30 23:34:04 +02:00
|
|
|
|
if (! CLASSTYPE_VFIELDS (type))
|
1996-04-13 01:55:07 +02:00
|
|
|
|
{
|
2000-01-18 11:23:31 +01:00
|
|
|
|
exp = build_unary_op (ADDR_EXPR, exp, 0);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
exp = build_headof_sub (exp);
|
|
|
|
|
exp = build_indirect_ref (exp, NULL_PTR);
|
|
|
|
|
}
|
|
|
|
|
|
1996-02-01 20:33:01 +01:00
|
|
|
|
if (flag_vtable_thunks)
|
1996-04-13 01:55:07 +02:00
|
|
|
|
t = build_vfn_ref ((tree *) 0, exp, integer_one_node);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else
|
1996-04-13 01:55:07 +02:00
|
|
|
|
t = build_vfn_ref ((tree *) 0, exp, integer_zero_node);
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
TREE_TYPE (t) = build_pointer_type (tinfo_decl_type);
|
1996-09-30 23:34:04 +02:00
|
|
|
|
return t;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* otherwise return the type_info for the static type of the expr. */
|
2000-01-18 11:23:31 +01:00
|
|
|
|
exp = get_tinfo_decl (TYPE_MAIN_VARIANT (type));
|
|
|
|
|
return build_unary_op (ADDR_EXPR, exp, 0);
|
1996-09-30 23:34:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
build_typeid (exp)
|
|
|
|
|
tree exp;
|
|
|
|
|
{
|
|
|
|
|
tree cond = NULL_TREE;
|
2000-01-18 05:52:50 +01:00
|
|
|
|
int nonnull = 0;
|
1996-09-30 23:34:04 +02:00
|
|
|
|
|
1999-04-27 11:41:33 +02:00
|
|
|
|
if (! flag_rtti)
|
|
|
|
|
{
|
|
|
|
|
error ("cannot use typeid with -fno-rtti");
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (type_info_type_node))
|
1998-11-16 21:45:16 +01:00
|
|
|
|
{
|
|
|
|
|
error ("must #include <typeinfo> before using typeid");
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
|
1996-09-30 23:34:04 +02:00
|
|
|
|
if (processing_template_decl)
|
|
|
|
|
return build_min_nt (TYPEID_EXPR, exp);
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (exp) == INDIRECT_REF
|
|
|
|
|
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE
|
1999-12-21 01:19:01 +01:00
|
|
|
|
&& TYPE_POLYMORPHIC_P (TREE_TYPE (exp))
|
1996-09-30 23:34:04 +02:00
|
|
|
|
&& ! resolves_to_fixed_type_p (exp, &nonnull)
|
|
|
|
|
&& ! nonnull)
|
|
|
|
|
{
|
|
|
|
|
exp = stabilize_reference (exp);
|
1997-05-29 01:20:02 +02:00
|
|
|
|
cond = cp_convert (boolean_type_node, TREE_OPERAND (exp, 0));
|
1996-09-30 23:34:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
exp = get_tinfo_decl_dynamic (exp);
|
1996-11-12 20:49:48 +01:00
|
|
|
|
|
|
|
|
|
if (exp == error_mark_node)
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
exp = tinfo_from_decl (exp);
|
1996-09-30 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
if (cond)
|
|
|
|
|
{
|
|
|
|
|
tree bad = throw_bad_typeid ();
|
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
exp = build (COND_EXPR, TREE_TYPE (exp), cond, exp, bad);
|
1996-09-30 23:34:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return convert_from_reference (exp);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
1997-02-04 03:31:49 +01:00
|
|
|
|
static tree
|
1996-04-13 01:55:07 +02:00
|
|
|
|
get_tinfo_var (type)
|
|
|
|
|
tree type;
|
|
|
|
|
{
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
tree tname = build_overload_with_type (tinfo_var_id, type);
|
1999-12-17 08:40:08 +01:00
|
|
|
|
tree arrtype;
|
1996-04-13 01:55:07 +02:00
|
|
|
|
int size;
|
|
|
|
|
|
2000-01-28 14:30:13 +01:00
|
|
|
|
my_friendly_assert (!new_abi_rtti_p (), 20000118);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
if (IDENTIFIER_GLOBAL_VALUE (tname))
|
|
|
|
|
return IDENTIFIER_GLOBAL_VALUE (tname);
|
|
|
|
|
|
|
|
|
|
/* Figure out how much space we need to allocate for the type_info object.
|
|
|
|
|
If our struct layout or the type_info classes are changed, this will
|
|
|
|
|
need to be modified. */
|
cplus-dem.c (work_stuff): Replace const_type and volatile_type with type_quals.
* cplus-dem.c (work_stuff): Replace const_type and volatile_type
with type_quals.
(TYPE_UNQUALIFIED): New macro.
(TYPE_QUAL_CONST): Likewise.
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(code_for_qualifier): New function.
(qualifier_string): Likewise.
(demangle_qualifier): Likewise.
(internal_cplus_demangle): Use them.
(demangle_signature): Likewise.
(demangle_template_value_parm): Likewise.
(do_type): Likewise.
(demangle_fund_type)): Likewise.
* Makefile.in (hash.h): Run gperf when necessary.
* cp-tree.h (CP_TYPE_READONLY): Remove.
(CP_TYPE_VOLATILE): Likewise.
(CP_TYPE_QUALS): New macro.
(CP_TYPE_CONST_P): Likewise.
(CP_TYPE_VOLATILE_P): Likewise.
(CP_TYPE_RESTRICT_P): Likewise.
(CP_TYPE_CONST_NON_VOLATILE_P): Likewise.
(cp_build_type_variant): Rename to ...
(cp_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Declare.
(SIGNATURE_POINTER_NAME_FORMAT): Modify to allow `restrict'.
(SIGNATURE_REFERENCE_NAME_FORMAT): Likewise.
(cp_type_qual_from_rid): New function.
(compparms): Remove unused parameter. All callers changed.
(cp_type_quals): New function.
(at_least_as_qualified_p): Likewise.
(more_qualified_p): Likewise.
* call.c (standard_conversion): Replace calls to
cp_build_type_variant with cp_build_qualified_type. Use
CP_TYPE_QUALS to get qualifiers and at_least_as_qualified_p to
compare them. Use CP_TYPE_* macros to check qualifiers.
(reference_binding): Likewise.
(implicit_conversion): Likewise.
(add_builtin_candidates): Likewise.
(build_over_call): Likewise.
* class.c (overrides): Compare all qualifiers, not just `const',
on method declarations.
* cvt.c (convert_to_reference): More CP_TYPE_QUALS conversion, etc.
(convert_pointer_to_real): Likewise.
(type_promotes_to): Likewise.
* decl.c (check_for_uninitialized_const_var): New function.
(init_decl_processing): More CP_TYPE_QUALS conversion, etc.
(cp_finish_decl): Use check_for_uninitialized_const_var.
(grokdeclarator): More CP_TYPE_QUALS conversion, etc. Update to
handle `restrict'.
(grok_ctor_properties): Likewise.
(grok_op_properties): Likewise.
(start_function): Likewise.
(rever_static_member_fn): Likewise.
* decl2.c (grok_method_quals): Likewise.
(grokfield): Likewise.
* error.c (dump_readonly_or_volatile): Rename to ...
(dump_qualifiers): New function. Handle `restrict'.
(dump_type_real): Use it.
(dump_aggr_type): Likewise.
(dump_type_prefix): Likewise.
(dump_type_suffix): Likewise.
(dump_function_decl): Likewise.
(cv_as_string): Likewise.
* gxx.gperf: Add __restrict and __restrict__.
* gxxint.texi: Document `u' as used for `__restrict', and a few
other previously undocumented codes.
* hash.h: Regenerated.
* init.c (expand_aggr_init): More CP_TYPE_QUALS conversion, etc.
(build_member_call): Likewise.
(build_new_1): Likewise.
* lex.c (init_parse): Add entry for RID_RESTRICT.
(cons_up_default_function): More CP_TYPE_QUALS conversion, etc.
(cp_type_qual_from_rid): Define.
* lex.h (enum rid): Add RID_RESTRICT.
* method.c (process_modifiers): Deal with `restrict'.
* parse.y (primary): More CP_TYPE_QUALS conversion, etc.
* parse.c: Regenerated.
* pt.c (convert_nontype_argument): More CP_TYPE_QUALS conversion, etc.
(tsubst_aggr_type): Likewise.
(tsubst): Likewise.
(check_cv_quals_for_unify): Likewise.
(unify): Likewise.
* rtti.c (init_rtti_processing): Likewise.
(build_headof): Likewise.
(get_tinfo_var): Likewise.
(buidl_dynamic_cast_1): Likewise. Fix `volatile' handling.
(expand_class_desc): Likewise.
(expand_attr_desc): Likewise.
(synthesize_tinfo_fn): Likewise.
* search.c (covariant_return_p): Likewise. Fix `volatile' handling.
(get_matching_virtual): Likewise.
(expand_upcast_fixups): Likewise.
* sig.c (build_signature_pointer_or_reference_name): Take
type_quals, not constp and volatilep.
(build_signature_pointer_or_reference_type): Likewise.
(match_method_types): More CP_TYPE_QUALS conversion, etc.
(build_signature_pointer_constructor): Likewise.
(build_signature_method_call): Likewise.
* tree.c (build_cplus_array_type): Likewise.
(cp_build_type_variant): Rename to ...
(cp_build_qualified_type): New function. Deal with `__restrict'.
(canonical_type_variant): More CP_TYPE_QUALS conversion, etc.
(build_exception_variant): Likewise.
(mapcar): Likewise.
* typeck.c (qualif_type): Likewise.
(common_type): Likewise.
(comptypes): Likewise.
(comp_cv_target_types): Likewise.
(at_least_as_qualified_p): Define.
(more_qualified_p): Likewise.
(comp_cv_qualification): More CP_TYPE_QUALS conversion, etc.
(compparms): Likewise.
(inline_conversion): Likewise.
(string_conv_p): Likewise.
(build_component_ref): Likewise.
(build_indirect_ref): Likewise.
(build_array_ref): Likewise.
(build_unary_op): Likewise.
(build_conditional_expr): Likewise.
(build_static_cast): Likewise.
(build_c_cast): Likewise.
(build_modify_expr): Likewise.
(convert_For_assignment): Likewise.
(comp_ptr_ttypes_real): Likewise.
(cp_type_quals): New function.
From-SVN: r23258
1998-10-23 16:53:28 +02:00
|
|
|
|
if (TYPE_QUALS (type) != TYPE_UNQUALIFIED)
|
1996-09-30 23:34:04 +02:00
|
|
|
|
size = 3 * POINTER_SIZE + INT_TYPE_SIZE;
|
1996-04-13 01:55:07 +02:00
|
|
|
|
else if (TREE_CODE (type) == POINTER_TYPE
|
|
|
|
|
&& ! (TREE_CODE (TREE_TYPE (type)) == OFFSET_TYPE
|
|
|
|
|
|| TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE))
|
|
|
|
|
size = 3 * POINTER_SIZE;
|
|
|
|
|
else if (IS_AGGR_TYPE (type))
|
|
|
|
|
{
|
|
|
|
|
if (CLASSTYPE_N_BASECLASSES (type) == 0)
|
|
|
|
|
size = 2 * POINTER_SIZE;
|
1999-12-21 01:19:01 +01:00
|
|
|
|
else if (! TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (type)
|
1996-04-13 01:55:07 +02:00
|
|
|
|
&& (TREE_VIA_PUBLIC
|
|
|
|
|
(TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0))))
|
|
|
|
|
size = 3 * POINTER_SIZE;
|
|
|
|
|
else
|
1997-05-29 01:20:02 +02:00
|
|
|
|
size = 3 * POINTER_SIZE + TYPE_PRECISION (sizetype);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
size = 2 * POINTER_SIZE;
|
|
|
|
|
|
|
|
|
|
/* The type for a character array of the appropriate size. */
|
|
|
|
|
arrtype = build_cplus_array_type
|
|
|
|
|
(unsigned_char_type_node,
|
|
|
|
|
build_index_type (size_int (size / BITS_PER_UNIT - 1)));
|
|
|
|
|
|
1999-12-17 08:40:08 +01:00
|
|
|
|
return declare_global_var (tname, arrtype);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
/* Generate the NTBS name of a type. */
|
|
|
|
|
static tree
|
|
|
|
|
tinfo_name (type)
|
|
|
|
|
tree type;
|
|
|
|
|
{
|
|
|
|
|
const char *name = build_overload_name (type, 1, 1);
|
|
|
|
|
tree name_string = combine_strings (build_string (strlen (name) + 1, name));
|
|
|
|
|
return name_string;
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
/* Returns a decl for a function or variable which can be used to obtain a
|
2000-01-28 14:30:13 +01:00
|
|
|
|
type_info object for TYPE. The old-abi uses functions, the new-abi
|
|
|
|
|
uses the type_info object directly. You can take the address of the
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
returned decl, to save the decl. To use the decl call
|
|
|
|
|
tinfo_from_decl. You must arrange that the decl is mark_used, if
|
2000-01-18 11:23:31 +01:00
|
|
|
|
actually use it --- decls in vtables are only used if the vtable is
|
|
|
|
|
output. */
|
1999-11-13 10:39:11 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree
|
2000-01-18 11:23:31 +01:00
|
|
|
|
get_tinfo_decl (type)
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree type;
|
|
|
|
|
{
|
1996-11-12 20:49:48 +01:00
|
|
|
|
tree name;
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree d;
|
|
|
|
|
|
1996-11-12 20:49:48 +01:00
|
|
|
|
if (TREE_CODE (type) == OFFSET_TYPE)
|
|
|
|
|
type = TREE_TYPE (type);
|
|
|
|
|
if (TREE_CODE (type) == METHOD_TYPE)
|
|
|
|
|
type = build_function_type (TREE_TYPE (type),
|
|
|
|
|
TREE_CHAIN (TYPE_ARG_TYPES (type)));
|
|
|
|
|
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
name = build_overload_with_type (tinfo_decl_id, type);
|
1996-11-12 20:49:48 +01:00
|
|
|
|
|
2000-01-28 14:30:13 +01:00
|
|
|
|
d = IDENTIFIER_GLOBAL_VALUE (name);
|
|
|
|
|
if (d)
|
|
|
|
|
/* OK */;
|
|
|
|
|
else if (!new_abi_rtti_p ())
|
|
|
|
|
{
|
|
|
|
|
/* The tinfo decl is a function returning a reference to the type_info
|
|
|
|
|
object. */
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
d = push_library_fn (name, tinfo_decl_type);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
DECL_NOT_REALLY_EXTERN (d) = 1;
|
|
|
|
|
SET_DECL_TINFO_FN_P (d);
|
|
|
|
|
TREE_TYPE (name) = type;
|
|
|
|
|
mark_inline_for_output (d);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* The tinfo decl is the type_info object itself. We make all
|
|
|
|
|
tinfo objects look as type_info, even though they will end up
|
|
|
|
|
being a subclass of that when emitted. This means the we'll
|
|
|
|
|
erroneously think we know the dynamic type -- be careful in the
|
|
|
|
|
runtime. */
|
|
|
|
|
d = build_lang_decl (VAR_DECL, name, tinfo_decl_type);
|
|
|
|
|
|
|
|
|
|
DECL_ARTIFICIAL (d) = 1;
|
|
|
|
|
DECL_ALIGN (d) = TYPE_ALIGN (ptr_type_node);
|
|
|
|
|
TREE_READONLY (d) = 1;
|
|
|
|
|
TREE_STATIC (d) = 1;
|
|
|
|
|
DECL_EXTERNAL (d) = 1;
|
|
|
|
|
TREE_PUBLIC (d) = 1;
|
2000-03-24 17:36:06 +01:00
|
|
|
|
comdat_linkage (d);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
DECL_ASSEMBLER_NAME (d) = DECL_NAME (d);
|
|
|
|
|
cp_finish_decl (d, NULL_TREE, NULL_TREE, 0);
|
1998-07-23 04:29:34 +02:00
|
|
|
|
|
2000-01-28 14:30:13 +01:00
|
|
|
|
pushdecl_top_level (d);
|
|
|
|
|
/* Remember the type it is for. */
|
|
|
|
|
TREE_TYPE (name) = type;
|
|
|
|
|
}
|
1996-04-13 01:55:07 +02:00
|
|
|
|
return d;
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
/* Given an expr produced by get_tinfo_decl, return an expr which
|
|
|
|
|
produces a reference to the type_info object. */
|
1999-11-13 10:39:11 +01:00
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
static tree
|
|
|
|
|
tinfo_from_decl (expr)
|
|
|
|
|
tree expr;
|
1999-11-13 10:39:11 +01:00
|
|
|
|
{
|
2000-01-28 14:30:13 +01:00
|
|
|
|
tree t;
|
|
|
|
|
|
|
|
|
|
if (!new_abi_rtti_p ())
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
t = build_call (expr, NULL_TREE);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
else if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
|
|
|
|
|
t = build_indirect_ref (expr, NULL);
|
|
|
|
|
else
|
|
|
|
|
t = expr;
|
2000-01-18 11:23:31 +01:00
|
|
|
|
|
|
|
|
|
return t;
|
1999-11-13 10:39:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
1998-11-16 21:45:16 +01:00
|
|
|
|
tree
|
1996-04-13 01:55:07 +02:00
|
|
|
|
get_typeid_1 (type)
|
|
|
|
|
tree type;
|
|
|
|
|
{
|
1998-11-16 21:45:16 +01:00
|
|
|
|
tree t;
|
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
t = get_tinfo_decl (type);
|
|
|
|
|
t = tinfo_from_decl (t);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
return convert_from_reference (t);
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
/* Return the type_info object for TYPE. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1996-02-01 20:33:01 +01:00
|
|
|
|
tree
|
|
|
|
|
get_typeid (type)
|
|
|
|
|
tree type;
|
|
|
|
|
{
|
|
|
|
|
if (type == error_mark_node)
|
|
|
|
|
return error_mark_node;
|
1998-11-16 21:45:16 +01:00
|
|
|
|
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (type_info_type_node))
|
1998-03-04 13:13:02 +01:00
|
|
|
|
{
|
1998-11-16 21:45:16 +01:00
|
|
|
|
error ("must #include <typeinfo> before using typeid");
|
|
|
|
|
return error_mark_node;
|
1998-03-04 13:13:02 +01:00
|
|
|
|
}
|
1998-11-16 21:45:16 +01:00
|
|
|
|
|
1997-02-12 21:23:55 +01:00
|
|
|
|
if (processing_template_decl)
|
|
|
|
|
return build_min_nt (TYPEID_EXPR, type);
|
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
/* If the type of the type-id is a reference type, the result of the
|
|
|
|
|
typeid expression refers to a type_info object representing the
|
|
|
|
|
referenced type. */
|
1996-02-01 20:33:01 +01:00
|
|
|
|
if (TREE_CODE (type) == REFERENCE_TYPE)
|
|
|
|
|
type = TREE_TYPE (type);
|
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
/* The top-level cv-qualifiers of the lvalue expression or the type-id
|
1996-07-11 03:13:25 +02:00
|
|
|
|
that is the operand of typeid are always ignored. */
|
1996-04-13 01:55:07 +02:00
|
|
|
|
type = TYPE_MAIN_VARIANT (type);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
2000-01-18 11:23:31 +01:00
|
|
|
|
if (type != void_type_node)
|
|
|
|
|
type = complete_type_or_else (type, NULL_TREE);
|
|
|
|
|
|
|
|
|
|
if (!type)
|
|
|
|
|
return error_mark_node;
|
1998-11-16 21:45:16 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
return get_typeid_1 (type);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
1996-04-19 02:48:03 +02:00
|
|
|
|
/* Check whether TEST is null before returning RESULT. If TEST is used in
|
|
|
|
|
RESULT, it must have previously had a save_expr applied to it. */
|
|
|
|
|
|
1997-02-04 03:31:49 +01:00
|
|
|
|
static tree
|
1996-07-11 03:13:25 +02:00
|
|
|
|
ifnonnull (test, result)
|
1996-04-19 02:48:03 +02:00
|
|
|
|
tree test, result;
|
|
|
|
|
{
|
|
|
|
|
return build (COND_EXPR, TREE_TYPE (result),
|
|
|
|
|
build (EQ_EXPR, boolean_type_node, test, integer_zero_node),
|
1997-05-29 01:20:02 +02:00
|
|
|
|
cp_convert (TREE_TYPE (result), integer_zero_node),
|
1996-04-19 02:48:03 +02:00
|
|
|
|
result);
|
|
|
|
|
}
|
|
|
|
|
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
/* Generate the constant expression describing where direct base BINFO
|
|
|
|
|
appears within the PARENT. How to interpret this expression depends on
|
|
|
|
|
details of the ABI, which the runtime must be aware of. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
get_base_offset (binfo, parent)
|
|
|
|
|
tree binfo;
|
|
|
|
|
tree parent;
|
|
|
|
|
{
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
if (! TREE_VIA_VIRTUAL (binfo))
|
|
|
|
|
return BINFO_OFFSET (binfo);
|
|
|
|
|
else if (! vbase_offsets_in_vtable_p ())
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
{
|
|
|
|
|
const char *name;
|
|
|
|
|
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
FORMAT_VBASE_NAME (name, BINFO_TYPE (binfo));
|
|
|
|
|
return byte_position (lookup_field (parent, get_identifier (name),
|
|
|
|
|
0, 0));
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
/* Under the new ABI, we store the vtable offset at which
|
|
|
|
|
the virtual base offset can be found. */
|
|
|
|
|
return convert (sizetype,
|
|
|
|
|
BINFO_VPTR_FIELD (BINFO_FOR_VBASE (BINFO_TYPE (binfo),
|
|
|
|
|
parent)));
|
|
|
|
|
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
1996-02-01 20:33:01 +01:00
|
|
|
|
/* Execute a dynamic cast, as described in section 5.2.6 of the 9/93 working
|
|
|
|
|
paper. */
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
1997-07-24 23:09:25 +02:00
|
|
|
|
static tree
|
|
|
|
|
build_dynamic_cast_1 (type, expr)
|
1996-02-01 20:33:01 +01:00
|
|
|
|
tree type, expr;
|
|
|
|
|
{
|
|
|
|
|
enum tree_code tc = TREE_CODE (type);
|
1999-01-18 14:32:57 +01:00
|
|
|
|
tree exprtype;
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree dcast_fn;
|
1998-11-16 21:45:16 +01:00
|
|
|
|
tree old_expr = expr;
|
2000-03-17 01:56:12 +01:00
|
|
|
|
char* errstr = NULL;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
2000-03-17 01:56:12 +01:00
|
|
|
|
/* T shall be a pointer or reference to a complete class type, or
|
|
|
|
|
`pointer to cv void''. */
|
1996-02-01 20:33:01 +01:00
|
|
|
|
switch (tc)
|
|
|
|
|
{
|
|
|
|
|
case POINTER_TYPE:
|
2000-03-17 01:56:12 +01:00
|
|
|
|
if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE)
|
1996-02-01 20:33:01 +01:00
|
|
|
|
break;
|
|
|
|
|
case REFERENCE_TYPE:
|
2000-03-17 01:56:12 +01:00
|
|
|
|
if (! IS_AGGR_TYPE (TREE_TYPE (type)))
|
|
|
|
|
{
|
|
|
|
|
errstr = "target is not pointer or reference to class";
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (type))))
|
2000-03-17 01:56:12 +01:00
|
|
|
|
{
|
|
|
|
|
errstr = "target is not pointer or reference to complete type";
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
1996-04-05 20:07:00 +02:00
|
|
|
|
break;
|
2000-03-17 01:56:12 +01:00
|
|
|
|
|
1996-02-01 20:33:01 +01:00
|
|
|
|
default:
|
2000-03-17 01:56:12 +01:00
|
|
|
|
errstr = "target is not pointer or reference";
|
1996-02-01 20:33:01 +01:00
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-17 01:56:12 +01:00
|
|
|
|
if (TREE_CODE (expr) == OFFSET_REF)
|
|
|
|
|
expr = resolve_offset_ref (expr);
|
|
|
|
|
|
|
|
|
|
exprtype = TREE_TYPE (expr);
|
|
|
|
|
assert (exprtype != NULL_TREE);
|
|
|
|
|
|
|
|
|
|
if (tc == POINTER_TYPE)
|
|
|
|
|
expr = convert_from_reference (expr);
|
|
|
|
|
else if (TREE_CODE (exprtype) != REFERENCE_TYPE)
|
1996-02-01 20:33:01 +01:00
|
|
|
|
{
|
2000-03-17 01:56:12 +01:00
|
|
|
|
/* Apply trivial conversion T -> T& for dereferenced ptrs. */
|
1996-02-01 20:33:01 +01:00
|
|
|
|
exprtype = build_reference_type (exprtype);
|
|
|
|
|
expr = convert_to_reference (exprtype, expr, CONV_IMPLICIT,
|
|
|
|
|
LOOKUP_NORMAL, NULL_TREE);
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-17 01:56:12 +01:00
|
|
|
|
exprtype = TREE_TYPE (expr);
|
|
|
|
|
|
|
|
|
|
if (tc == POINTER_TYPE)
|
1996-02-01 20:33:01 +01:00
|
|
|
|
{
|
2000-03-17 01:56:12 +01:00
|
|
|
|
/* If T is a pointer type, v shall be an rvalue of a pointer to
|
|
|
|
|
complete class type, and the result is an rvalue of type T. */
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (exprtype) != POINTER_TYPE)
|
|
|
|
|
{
|
|
|
|
|
errstr = "source is not a pointer";
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
if (! IS_AGGR_TYPE (TREE_TYPE (exprtype)))
|
|
|
|
|
{
|
|
|
|
|
errstr = "source is not a pointer to class";
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (exprtype))))
|
2000-03-17 01:56:12 +01:00
|
|
|
|
{
|
|
|
|
|
errstr = "source is a pointer to incomplete type";
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* T is a reference type, v shall be an lvalue of a complete class
|
|
|
|
|
type, and the result is an lvalue of the type referred to by T. */
|
|
|
|
|
|
|
|
|
|
if (! IS_AGGR_TYPE (TREE_TYPE (exprtype)))
|
|
|
|
|
{
|
|
|
|
|
errstr = "source is not of class type";
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (exprtype))))
|
2000-03-17 01:56:12 +01:00
|
|
|
|
{
|
|
|
|
|
errstr = "source is of incomplete class type";
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The dynamic_cast operator shall not cast away constness. */
|
|
|
|
|
if (!at_least_as_qualified_p (TREE_TYPE (type),
|
|
|
|
|
TREE_TYPE (exprtype)))
|
|
|
|
|
{
|
|
|
|
|
errstr = "conversion casts away constness";
|
|
|
|
|
goto fail;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If *type is an unambiguous accessible base class of *exprtype,
|
|
|
|
|
convert statically. */
|
|
|
|
|
{
|
|
|
|
|
int distance;
|
|
|
|
|
tree path;
|
|
|
|
|
|
|
|
|
|
distance = get_base_distance (TREE_TYPE (type), TREE_TYPE (exprtype), 1,
|
|
|
|
|
&path);
|
1998-11-16 21:45:16 +01:00
|
|
|
|
|
|
|
|
|
if (distance == -2)
|
|
|
|
|
{
|
|
|
|
|
cp_error ("dynamic_cast from `%T' to ambiguous base class `%T'",
|
|
|
|
|
TREE_TYPE (exprtype), TREE_TYPE (type));
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
if (distance == -3)
|
|
|
|
|
{
|
|
|
|
|
cp_error ("dynamic_cast from `%T' to private base class `%T'",
|
|
|
|
|
TREE_TYPE (exprtype), TREE_TYPE (type));
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
|
1996-02-01 20:33:01 +01:00
|
|
|
|
if (distance >= 0)
|
|
|
|
|
return build_vbase_path (PLUS_EXPR, type, expr, path, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Otherwise *exprtype must be a polymorphic class (have a vtbl). */
|
1999-12-21 01:19:01 +01:00
|
|
|
|
if (TYPE_POLYMORPHIC_P (TREE_TYPE (exprtype)))
|
1996-02-01 20:33:01 +01:00
|
|
|
|
{
|
1996-04-19 02:48:03 +02:00
|
|
|
|
tree expr1;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
/* if TYPE is `void *', return pointer to complete object. */
|
|
|
|
|
if (tc == POINTER_TYPE
|
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node)
|
|
|
|
|
{
|
|
|
|
|
/* if b is an object, dynamic_cast<void *>(&b) == (void *)&b. */
|
|
|
|
|
if (TREE_CODE (expr) == ADDR_EXPR
|
|
|
|
|
&& TREE_CODE (TREE_OPERAND (expr, 0)) == VAR_DECL
|
|
|
|
|
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == RECORD_TYPE)
|
|
|
|
|
return build1 (NOP_EXPR, type, expr);
|
|
|
|
|
|
1996-04-19 02:48:03 +02:00
|
|
|
|
/* Since expr is used twice below, save it. */
|
|
|
|
|
expr = save_expr (expr);
|
|
|
|
|
|
|
|
|
|
expr1 = build_headof (expr);
|
|
|
|
|
if (TREE_TYPE (expr1) != type)
|
|
|
|
|
expr1 = build1 (NOP_EXPR, type, expr1);
|
|
|
|
|
return ifnonnull (expr, expr1);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tree retval;
|
2000-01-28 14:30:13 +01:00
|
|
|
|
tree result, td2, td3, elems;
|
1999-09-21 16:40:13 +02:00
|
|
|
|
tree static_type, target_type, boff;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
|
|
|
|
/* If we got here, we can't convert statically. Therefore,
|
|
|
|
|
dynamic_cast<D&>(b) (b an object) cannot succeed. */
|
2000-03-17 01:56:12 +01:00
|
|
|
|
if (tc == REFERENCE_TYPE)
|
1996-02-01 20:33:01 +01:00
|
|
|
|
{
|
1998-11-16 21:45:16 +01:00
|
|
|
|
if (TREE_CODE (old_expr) == VAR_DECL
|
|
|
|
|
&& TREE_CODE (TREE_TYPE (old_expr)) == RECORD_TYPE)
|
1996-02-01 20:33:01 +01:00
|
|
|
|
{
|
2000-01-24 13:16:59 +01:00
|
|
|
|
tree expr = throw_bad_cast ();
|
1998-09-07 16:25:35 +02:00
|
|
|
|
cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
|
1998-11-16 21:45:16 +01:00
|
|
|
|
old_expr, type);
|
2000-01-24 13:16:59 +01:00
|
|
|
|
/* Bash it to the expected type. */
|
|
|
|
|
TREE_TYPE (expr) = type;
|
|
|
|
|
return expr;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* Ditto for dynamic_cast<D*>(&b). */
|
|
|
|
|
else if (TREE_CODE (expr) == ADDR_EXPR)
|
|
|
|
|
{
|
|
|
|
|
tree op = TREE_OPERAND (expr, 0);
|
|
|
|
|
if (TREE_CODE (op) == VAR_DECL
|
|
|
|
|
&& TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE)
|
|
|
|
|
{
|
1998-09-07 16:25:35 +02:00
|
|
|
|
cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
|
1998-10-31 03:50:29 +01:00
|
|
|
|
op, type);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
retval = build_int_2 (0, 0);
|
|
|
|
|
TREE_TYPE (retval) = type;
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-28 14:30:13 +01:00
|
|
|
|
target_type = TYPE_MAIN_VARIANT (TREE_TYPE (type));
|
|
|
|
|
static_type = TYPE_MAIN_VARIANT (TREE_TYPE (exprtype));
|
|
|
|
|
td2 = build_unary_op (ADDR_EXPR, get_tinfo_decl (target_type), 0);
|
|
|
|
|
td3 = build_unary_op (ADDR_EXPR, get_tinfo_decl (static_type), 0);
|
|
|
|
|
|
|
|
|
|
/* Determine how T and V are related. */
|
|
|
|
|
boff = get_dynamic_cast_base_type (static_type, target_type);
|
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
/* Since expr is used twice below, save it. */
|
|
|
|
|
expr = save_expr (expr);
|
|
|
|
|
|
1996-02-01 20:33:01 +01:00
|
|
|
|
expr1 = expr;
|
|
|
|
|
if (tc == REFERENCE_TYPE)
|
|
|
|
|
expr1 = build_unary_op (ADDR_EXPR, expr1, 0);
|
|
|
|
|
|
2000-01-28 14:30:13 +01:00
|
|
|
|
if (!new_abi_rtti_p ())
|
|
|
|
|
{
|
|
|
|
|
tree expr2 = build_headof (expr1);
|
|
|
|
|
tree td1 = expr;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
2000-03-17 01:56:12 +01:00
|
|
|
|
if (tc == POINTER_TYPE)
|
2000-01-28 14:30:13 +01:00
|
|
|
|
td1 = build_indirect_ref (td1, NULL_PTR);
|
|
|
|
|
td1 = get_tinfo_decl_dynamic (td1);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
2000-01-28 14:30:13 +01:00
|
|
|
|
elems = tree_cons
|
|
|
|
|
(NULL_TREE, td1, tree_cons
|
|
|
|
|
(NULL_TREE, td2, tree_cons
|
|
|
|
|
(NULL_TREE, boff, tree_cons
|
|
|
|
|
(NULL_TREE, expr2, tree_cons
|
|
|
|
|
(NULL_TREE, td3, tree_cons
|
|
|
|
|
(NULL_TREE, expr1, NULL_TREE))))));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
elems = tree_cons
|
|
|
|
|
(NULL_TREE, expr1, tree_cons
|
1999-09-21 16:40:13 +02:00
|
|
|
|
(NULL_TREE, td3, tree_cons
|
2000-01-28 14:30:13 +01:00
|
|
|
|
(NULL_TREE, td2, tree_cons
|
|
|
|
|
(NULL_TREE, boff, NULL_TREE))));
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
2000-01-24 13:16:59 +01:00
|
|
|
|
dcast_fn = dynamic_cast_node;
|
|
|
|
|
if (!dcast_fn)
|
1996-04-13 01:55:07 +02:00
|
|
|
|
{
|
|
|
|
|
tree tmp;
|
2000-01-28 14:30:13 +01:00
|
|
|
|
tree tinfo_ptr;
|
2000-03-21 17:12:25 +01:00
|
|
|
|
tree ns = new_abi_rtti_p () ? abi_node : global_namespace;
|
2000-01-28 14:30:13 +01:00
|
|
|
|
const char *name;
|
|
|
|
|
|
2000-03-21 17:12:25 +01:00
|
|
|
|
push_nested_namespace (ns);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
if (!new_abi_rtti_p ())
|
|
|
|
|
{
|
|
|
|
|
tinfo_ptr = build_pointer_type (tinfo_decl_type);
|
|
|
|
|
name = "__dynamic_cast_2";
|
|
|
|
|
tmp = tree_cons
|
2000-01-24 13:16:59 +01:00
|
|
|
|
(NULL_TREE, tinfo_ptr, tree_cons
|
|
|
|
|
(NULL_TREE, tinfo_ptr, tree_cons
|
|
|
|
|
(NULL_TREE, integer_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, ptr_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, tinfo_ptr, tree_cons
|
|
|
|
|
(NULL_TREE, ptr_type_node, void_list_node))))));
|
2000-01-28 14:30:13 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tinfo_ptr = xref_tag (class_type_node,
|
|
|
|
|
get_identifier ("__class_type_info"),
|
|
|
|
|
1);
|
|
|
|
|
|
|
|
|
|
tinfo_ptr = build_pointer_type
|
|
|
|
|
(build_qualified_type
|
|
|
|
|
(tinfo_ptr, TYPE_QUAL_CONST));
|
|
|
|
|
name = "__dynamic_cast";
|
|
|
|
|
tmp = tree_cons
|
|
|
|
|
(NULL_TREE, const_ptr_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, tinfo_ptr, tree_cons
|
|
|
|
|
(NULL_TREE, tinfo_ptr, tree_cons
|
|
|
|
|
(NULL_TREE, ptrdiff_type_node, void_list_node))));
|
|
|
|
|
}
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tmp = build_function_type (ptr_type_node, tmp);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
if (new_abi_rtti_p ())
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
/* We want its name mangling. */
|
|
|
|
|
dcast_fn = build_cp_library_fn_ptr (name, tmp);
|
|
|
|
|
else
|
|
|
|
|
dcast_fn = build_library_fn_ptr (name, tmp);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
pop_nested_namespace (ns);
|
|
|
|
|
dynamic_cast_node = dcast_fn;
|
1996-04-13 01:55:07 +02:00
|
|
|
|
}
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
result = build_call (dcast_fn, elems);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
|
|
|
|
if (tc == REFERENCE_TYPE)
|
|
|
|
|
{
|
2000-01-28 14:30:13 +01:00
|
|
|
|
tree bad = throw_bad_cast ();
|
|
|
|
|
|
1996-02-01 20:33:01 +01:00
|
|
|
|
result = save_expr (result);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
return build (COND_EXPR, type, result, result, bad);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
1996-07-11 03:13:25 +02:00
|
|
|
|
/* Now back to the type we want from a void*. */
|
1997-05-29 01:20:02 +02:00
|
|
|
|
result = cp_convert (type, result);
|
1996-04-19 02:48:03 +02:00
|
|
|
|
return ifnonnull (expr, result);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-03-17 01:56:12 +01:00
|
|
|
|
else
|
|
|
|
|
errstr = "source type is not polymorphic";
|
1999-10-29 01:55:28 +02:00
|
|
|
|
|
1996-02-01 20:33:01 +01:00
|
|
|
|
fail:
|
2000-03-17 01:56:12 +01:00
|
|
|
|
cp_error ("cannot dynamic_cast `%E' (of type `%#T') to type `%#T' (%s)",
|
|
|
|
|
expr, exprtype, type, errstr);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
1997-07-24 23:09:25 +02:00
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
build_dynamic_cast (type, expr)
|
|
|
|
|
tree type, expr;
|
|
|
|
|
{
|
1997-11-26 11:14:51 +01:00
|
|
|
|
if (type == error_mark_node || expr == error_mark_node)
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
if (processing_template_decl)
|
1999-09-08 22:12:35 +02:00
|
|
|
|
return build_min (DYNAMIC_CAST_EXPR, type, expr);
|
1997-11-26 11:14:51 +01:00
|
|
|
|
|
1997-07-24 23:09:25 +02:00
|
|
|
|
return convert_from_reference (build_dynamic_cast_1 (type, expr));
|
|
|
|
|
}
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
|
|
|
|
/* Build and initialize various sorts of descriptors. Every descriptor
|
|
|
|
|
node has a name associated with it (the name created by mangling).
|
|
|
|
|
For this reason, we use the identifier as our access to the __*_desc
|
|
|
|
|
nodes, instead of sticking them directly in the types. Otherwise we
|
|
|
|
|
would burden all built-in types (and pointer types) with slots that
|
|
|
|
|
we don't necessarily want to use.
|
|
|
|
|
|
|
|
|
|
For each descriptor we build, we build a variable that contains
|
|
|
|
|
the descriptor's information. When we need this info at runtime,
|
|
|
|
|
all we need is access to these variables.
|
|
|
|
|
|
|
|
|
|
Note: these constructors always return the address of the descriptor
|
|
|
|
|
info, since that is simplest for their mutual interaction. */
|
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
/* Build an initializer for a __si_type_info node. */
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
static void
|
|
|
|
|
expand_si_desc (tdecl, type)
|
1996-02-01 20:33:01 +01:00
|
|
|
|
tree tdecl;
|
|
|
|
|
tree type;
|
|
|
|
|
{
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree t, elems, fn;
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
tree name_string = tinfo_name (type);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
|
|
|
|
type = BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0));
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_expr_stmt (get_typeid_1 (type));
|
1996-04-13 01:55:07 +02:00
|
|
|
|
t = decay_conversion (get_tinfo_var (type));
|
|
|
|
|
elems = tree_cons
|
|
|
|
|
(NULL_TREE, decay_conversion (tdecl), tree_cons
|
|
|
|
|
(NULL_TREE, decay_conversion (name_string), tree_cons
|
|
|
|
|
(NULL_TREE, t, NULL_TREE)));
|
|
|
|
|
|
|
|
|
|
fn = get_identifier ("__rtti_si");
|
|
|
|
|
if (IDENTIFIER_GLOBAL_VALUE (fn))
|
|
|
|
|
fn = IDENTIFIER_GLOBAL_VALUE (fn);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree tmp;
|
|
|
|
|
tmp = tree_cons
|
|
|
|
|
(NULL_TREE, ptr_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, const_string_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, build_pointer_type (type_info_type_node),
|
|
|
|
|
void_list_node)));
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
fn = push_void_library_fn (fn, tmp);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
fn = build_call (fn, elems);
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_expr_stmt (fn);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
1996-07-11 03:13:25 +02:00
|
|
|
|
/* Build an initializer for a __class_type_info node. */
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
expand_class_desc (tdecl, type)
|
1996-02-01 20:33:01 +01:00
|
|
|
|
tree tdecl;
|
|
|
|
|
tree type;
|
|
|
|
|
{
|
|
|
|
|
tree name_string;
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree fn, tmp;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
|
|
|
|
int i = CLASSTYPE_N_BASECLASSES (type);
|
|
|
|
|
int base_cnt = 0;
|
|
|
|
|
tree binfos = TYPE_BINFO_BASETYPES (type);
|
1996-02-28 23:01:56 +01:00
|
|
|
|
#if 0
|
|
|
|
|
/* See code below that used these. */
|
1996-02-01 20:33:01 +01:00
|
|
|
|
tree vb = CLASSTYPE_VBASECLASSES (type);
|
1996-02-28 23:01:56 +01:00
|
|
|
|
int n_base = i;
|
|
|
|
|
#endif
|
1996-02-01 20:33:01 +01:00
|
|
|
|
tree base, elems, access, offset, isvir;
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree elt, elts = NULL_TREE;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
if (base_desc_type_node == NULL_TREE)
|
1996-02-01 20:33:01 +01:00
|
|
|
|
{
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree fields [4];
|
|
|
|
|
|
|
|
|
|
/* A reasonably close approximation of __class_type_info::base_info */
|
|
|
|
|
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
base_desc_type_node = make_aggr_type (RECORD_TYPE);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
|
|
|
|
/* Actually const __user_type_info * */
|
1999-08-18 22:44:14 +02:00
|
|
|
|
fields [0] = build_lang_decl
|
1996-04-13 01:55:07 +02:00
|
|
|
|
(FIELD_DECL, NULL_TREE,
|
cplus-dem.c (work_stuff): Replace const_type and volatile_type with type_quals.
* cplus-dem.c (work_stuff): Replace const_type and volatile_type
with type_quals.
(TYPE_UNQUALIFIED): New macro.
(TYPE_QUAL_CONST): Likewise.
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(code_for_qualifier): New function.
(qualifier_string): Likewise.
(demangle_qualifier): Likewise.
(internal_cplus_demangle): Use them.
(demangle_signature): Likewise.
(demangle_template_value_parm): Likewise.
(do_type): Likewise.
(demangle_fund_type)): Likewise.
* Makefile.in (hash.h): Run gperf when necessary.
* cp-tree.h (CP_TYPE_READONLY): Remove.
(CP_TYPE_VOLATILE): Likewise.
(CP_TYPE_QUALS): New macro.
(CP_TYPE_CONST_P): Likewise.
(CP_TYPE_VOLATILE_P): Likewise.
(CP_TYPE_RESTRICT_P): Likewise.
(CP_TYPE_CONST_NON_VOLATILE_P): Likewise.
(cp_build_type_variant): Rename to ...
(cp_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Declare.
(SIGNATURE_POINTER_NAME_FORMAT): Modify to allow `restrict'.
(SIGNATURE_REFERENCE_NAME_FORMAT): Likewise.
(cp_type_qual_from_rid): New function.
(compparms): Remove unused parameter. All callers changed.
(cp_type_quals): New function.
(at_least_as_qualified_p): Likewise.
(more_qualified_p): Likewise.
* call.c (standard_conversion): Replace calls to
cp_build_type_variant with cp_build_qualified_type. Use
CP_TYPE_QUALS to get qualifiers and at_least_as_qualified_p to
compare them. Use CP_TYPE_* macros to check qualifiers.
(reference_binding): Likewise.
(implicit_conversion): Likewise.
(add_builtin_candidates): Likewise.
(build_over_call): Likewise.
* class.c (overrides): Compare all qualifiers, not just `const',
on method declarations.
* cvt.c (convert_to_reference): More CP_TYPE_QUALS conversion, etc.
(convert_pointer_to_real): Likewise.
(type_promotes_to): Likewise.
* decl.c (check_for_uninitialized_const_var): New function.
(init_decl_processing): More CP_TYPE_QUALS conversion, etc.
(cp_finish_decl): Use check_for_uninitialized_const_var.
(grokdeclarator): More CP_TYPE_QUALS conversion, etc. Update to
handle `restrict'.
(grok_ctor_properties): Likewise.
(grok_op_properties): Likewise.
(start_function): Likewise.
(rever_static_member_fn): Likewise.
* decl2.c (grok_method_quals): Likewise.
(grokfield): Likewise.
* error.c (dump_readonly_or_volatile): Rename to ...
(dump_qualifiers): New function. Handle `restrict'.
(dump_type_real): Use it.
(dump_aggr_type): Likewise.
(dump_type_prefix): Likewise.
(dump_type_suffix): Likewise.
(dump_function_decl): Likewise.
(cv_as_string): Likewise.
* gxx.gperf: Add __restrict and __restrict__.
* gxxint.texi: Document `u' as used for `__restrict', and a few
other previously undocumented codes.
* hash.h: Regenerated.
* init.c (expand_aggr_init): More CP_TYPE_QUALS conversion, etc.
(build_member_call): Likewise.
(build_new_1): Likewise.
* lex.c (init_parse): Add entry for RID_RESTRICT.
(cons_up_default_function): More CP_TYPE_QUALS conversion, etc.
(cp_type_qual_from_rid): Define.
* lex.h (enum rid): Add RID_RESTRICT.
* method.c (process_modifiers): Deal with `restrict'.
* parse.y (primary): More CP_TYPE_QUALS conversion, etc.
* parse.c: Regenerated.
* pt.c (convert_nontype_argument): More CP_TYPE_QUALS conversion, etc.
(tsubst_aggr_type): Likewise.
(tsubst): Likewise.
(check_cv_quals_for_unify): Likewise.
(unify): Likewise.
* rtti.c (init_rtti_processing): Likewise.
(build_headof): Likewise.
(get_tinfo_var): Likewise.
(buidl_dynamic_cast_1): Likewise. Fix `volatile' handling.
(expand_class_desc): Likewise.
(expand_attr_desc): Likewise.
(synthesize_tinfo_fn): Likewise.
* search.c (covariant_return_p): Likewise. Fix `volatile' handling.
(get_matching_virtual): Likewise.
(expand_upcast_fixups): Likewise.
* sig.c (build_signature_pointer_or_reference_name): Take
type_quals, not constp and volatilep.
(build_signature_pointer_or_reference_type): Likewise.
(match_method_types): More CP_TYPE_QUALS conversion, etc.
(build_signature_pointer_constructor): Likewise.
(build_signature_method_call): Likewise.
* tree.c (build_cplus_array_type): Likewise.
(cp_build_type_variant): Rename to ...
(cp_build_qualified_type): New function. Deal with `__restrict'.
(canonical_type_variant): More CP_TYPE_QUALS conversion, etc.
(build_exception_variant): Likewise.
(mapcar): Likewise.
* typeck.c (qualif_type): Likewise.
(common_type): Likewise.
(comptypes): Likewise.
(comp_cv_target_types): Likewise.
(at_least_as_qualified_p): Define.
(more_qualified_p): Likewise.
(comp_cv_qualification): More CP_TYPE_QUALS conversion, etc.
(compparms): Likewise.
(inline_conversion): Likewise.
(string_conv_p): Likewise.
(build_component_ref): Likewise.
(build_indirect_ref): Likewise.
(build_array_ref): Likewise.
(build_unary_op): Likewise.
(build_conditional_expr): Likewise.
(build_static_cast): Likewise.
(build_c_cast): Likewise.
(build_modify_expr): Likewise.
(convert_For_assignment): Likewise.
(comp_ptr_ttypes_real): Likewise.
(cp_type_quals): New function.
From-SVN: r23258
1998-10-23 16:53:28 +02:00
|
|
|
|
build_pointer_type (build_qualified_type
|
|
|
|
|
(type_info_type_node,
|
|
|
|
|
TYPE_QUAL_CONST)));
|
1999-08-18 22:44:14 +02:00
|
|
|
|
fields [1] = build_lang_decl
|
2000-01-17 05:08:01 +01:00
|
|
|
|
(FIELD_DECL, NULL_TREE,
|
|
|
|
|
flag_new_abi ? intSI_type_node : unsigned_intSI_type_node);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
DECL_BIT_FIELD (fields[1]) = 1;
|
* Eliminate DECL_FIELD_SIZE.
* builtins.c (built_in_class_names, built_in_names): New variables.
* c-decl.c (finish_struct): Set specified size in DECL_SIZE.
* expr.c (expand_expr, case COMPONENT_REF): Get field size from
DECL_SIZE, not DECL_FIELD_SIZE.
* print-tree.c (print_node): Remove code that prints extra blank
lines in some cases.
Properly handle inline and builtin function cases.
* stor-layout.c (layout_decl): Get specified size from DEC_SIZE.
* tree.h (built_in_class_named, built_in_names): New declarations.
(union tree_decl): Rename internal unions to u1 and u2 and change
some of their components.
Add new field built_in_class.
(DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE):
Reflect above changes.
(DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise.
(DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted.
* objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE.
(encode_field_decl): Likewise; also remove obsolete test for bitfield.
* ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
* ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE.
* ch/typeck.c (make_chill_struct_type): Likewise.
(apply_decl_field_layout): General cleanup.
Set DECL_SIZE instead of DECL_FIELD_SIZE.
* cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
DECL_FIELD_SIZE.
(check_bitfield_decl, check_field_decls): Set DECL_SIZE, not
DECL_FIELD_SIZE.
* cp/rtti.c (expand_class_desc): Likewise.
* cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name.
(THUNK_VCALL_OFFSET): Likewise.
(THUNK_DELTA): Reflect changes in ../tree.h.
* java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
(DECL_BIT_INDEX): Use underlying representation.
* java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise.
From-SVN: r32249
2000-02-29 03:34:48 +01:00
|
|
|
|
DECL_SIZE (fields[1]) = bitsize_int (29);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
* Eliminate DECL_FIELD_SIZE.
* builtins.c (built_in_class_names, built_in_names): New variables.
* c-decl.c (finish_struct): Set specified size in DECL_SIZE.
* expr.c (expand_expr, case COMPONENT_REF): Get field size from
DECL_SIZE, not DECL_FIELD_SIZE.
* print-tree.c (print_node): Remove code that prints extra blank
lines in some cases.
Properly handle inline and builtin function cases.
* stor-layout.c (layout_decl): Get specified size from DEC_SIZE.
* tree.h (built_in_class_named, built_in_names): New declarations.
(union tree_decl): Rename internal unions to u1 and u2 and change
some of their components.
Add new field built_in_class.
(DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE):
Reflect above changes.
(DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise.
(DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted.
* objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE.
(encode_field_decl): Likewise; also remove obsolete test for bitfield.
* ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
* ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE.
* ch/typeck.c (make_chill_struct_type): Likewise.
(apply_decl_field_layout): General cleanup.
Set DECL_SIZE instead of DECL_FIELD_SIZE.
* cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
DECL_FIELD_SIZE.
(check_bitfield_decl, check_field_decls): Set DECL_SIZE, not
DECL_FIELD_SIZE.
* cp/rtti.c (expand_class_desc): Likewise.
* cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name.
(THUNK_VCALL_OFFSET): Likewise.
(THUNK_DELTA): Reflect changes in ../tree.h.
* java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
(DECL_BIT_INDEX): Use underlying representation.
* java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise.
From-SVN: r32249
2000-02-29 03:34:48 +01:00
|
|
|
|
fields [2] = build_lang_decl (FIELD_DECL, NULL_TREE, boolean_type_node);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
DECL_BIT_FIELD (fields[2]) = 1;
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
DECL_SIZE (fields[2]) = bitsize_one_node;
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
|
|
|
|
/* Actually enum access */
|
* Eliminate DECL_FIELD_SIZE.
* builtins.c (built_in_class_names, built_in_names): New variables.
* c-decl.c (finish_struct): Set specified size in DECL_SIZE.
* expr.c (expand_expr, case COMPONENT_REF): Get field size from
DECL_SIZE, not DECL_FIELD_SIZE.
* print-tree.c (print_node): Remove code that prints extra blank
lines in some cases.
Properly handle inline and builtin function cases.
* stor-layout.c (layout_decl): Get specified size from DEC_SIZE.
* tree.h (built_in_class_named, built_in_names): New declarations.
(union tree_decl): Rename internal unions to u1 and u2 and change
some of their components.
Add new field built_in_class.
(DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE):
Reflect above changes.
(DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise.
(DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted.
* objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE.
(encode_field_decl): Likewise; also remove obsolete test for bitfield.
* ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
* ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE.
* ch/typeck.c (make_chill_struct_type): Likewise.
(apply_decl_field_layout): General cleanup.
Set DECL_SIZE instead of DECL_FIELD_SIZE.
* cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
DECL_FIELD_SIZE.
(check_bitfield_decl, check_field_decls): Set DECL_SIZE, not
DECL_FIELD_SIZE.
* cp/rtti.c (expand_class_desc): Likewise.
* cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name.
(THUNK_VCALL_OFFSET): Likewise.
(THUNK_DELTA): Reflect changes in ../tree.h.
* java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
(DECL_BIT_INDEX): Use underlying representation.
* java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise.
From-SVN: r32249
2000-02-29 03:34:48 +01:00
|
|
|
|
fields [3] = build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
DECL_BIT_FIELD (fields[3]) = 1;
|
* Eliminate DECL_FIELD_SIZE.
* builtins.c (built_in_class_names, built_in_names): New variables.
* c-decl.c (finish_struct): Set specified size in DECL_SIZE.
* expr.c (expand_expr, case COMPONENT_REF): Get field size from
DECL_SIZE, not DECL_FIELD_SIZE.
* print-tree.c (print_node): Remove code that prints extra blank
lines in some cases.
Properly handle inline and builtin function cases.
* stor-layout.c (layout_decl): Get specified size from DEC_SIZE.
* tree.h (built_in_class_named, built_in_names): New declarations.
(union tree_decl): Rename internal unions to u1 and u2 and change
some of their components.
Add new field built_in_class.
(DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE):
Reflect above changes.
(DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise.
(DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted.
* objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE.
(encode_field_decl): Likewise; also remove obsolete test for bitfield.
* ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
* ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE.
* ch/typeck.c (make_chill_struct_type): Likewise.
(apply_decl_field_layout): General cleanup.
Set DECL_SIZE instead of DECL_FIELD_SIZE.
* cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
DECL_FIELD_SIZE.
(check_bitfield_decl, check_field_decls): Set DECL_SIZE, not
DECL_FIELD_SIZE.
* cp/rtti.c (expand_class_desc): Likewise.
* cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name.
(THUNK_VCALL_OFFSET): Likewise.
(THUNK_DELTA): Reflect changes in ../tree.h.
* java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
(DECL_BIT_INDEX): Use underlying representation.
* java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise.
From-SVN: r32249
2000-02-29 03:34:48 +01:00
|
|
|
|
DECL_SIZE (fields[3]) = bitsize_int (2);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
finish_builtin_type (base_desc_type_node, "__base_info", fields,
|
1996-04-13 01:55:07 +02:00
|
|
|
|
3, ptr_type_node);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (--i >= 0)
|
|
|
|
|
{
|
|
|
|
|
tree binfo = TREE_VEC_ELT (binfos, i);
|
|
|
|
|
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_expr_stmt (get_typeid_1 (BINFO_TYPE (binfo)));
|
1996-04-13 01:55:07 +02:00
|
|
|
|
base = decay_conversion (get_tinfo_var (BINFO_TYPE (binfo)));
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
offset = get_base_offset (binfo, type);
|
|
|
|
|
|
1996-02-01 20:33:01 +01:00
|
|
|
|
if (TREE_VIA_PUBLIC (binfo))
|
1996-04-13 01:55:07 +02:00
|
|
|
|
access = access_public_node;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else if (TREE_VIA_PROTECTED (binfo))
|
1996-04-13 01:55:07 +02:00
|
|
|
|
access = access_protected_node;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else
|
1996-04-13 01:55:07 +02:00
|
|
|
|
access = access_private_node;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
if (TREE_VIA_VIRTUAL (binfo))
|
1996-04-13 01:55:07 +02:00
|
|
|
|
isvir = boolean_true_node;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else
|
1996-04-13 01:55:07 +02:00
|
|
|
|
isvir = boolean_false_node;
|
|
|
|
|
|
|
|
|
|
elt = build
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
(CONSTRUCTOR, base_desc_type_node, NULL_TREE, tree_cons
|
1996-04-13 01:55:07 +02:00
|
|
|
|
(NULL_TREE, base, tree_cons
|
|
|
|
|
(NULL_TREE, offset, tree_cons
|
|
|
|
|
(NULL_TREE, isvir, tree_cons
|
|
|
|
|
(NULL_TREE, access, NULL_TREE)))));
|
|
|
|
|
TREE_HAS_CONSTRUCTOR (elt) = TREE_CONSTANT (elt) = TREE_STATIC (elt) = 1;
|
1999-09-09 08:17:13 +02:00
|
|
|
|
elts = tree_cons (NULL_TREE, elt, elts);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
base_cnt++;
|
|
|
|
|
}
|
|
|
|
|
#if 0
|
|
|
|
|
i = n_base;
|
|
|
|
|
while (vb)
|
|
|
|
|
{
|
|
|
|
|
tree b;
|
1996-04-13 01:55:07 +02:00
|
|
|
|
access = access_public_node;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
while (--i >= 0)
|
|
|
|
|
{
|
|
|
|
|
b = TREE_VEC_ELT (binfos, i);
|
|
|
|
|
if (BINFO_TYPE (vb) == BINFO_TYPE (b) && TREE_VIA_VIRTUAL (b))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_VIA_PUBLIC (b))
|
1996-04-13 01:55:07 +02:00
|
|
|
|
access = access_public_node;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else if (TREE_VIA_PROTECTED (b))
|
1996-04-13 01:55:07 +02:00
|
|
|
|
access = access_protected_node;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else
|
1996-04-13 01:55:07 +02:00
|
|
|
|
access = access_private_node;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
base = build_t_desc (BINFO_TYPE (vb), 1);
|
|
|
|
|
offset = BINFO_OFFSET (vb);
|
|
|
|
|
isvir = build_int_2 (1, 0);
|
|
|
|
|
|
1999-09-09 08:17:13 +02:00
|
|
|
|
base_list = tree_cons (NULL_TREE, base, base_list);
|
|
|
|
|
isvir_list = tree_cons (NULL_TREE, isvir, isvir_list);
|
|
|
|
|
acc_list = tree_cons (NULL_TREE, access, acc_list);
|
|
|
|
|
off_list = tree_cons (NULL_TREE, offset, off_list);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
|
|
|
|
base_cnt++;
|
|
|
|
|
vb = TREE_CHAIN (vb);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
name_string = tinfo_name (type);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
{
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
tree arrtype = build_array_type (base_desc_type_node, NULL_TREE);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
elts = build (CONSTRUCTOR, arrtype, NULL_TREE, elts);
|
1997-05-06 22:14:14 +02:00
|
|
|
|
TREE_HAS_CONSTRUCTOR (elts) = TREE_CONSTANT (elts)
|
|
|
|
|
= TREE_STATIC (elts) = 1;
|
1996-04-13 01:55:07 +02:00
|
|
|
|
complete_array_type (arrtype, elts, 1);
|
|
|
|
|
}
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
elems = tree_cons
|
|
|
|
|
(NULL_TREE, decay_conversion (tdecl), tree_cons
|
|
|
|
|
(NULL_TREE, decay_conversion (name_string), tree_cons
|
|
|
|
|
(NULL_TREE, decay_conversion (elts), tree_cons
|
1997-05-29 01:20:02 +02:00
|
|
|
|
(NULL_TREE, cp_convert (sizetype, build_int_2 (base_cnt, 0)),
|
|
|
|
|
NULL_TREE))));
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
fn = get_identifier ("__rtti_class");
|
|
|
|
|
if (IDENTIFIER_GLOBAL_VALUE (fn))
|
|
|
|
|
fn = IDENTIFIER_GLOBAL_VALUE (fn);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tmp = tree_cons
|
|
|
|
|
(NULL_TREE, ptr_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, const_string_type_node, tree_cons
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
(NULL_TREE, build_pointer_type (base_desc_type_node), tree_cons
|
1996-04-13 01:55:07 +02:00
|
|
|
|
(NULL_TREE, sizetype, void_list_node))));
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
|
|
|
|
|
fn = push_void_library_fn (fn, tmp);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
fn = build_call (fn, elems);
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_expr_stmt (fn);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
/* Build an initializer for a __pointer_type_info node. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
static void
|
|
|
|
|
expand_ptr_desc (tdecl, type)
|
1996-02-01 20:33:01 +01:00
|
|
|
|
tree tdecl;
|
|
|
|
|
tree type;
|
|
|
|
|
{
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree t, elems, fn;
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
tree name_string = tinfo_name (type);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
|
|
|
|
type = TREE_TYPE (type);
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_expr_stmt (get_typeid_1 (type));
|
1996-04-13 01:55:07 +02:00
|
|
|
|
t = decay_conversion (get_tinfo_var (type));
|
|
|
|
|
elems = tree_cons
|
|
|
|
|
(NULL_TREE, decay_conversion (tdecl), tree_cons
|
|
|
|
|
(NULL_TREE, decay_conversion (name_string), tree_cons
|
|
|
|
|
(NULL_TREE, t, NULL_TREE)));
|
|
|
|
|
|
|
|
|
|
fn = get_identifier ("__rtti_ptr");
|
|
|
|
|
if (IDENTIFIER_GLOBAL_VALUE (fn))
|
|
|
|
|
fn = IDENTIFIER_GLOBAL_VALUE (fn);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tree tmp;
|
|
|
|
|
tmp = tree_cons
|
|
|
|
|
(NULL_TREE, ptr_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, const_string_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, build_pointer_type (type_info_type_node),
|
|
|
|
|
void_list_node)));
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
fn = push_void_library_fn (fn, tmp);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
fn = build_call (fn, elems);
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_expr_stmt (fn);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
/* Build an initializer for a __attr_type_info node. */
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
|
|
|
|
static void
|
1996-04-13 01:55:07 +02:00
|
|
|
|
expand_attr_desc (tdecl, type)
|
|
|
|
|
tree tdecl;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
tree type;
|
|
|
|
|
{
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree elems, t, fn;
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
tree name_string = tinfo_name (type);
|
cplus-dem.c (work_stuff): Replace const_type and volatile_type with type_quals.
* cplus-dem.c (work_stuff): Replace const_type and volatile_type
with type_quals.
(TYPE_UNQUALIFIED): New macro.
(TYPE_QUAL_CONST): Likewise.
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(code_for_qualifier): New function.
(qualifier_string): Likewise.
(demangle_qualifier): Likewise.
(internal_cplus_demangle): Use them.
(demangle_signature): Likewise.
(demangle_template_value_parm): Likewise.
(do_type): Likewise.
(demangle_fund_type)): Likewise.
* Makefile.in (hash.h): Run gperf when necessary.
* cp-tree.h (CP_TYPE_READONLY): Remove.
(CP_TYPE_VOLATILE): Likewise.
(CP_TYPE_QUALS): New macro.
(CP_TYPE_CONST_P): Likewise.
(CP_TYPE_VOLATILE_P): Likewise.
(CP_TYPE_RESTRICT_P): Likewise.
(CP_TYPE_CONST_NON_VOLATILE_P): Likewise.
(cp_build_type_variant): Rename to ...
(cp_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Declare.
(SIGNATURE_POINTER_NAME_FORMAT): Modify to allow `restrict'.
(SIGNATURE_REFERENCE_NAME_FORMAT): Likewise.
(cp_type_qual_from_rid): New function.
(compparms): Remove unused parameter. All callers changed.
(cp_type_quals): New function.
(at_least_as_qualified_p): Likewise.
(more_qualified_p): Likewise.
* call.c (standard_conversion): Replace calls to
cp_build_type_variant with cp_build_qualified_type. Use
CP_TYPE_QUALS to get qualifiers and at_least_as_qualified_p to
compare them. Use CP_TYPE_* macros to check qualifiers.
(reference_binding): Likewise.
(implicit_conversion): Likewise.
(add_builtin_candidates): Likewise.
(build_over_call): Likewise.
* class.c (overrides): Compare all qualifiers, not just `const',
on method declarations.
* cvt.c (convert_to_reference): More CP_TYPE_QUALS conversion, etc.
(convert_pointer_to_real): Likewise.
(type_promotes_to): Likewise.
* decl.c (check_for_uninitialized_const_var): New function.
(init_decl_processing): More CP_TYPE_QUALS conversion, etc.
(cp_finish_decl): Use check_for_uninitialized_const_var.
(grokdeclarator): More CP_TYPE_QUALS conversion, etc. Update to
handle `restrict'.
(grok_ctor_properties): Likewise.
(grok_op_properties): Likewise.
(start_function): Likewise.
(rever_static_member_fn): Likewise.
* decl2.c (grok_method_quals): Likewise.
(grokfield): Likewise.
* error.c (dump_readonly_or_volatile): Rename to ...
(dump_qualifiers): New function. Handle `restrict'.
(dump_type_real): Use it.
(dump_aggr_type): Likewise.
(dump_type_prefix): Likewise.
(dump_type_suffix): Likewise.
(dump_function_decl): Likewise.
(cv_as_string): Likewise.
* gxx.gperf: Add __restrict and __restrict__.
* gxxint.texi: Document `u' as used for `__restrict', and a few
other previously undocumented codes.
* hash.h: Regenerated.
* init.c (expand_aggr_init): More CP_TYPE_QUALS conversion, etc.
(build_member_call): Likewise.
(build_new_1): Likewise.
* lex.c (init_parse): Add entry for RID_RESTRICT.
(cons_up_default_function): More CP_TYPE_QUALS conversion, etc.
(cp_type_qual_from_rid): Define.
* lex.h (enum rid): Add RID_RESTRICT.
* method.c (process_modifiers): Deal with `restrict'.
* parse.y (primary): More CP_TYPE_QUALS conversion, etc.
* parse.c: Regenerated.
* pt.c (convert_nontype_argument): More CP_TYPE_QUALS conversion, etc.
(tsubst_aggr_type): Likewise.
(tsubst): Likewise.
(check_cv_quals_for_unify): Likewise.
(unify): Likewise.
* rtti.c (init_rtti_processing): Likewise.
(build_headof): Likewise.
(get_tinfo_var): Likewise.
(buidl_dynamic_cast_1): Likewise. Fix `volatile' handling.
(expand_class_desc): Likewise.
(expand_attr_desc): Likewise.
(synthesize_tinfo_fn): Likewise.
* search.c (covariant_return_p): Likewise. Fix `volatile' handling.
(get_matching_virtual): Likewise.
(expand_upcast_fixups): Likewise.
* sig.c (build_signature_pointer_or_reference_name): Take
type_quals, not constp and volatilep.
(build_signature_pointer_or_reference_type): Likewise.
(match_method_types): More CP_TYPE_QUALS conversion, etc.
(build_signature_pointer_constructor): Likewise.
(build_signature_method_call): Likewise.
* tree.c (build_cplus_array_type): Likewise.
(cp_build_type_variant): Rename to ...
(cp_build_qualified_type): New function. Deal with `__restrict'.
(canonical_type_variant): More CP_TYPE_QUALS conversion, etc.
(build_exception_variant): Likewise.
(mapcar): Likewise.
* typeck.c (qualif_type): Likewise.
(common_type): Likewise.
(comptypes): Likewise.
(comp_cv_target_types): Likewise.
(at_least_as_qualified_p): Define.
(more_qualified_p): Likewise.
(comp_cv_qualification): More CP_TYPE_QUALS conversion, etc.
(compparms): Likewise.
(inline_conversion): Likewise.
(string_conv_p): Likewise.
(build_component_ref): Likewise.
(build_indirect_ref): Likewise.
(build_array_ref): Likewise.
(build_unary_op): Likewise.
(build_conditional_expr): Likewise.
(build_static_cast): Likewise.
(build_c_cast): Likewise.
(build_modify_expr): Likewise.
(convert_For_assignment): Likewise.
(comp_ptr_ttypes_real): Likewise.
(cp_type_quals): New function.
From-SVN: r23258
1998-10-23 16:53:28 +02:00
|
|
|
|
tree attrval = build_int_2 (TYPE_QUALS (type), 0);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_expr_stmt (get_typeid_1 (TYPE_MAIN_VARIANT (type)));
|
1996-04-13 01:55:07 +02:00
|
|
|
|
t = decay_conversion (get_tinfo_var (TYPE_MAIN_VARIANT (type)));
|
|
|
|
|
elems = tree_cons
|
|
|
|
|
(NULL_TREE, decay_conversion (tdecl), tree_cons
|
|
|
|
|
(NULL_TREE, decay_conversion (name_string), tree_cons
|
1999-09-09 08:17:13 +02:00
|
|
|
|
(NULL_TREE, attrval, tree_cons (NULL_TREE, t, NULL_TREE))));
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
|
|
|
|
fn = get_identifier ("__rtti_attr");
|
|
|
|
|
if (IDENTIFIER_GLOBAL_VALUE (fn))
|
|
|
|
|
fn = IDENTIFIER_GLOBAL_VALUE (fn);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tree tmp;
|
|
|
|
|
tmp = tree_cons
|
|
|
|
|
(NULL_TREE, ptr_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, const_string_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, integer_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, build_pointer_type (type_info_type_node),
|
|
|
|
|
void_list_node))));
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
fn = push_void_library_fn (fn, tmp);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
}
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
fn = build_call (fn, elems);
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_expr_stmt (fn);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
/* Build an initializer for a type_info node that just has a name. */
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
static void
|
|
|
|
|
expand_generic_desc (tdecl, type, fnname)
|
|
|
|
|
tree tdecl;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
tree type;
|
Warning fixes:
* call.c (op_error): Const-ify a char*.
(add_candidate, source_type, add_warning): Add static prototype.
(print_z_candidates): Const-ify a char*.
* class.c (resolve_address_of_overloaded_function,
fixed_type_or_null, build_vtable_entry_ref): Add static prototype.
(get_vtable_name, finish_struct_1): Const-ify a char*.
* cvt.c (convert_to_reference): Likewise.
* decl.c (redeclaration_error_message, record_builtin_type,
record_unknown_type, member_function_or_else, bad_specifiers):
Likewise.
(find_binding, select_decl, unqualified_namespace_lookup,
lookup_flags, qualify_lookup, record_builtin_java_type, tag_name):
Add static prototype.
(warn_extern_redeclared_static, duplicate_decls, pushdecl,
implicitly_declare, record_builtin_java_type, define_function,
grok_op_properties, tag_name): Const-ify a char*.
* cp-tree.h (FORMAT_VBASE_NAME): Allow parameter `BUF' to be const.
(define_function, finish_builtin_type): Const-ify a char*.
(cp_error, cp_error_at, cp_warning, cp_warning_at, cp_pedwarn,
cp_pedwarn_at, cp_compiler_error, cp_sprintf): Add prototype args.
(file_name_nondirectory): Const-ify a char*.
(init_filename_times): Don't prototype.
(compiler_error): Prototype.
(yyerror, init_repo): Const-ify a char*.
(build_srcloc): Don't prototype.
(build_x_indirect_ref, build_indirect_ref, build_component_addr):
Const-ify a char*.
(warn_for_assignment): Don't prototype.
(convert_for_initialization, readonly_error, check_for_new_type,
GNU_xref_begin, GNU_xref_file, GNU_xref_ref, GNU_xref_call):
Const-ify a char*.
* decl2.c (acceptable_java_type, output_vtable_inherit,
setup_initp, start_objects, finish_objects, do_dtors, do_ctors,
merge_functions, decl_namespace, validate_nonmember_using_decl,
do_nonmember_using_decl): Add static prototype.
(lang_f_options): Const-ify a char*.
(finish_builtin_type): Likewise.
(add_function, arg_assoc_namespace, arg_assoc_class): Add static
prototype.
* errfn.c: Include cp-tree.h.
(cp_thing): Add static prototype.
(compiler_error): Don't protoptype.
(cp_compiler_error): Cast `compiler_error' to `errorfn' before
passing it to `cp_thing'.
* error.c (interesting_scope_p): Add static prototype.
* except.c (build_eh_type_type, build_eh_type_type_ref): Const-ify
a char*.
* init.c (compiler_error): Don't prototype.
(member_init_ok_or_else): Const-ify a char*.
(build_java_class_ref): Add static prototype.
* lex.c (compiler_error): Don't prototype.
(get_time_identifier, interface_strcmp, extend_token_buffer,
handle_cp_pragma): Const-ify a char*.
(is_global, init_filename_times): Add static prototype.
(file_name_nondirectory, cplus_tree_code_name): Const-ify a char*.
(compiler_error): Change from fixed args to variable args.
(yyerror): Const-ify a char*.
* parse.y (cond_stmt_keyword): Const-ify a char*.
(parse_decl): Add static prototype.
* pt.c (template_args_equal, print_template_context): Likewise.
(print_candidates, check_default_tmpl_args): Const-ify a char*.
(instantiate_class_template): Likewise.
* repo.c (get_base_filename, open_repo_file, init_repo): Likewise.
* rtti.c (call_void_fn, expand_generic_desc, expand_si_desc,
expand_class_desc, expand_ptr_desc, expand_attr_desc): Likewise.
* search.c (lookup_field_info, lookup_member): Likewise.
(lookup_member): Cast the first argument of `bzero' to a PTR.
* sig.c (compiler_error): Don't prototype.
(build_signature_pointer_or_reference_nam): Const-ify a char*.
(get_sigtable_name, build_member_function_pointer): Likewise.
* tree.c (compiler_error): Don't prototype.
(no_linkage_helper, build_srcloc): Add static prototype.
(build_vbase_pointer_fields): Const-ify a char*.
(__eprintf): Don't unnecessarily handle `const' when !__STDC__.
* typeck.c (compiler_error): Don't prototype.
(convert_for_assignment): Const-ify a char*.
(comp_cv_target_types): Add static prototype.
(build_x_indirect_ref, build_indirect_ref, convert_arguments,
build_component_addr, build_unary_op, convert_for_initialization):
Const-ify a char*.
* typeck2.c (ack): Add static prototype and change from fixed args
to variable args.
(readonly_error, check_for_new_type): Const-ify a char*.
* xref.c (_XREF_FILE, find_file, filename, fctname, declname,
fixname, open_xref_file, classname, GNU_xref_begin): Likewise.
(GNU_xref_file): Likewise. Also use `xmalloc' instead of `malloc'.
(GNU_xref_end_scope, GNU_xref_ref, GNU_xref_decl, GNU_xref_call,
gen_assign, GNU_xref_member): Const-ify a char*.
From-SVN: r25994
1999-03-26 08:45:00 +01:00
|
|
|
|
const char *fnname;
|
1996-02-01 20:33:01 +01:00
|
|
|
|
{
|
cp-tree.h (CPTI_TP_DESC_TYPE, [...]): Remove cp_tree_index enumerations.
* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
(CPTI_TINFO_VAR_ID): New enumeration.
(__tp_desc_type_node, __access_mode_type_node,
__bltn_desc_type_node, __user_desc_type_node,
__class_desc_type_node, __ptr_desc_type_node,
__attr_desc_type_node, __func_desc_type_node,
__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
enum_desc_type_node, class_desc_type_node,
si_class_desc_type_node, vmi_class_desc_type_node,
ptmd_desc_type_node, base_desc_type_node): New #defines.
(tinfo_fn_id, tinfo_fn_type): Rename to ...
(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
(tinfo_var_id): New enumeration.
(DECL_TINFO_FN_P): Augment comment.
* decl.c (cp_global_trees): Adjust documentation.
* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
tinfo_decl_type and tinfo_var_id.
(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
(build_typeid): Remove unused variable.
(get_tinfo_var): Use tinfo_var_id.
(tinfo_name): New static function.
(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
(tinfo_from_decl): Likewise.
(get_base_offset): New static function, broken out of
expand_class_desc.
(expand_si_desc): Use tinfo_name.
(expand_class_desc): Likewise. Lose local static variable.
Use base_desc_type_node. Use get_base_offset.
(expand_ptr_desc): Use tinfo_name.
(expand_attr_desc): Likewise.
(expand_generic_desc): Likewise.
* tinfo.cc (__GXX_ABI_VERSION): Test value and existance.
* tinfo.h (__GXX_ABI_VERSION): Test value and existance.
From-SVN: r31582
2000-01-24 11:23:26 +01:00
|
|
|
|
tree name_string = tinfo_name (type);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree elems = tree_cons
|
|
|
|
|
(NULL_TREE, decay_conversion (tdecl), tree_cons
|
|
|
|
|
(NULL_TREE, decay_conversion (name_string), NULL_TREE));
|
|
|
|
|
|
|
|
|
|
tree fn = get_identifier (fnname);
|
|
|
|
|
if (IDENTIFIER_GLOBAL_VALUE (fn))
|
|
|
|
|
fn = IDENTIFIER_GLOBAL_VALUE (fn);
|
|
|
|
|
else
|
1996-02-01 20:33:01 +01:00
|
|
|
|
{
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tree tmp;
|
|
|
|
|
tmp = tree_cons
|
|
|
|
|
(NULL_TREE, ptr_type_node, tree_cons
|
|
|
|
|
(NULL_TREE, const_string_type_node, void_list_node));
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
fn = push_void_library_fn (fn, tmp);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
decl.c (push_overloaded_decl_1, [...]): Lose.
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
(builtin_function): Use it.
(get_atexit_node): Use build_library_fn_ptr.
(build_library_fn, build_cp_library_fn, build_library_fn_ptr,
build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
push_void_library_fn, push_throw_library_fn): New fns.
* cp-tree.h: Declare them.
(cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
(throw_bad_cast_node, throw_bad_typeid_node): Lose.
* except.c (init_exception_processing, call_eh_info, do_pop_exception,
(expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
* rtti.c (build_runtime_decl): Lose.
(throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
build_dynamic_cast_1, expand_si_desc, expand_class_desc,
expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
* call.c (build_call): Remove result_type parm.
Call mark_used on unused artificial fns.
* init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
From-SVN: r32468
2000-03-10 10:25:45 +01:00
|
|
|
|
fn = build_call (fn, elems);
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_expr_stmt (fn);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
}
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
/* Generate the code for a type_info initialization function.
|
|
|
|
|
Note that we take advantage of the passage
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
5.2.7 Type identification [expr.typeid]
|
|
|
|
|
|
|
|
|
|
Whether or not the destructor is called for the type_info object at the
|
|
|
|
|
end of the program is unspecified.
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
and don't bother to arrange for these objects to be destroyed. It
|
|
|
|
|
doesn't matter, anyway, since the destructors don't do anything.
|
|
|
|
|
|
|
|
|
|
This must only be called from toplevel (i.e. from finish_file)! */
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-04-13 01:55:07 +02:00
|
|
|
|
void
|
|
|
|
|
synthesize_tinfo_fn (fndecl)
|
|
|
|
|
tree fndecl;
|
|
|
|
|
{
|
|
|
|
|
tree type = TREE_TYPE (DECL_NAME (fndecl));
|
1998-11-15 20:24:43 +01:00
|
|
|
|
tree tmp, addr, tdecl;
|
1999-09-10 10:14:16 +02:00
|
|
|
|
tree compound_stmt;
|
|
|
|
|
tree if_stmt;
|
|
|
|
|
tree then_clause;
|
1998-11-15 20:24:43 +01:00
|
|
|
|
|
2000-01-28 14:30:13 +01:00
|
|
|
|
my_friendly_assert (!new_abi_rtti_p (), 20000118);
|
1998-11-15 20:24:43 +01:00
|
|
|
|
if (at_eof)
|
|
|
|
|
{
|
|
|
|
|
import_export_decl (fndecl);
|
|
|
|
|
if (DECL_REALLY_EXTERN (fndecl))
|
|
|
|
|
return;
|
|
|
|
|
}
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1999-09-10 10:14:16 +02:00
|
|
|
|
/* Declare the static typeinfo variable. */
|
1998-11-15 20:24:43 +01:00
|
|
|
|
tdecl = get_tinfo_var (type);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
DECL_EXTERNAL (tdecl) = 0;
|
|
|
|
|
TREE_STATIC (tdecl) = 1;
|
|
|
|
|
DECL_COMMON (tdecl) = 1;
|
|
|
|
|
TREE_USED (tdecl) = 1;
|
|
|
|
|
DECL_ALIGN (tdecl) = TYPE_ALIGN (ptr_type_node);
|
1999-11-14 21:29:06 +01:00
|
|
|
|
cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
1999-09-10 10:14:16 +02:00
|
|
|
|
/* Begin processing the function. */
|
1999-09-09 21:02:39 +02:00
|
|
|
|
start_function (NULL_TREE, fndecl, NULL_TREE,
|
|
|
|
|
SF_DEFAULT | SF_PRE_PARSED);
|
1999-11-12 23:25:42 +01:00
|
|
|
|
DECL_DEFER_OUTPUT (fndecl) = 1;
|
1996-04-13 01:55:07 +02:00
|
|
|
|
store_parm_decls ();
|
|
|
|
|
clear_last_expr ();
|
1999-09-10 10:14:16 +02:00
|
|
|
|
|
|
|
|
|
/* Begin the body of the function. */
|
|
|
|
|
compound_stmt = begin_compound_stmt (/*has_no_scope=*/0);
|
|
|
|
|
|
|
|
|
|
/* For convenience, we save away the address of the static
|
1999-10-28 07:10:05 +02:00
|
|
|
|
variable. */
|
1999-09-10 10:14:16 +02:00
|
|
|
|
addr = decay_conversion (tdecl);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
|
|
|
|
/* If the first word of the array (the vtable) is non-zero, we've already
|
|
|
|
|
initialized the object, so don't do it again. */
|
1999-09-10 10:14:16 +02:00
|
|
|
|
if_stmt = begin_if_stmt ();
|
1997-05-29 01:20:02 +02:00
|
|
|
|
tmp = cp_convert (build_pointer_type (ptr_type_node), addr);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tmp = build_indirect_ref (tmp, 0);
|
1999-04-20 23:48:52 +02:00
|
|
|
|
tmp = build_binary_op (EQ_EXPR, tmp, integer_zero_node);
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_if_stmt_cond (tmp, if_stmt);
|
|
|
|
|
then_clause = begin_compound_stmt (/*has_no_scope=*/0);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1996-09-30 23:34:04 +02:00
|
|
|
|
if (TREE_CODE (type) == FUNCTION_TYPE)
|
|
|
|
|
expand_generic_desc (tdecl, type, "__rtti_func");
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else if (TREE_CODE (type) == ARRAY_TYPE)
|
1996-04-13 01:55:07 +02:00
|
|
|
|
expand_generic_desc (tdecl, type, "__rtti_array");
|
cplus-dem.c (work_stuff): Replace const_type and volatile_type with type_quals.
* cplus-dem.c (work_stuff): Replace const_type and volatile_type
with type_quals.
(TYPE_UNQUALIFIED): New macro.
(TYPE_QUAL_CONST): Likewise.
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(code_for_qualifier): New function.
(qualifier_string): Likewise.
(demangle_qualifier): Likewise.
(internal_cplus_demangle): Use them.
(demangle_signature): Likewise.
(demangle_template_value_parm): Likewise.
(do_type): Likewise.
(demangle_fund_type)): Likewise.
* Makefile.in (hash.h): Run gperf when necessary.
* cp-tree.h (CP_TYPE_READONLY): Remove.
(CP_TYPE_VOLATILE): Likewise.
(CP_TYPE_QUALS): New macro.
(CP_TYPE_CONST_P): Likewise.
(CP_TYPE_VOLATILE_P): Likewise.
(CP_TYPE_RESTRICT_P): Likewise.
(CP_TYPE_CONST_NON_VOLATILE_P): Likewise.
(cp_build_type_variant): Rename to ...
(cp_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Declare.
(SIGNATURE_POINTER_NAME_FORMAT): Modify to allow `restrict'.
(SIGNATURE_REFERENCE_NAME_FORMAT): Likewise.
(cp_type_qual_from_rid): New function.
(compparms): Remove unused parameter. All callers changed.
(cp_type_quals): New function.
(at_least_as_qualified_p): Likewise.
(more_qualified_p): Likewise.
* call.c (standard_conversion): Replace calls to
cp_build_type_variant with cp_build_qualified_type. Use
CP_TYPE_QUALS to get qualifiers and at_least_as_qualified_p to
compare them. Use CP_TYPE_* macros to check qualifiers.
(reference_binding): Likewise.
(implicit_conversion): Likewise.
(add_builtin_candidates): Likewise.
(build_over_call): Likewise.
* class.c (overrides): Compare all qualifiers, not just `const',
on method declarations.
* cvt.c (convert_to_reference): More CP_TYPE_QUALS conversion, etc.
(convert_pointer_to_real): Likewise.
(type_promotes_to): Likewise.
* decl.c (check_for_uninitialized_const_var): New function.
(init_decl_processing): More CP_TYPE_QUALS conversion, etc.
(cp_finish_decl): Use check_for_uninitialized_const_var.
(grokdeclarator): More CP_TYPE_QUALS conversion, etc. Update to
handle `restrict'.
(grok_ctor_properties): Likewise.
(grok_op_properties): Likewise.
(start_function): Likewise.
(rever_static_member_fn): Likewise.
* decl2.c (grok_method_quals): Likewise.
(grokfield): Likewise.
* error.c (dump_readonly_or_volatile): Rename to ...
(dump_qualifiers): New function. Handle `restrict'.
(dump_type_real): Use it.
(dump_aggr_type): Likewise.
(dump_type_prefix): Likewise.
(dump_type_suffix): Likewise.
(dump_function_decl): Likewise.
(cv_as_string): Likewise.
* gxx.gperf: Add __restrict and __restrict__.
* gxxint.texi: Document `u' as used for `__restrict', and a few
other previously undocumented codes.
* hash.h: Regenerated.
* init.c (expand_aggr_init): More CP_TYPE_QUALS conversion, etc.
(build_member_call): Likewise.
(build_new_1): Likewise.
* lex.c (init_parse): Add entry for RID_RESTRICT.
(cons_up_default_function): More CP_TYPE_QUALS conversion, etc.
(cp_type_qual_from_rid): Define.
* lex.h (enum rid): Add RID_RESTRICT.
* method.c (process_modifiers): Deal with `restrict'.
* parse.y (primary): More CP_TYPE_QUALS conversion, etc.
* parse.c: Regenerated.
* pt.c (convert_nontype_argument): More CP_TYPE_QUALS conversion, etc.
(tsubst_aggr_type): Likewise.
(tsubst): Likewise.
(check_cv_quals_for_unify): Likewise.
(unify): Likewise.
* rtti.c (init_rtti_processing): Likewise.
(build_headof): Likewise.
(get_tinfo_var): Likewise.
(buidl_dynamic_cast_1): Likewise. Fix `volatile' handling.
(expand_class_desc): Likewise.
(expand_attr_desc): Likewise.
(synthesize_tinfo_fn): Likewise.
* search.c (covariant_return_p): Likewise. Fix `volatile' handling.
(get_matching_virtual): Likewise.
(expand_upcast_fixups): Likewise.
* sig.c (build_signature_pointer_or_reference_name): Take
type_quals, not constp and volatilep.
(build_signature_pointer_or_reference_type): Likewise.
(match_method_types): More CP_TYPE_QUALS conversion, etc.
(build_signature_pointer_constructor): Likewise.
(build_signature_method_call): Likewise.
* tree.c (build_cplus_array_type): Likewise.
(cp_build_type_variant): Rename to ...
(cp_build_qualified_type): New function. Deal with `__restrict'.
(canonical_type_variant): More CP_TYPE_QUALS conversion, etc.
(build_exception_variant): Likewise.
(mapcar): Likewise.
* typeck.c (qualif_type): Likewise.
(common_type): Likewise.
(comptypes): Likewise.
(comp_cv_target_types): Likewise.
(at_least_as_qualified_p): Define.
(more_qualified_p): Likewise.
(comp_cv_qualification): More CP_TYPE_QUALS conversion, etc.
(compparms): Likewise.
(inline_conversion): Likewise.
(string_conv_p): Likewise.
(build_component_ref): Likewise.
(build_indirect_ref): Likewise.
(build_array_ref): Likewise.
(build_unary_op): Likewise.
(build_conditional_expr): Likewise.
(build_static_cast): Likewise.
(build_c_cast): Likewise.
(build_modify_expr): Likewise.
(convert_For_assignment): Likewise.
(comp_ptr_ttypes_real): Likewise.
(cp_type_quals): New function.
From-SVN: r23258
1998-10-23 16:53:28 +02:00
|
|
|
|
else if (TYPE_QUALS (type) != TYPE_UNQUALIFIED)
|
1996-09-30 23:34:04 +02:00
|
|
|
|
expand_attr_desc (tdecl, type);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else if (TREE_CODE (type) == POINTER_TYPE)
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (TREE_TYPE (type)) == OFFSET_TYPE)
|
1996-04-13 01:55:07 +02:00
|
|
|
|
expand_generic_desc (tdecl, type, "__rtti_ptmd");
|
|
|
|
|
else if (TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)
|
|
|
|
|
expand_generic_desc (tdecl, type, "__rtti_ptmf");
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else
|
1996-04-13 01:55:07 +02:00
|
|
|
|
expand_ptr_desc (tdecl, type);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
1996-04-13 01:55:07 +02:00
|
|
|
|
else if (TYPE_PTRMEMFUNC_P (type))
|
|
|
|
|
expand_generic_desc (tdecl, type, "__rtti_ptmf");
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else if (IS_AGGR_TYPE (type))
|
|
|
|
|
{
|
1996-04-13 01:55:07 +02:00
|
|
|
|
if (CLASSTYPE_N_BASECLASSES (type) == 0)
|
|
|
|
|
expand_generic_desc (tdecl, type, "__rtti_user");
|
1999-12-21 01:19:01 +01:00
|
|
|
|
else if (! TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (type)
|
1996-04-13 01:55:07 +02:00
|
|
|
|
&& (TREE_VIA_PUBLIC
|
|
|
|
|
(TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0))))
|
|
|
|
|
expand_si_desc (tdecl, type);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
else
|
1996-04-13 01:55:07 +02:00
|
|
|
|
expand_class_desc (tdecl, type);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
1996-04-13 01:55:07 +02:00
|
|
|
|
else if (TREE_CODE (type) == ENUMERAL_TYPE)
|
|
|
|
|
expand_generic_desc (tdecl, type, "__rtti_user");
|
|
|
|
|
else
|
|
|
|
|
my_friendly_abort (252);
|
1996-02-01 20:33:01 +01:00
|
|
|
|
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_compound_stmt (/*has_no_scope=*/0, then_clause);
|
|
|
|
|
finish_then_clause (if_stmt);
|
|
|
|
|
finish_if_stmt ();
|
1996-04-13 01:55:07 +02:00
|
|
|
|
|
|
|
|
|
/* OK, now return the type_info object. */
|
1997-05-29 01:20:02 +02:00
|
|
|
|
tmp = cp_convert (build_pointer_type (type_info_type_node), addr);
|
1996-04-13 01:55:07 +02:00
|
|
|
|
tmp = build_indirect_ref (tmp, 0);
|
1999-09-10 10:14:16 +02:00
|
|
|
|
finish_return_stmt (tmp);
|
|
|
|
|
/* Finish the function body. */
|
|
|
|
|
finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
|
1999-09-18 03:23:20 +02:00
|
|
|
|
expand_body (finish_function (lineno, 0));
|
1996-02-01 20:33:01 +01:00
|
|
|
|
}
|
2000-01-28 14:30:13 +01:00
|
|
|
|
|
|
|
|
|
/* Return the runtime bit mask encoding the qualifiers of TYPE. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
qualifier_flags (type)
|
|
|
|
|
tree type;
|
|
|
|
|
{
|
|
|
|
|
int flags = 0;
|
|
|
|
|
/* we want the qualifiers on this type, not any array core, it might have */
|
|
|
|
|
int quals = TYPE_QUALS (type);
|
|
|
|
|
|
|
|
|
|
if (quals & TYPE_QUAL_CONST)
|
|
|
|
|
flags |= 1;
|
|
|
|
|
if (quals & TYPE_QUAL_VOLATILE)
|
|
|
|
|
flags |= 2;
|
|
|
|
|
return flags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a CONSTRUCTOR for the common part of the type_info objects. This
|
|
|
|
|
is the vtable pointer and NTBS name. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
tinfo_base_init (desc, target)
|
|
|
|
|
tree desc;
|
|
|
|
|
tree target;
|
|
|
|
|
{
|
|
|
|
|
tree name_string = tinfo_name (target);
|
|
|
|
|
tree init = NULL_TREE;
|
|
|
|
|
|
|
|
|
|
if (TINFO_VTABLE_DECL (desc))
|
|
|
|
|
{
|
|
|
|
|
tree vtbl_ptr = build_unary_op (ADDR_EXPR, TINFO_VTABLE_DECL (desc), 0);
|
|
|
|
|
|
|
|
|
|
init = tree_cons (NULL_TREE, vtbl_ptr, init);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
init = tree_cons (NULL_TREE, decay_conversion (name_string), init);
|
|
|
|
|
|
2000-03-17 01:56:12 +01:00
|
|
|
|
init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
|
2000-01-28 14:30:13 +01:00
|
|
|
|
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
|
|
|
|
|
init = tree_cons (NULL_TREE, init, NULL_TREE);
|
|
|
|
|
|
|
|
|
|
return init;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the CONSTRUCTOR expr for a type_info of TYPE. DESC provides the
|
|
|
|
|
information about the particular type_info derivation, which adds no
|
|
|
|
|
additional fields to the type_info base. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
generic_initializer (desc, target)
|
|
|
|
|
tree desc;
|
|
|
|
|
tree target;
|
|
|
|
|
{
|
|
|
|
|
tree init = tinfo_base_init (desc, target);
|
|
|
|
|
|
|
|
|
|
init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, init);
|
|
|
|
|
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
|
|
|
|
|
return init;
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-15 11:40:27 +01:00
|
|
|
|
/* Return the CONSTRUCTOR expr for a type_info of pointer TYPE.
|
2000-01-28 14:30:13 +01:00
|
|
|
|
DESC provides information about the particular type_info derivation,
|
|
|
|
|
which adds target type and qualifier flags members to the type_info base. */
|
|
|
|
|
|
|
|
|
|
static tree
|
2000-03-15 11:40:27 +01:00
|
|
|
|
ptr_initializer (desc, target)
|
2000-01-28 14:30:13 +01:00
|
|
|
|
tree desc;
|
|
|
|
|
tree target;
|
|
|
|
|
{
|
|
|
|
|
tree init = tinfo_base_init (desc, target);
|
|
|
|
|
tree to = TREE_TYPE (target);
|
|
|
|
|
int flags = qualifier_flags (to);
|
|
|
|
|
|
|
|
|
|
init = tree_cons (NULL_TREE, build_int_2 (flags, 0), init);
|
|
|
|
|
init = tree_cons (NULL_TREE,
|
|
|
|
|
build_unary_op (ADDR_EXPR,
|
|
|
|
|
get_tinfo_decl (TYPE_MAIN_VARIANT (to)), 0),
|
|
|
|
|
init);
|
|
|
|
|
|
|
|
|
|
init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
|
|
|
|
|
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
|
|
|
|
|
return init;
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-15 11:40:27 +01:00
|
|
|
|
/* Return the CONSTRUCTOR expr for a type_info of pointer to member data TYPE.
|
2000-01-28 14:30:13 +01:00
|
|
|
|
DESC provides information about the particular type_info derivation,
|
|
|
|
|
which adds target type and qualifier flags members to the type_info base. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
ptmd_initializer (desc, target)
|
|
|
|
|
tree desc;
|
|
|
|
|
tree target;
|
|
|
|
|
{
|
|
|
|
|
tree init = tinfo_base_init (desc, target);
|
|
|
|
|
tree to = TYPE_PTRMEM_POINTED_TO_TYPE (target);
|
|
|
|
|
tree klass = TYPE_PTRMEM_CLASS_TYPE (target);
|
|
|
|
|
int flags = qualifier_flags (to);
|
|
|
|
|
|
|
|
|
|
init = tree_cons (NULL_TREE,
|
|
|
|
|
build_unary_op (ADDR_EXPR, get_tinfo_decl (klass), 0),
|
|
|
|
|
init);
|
|
|
|
|
init = tree_cons (NULL_TREE,
|
|
|
|
|
build_unary_op (ADDR_EXPR,
|
|
|
|
|
get_tinfo_decl (TYPE_MAIN_VARIANT (to)), 0),
|
|
|
|
|
init);
|
|
|
|
|
init = tree_cons (NULL_TREE, build_int_2 (flags, 0), init);
|
|
|
|
|
|
|
|
|
|
init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
|
|
|
|
|
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
|
|
|
|
|
return init;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Determine the hint flags describing the features of a class's heirarchy.
|
|
|
|
|
FIXME: better set the hint_flags here! For now set them
|
|
|
|
|
to safe 'don't know' values. The specification is under
|
|
|
|
|
review. Don't forget to check the runtime dynamic_cast and
|
|
|
|
|
catch machinery if these change. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
class_hint_flags (type)
|
|
|
|
|
tree type;
|
|
|
|
|
{
|
|
|
|
|
int hint_flags = 0;
|
|
|
|
|
hint_flags |= 0x1; /* contains multiply inherited sub object */
|
|
|
|
|
hint_flags |= 0x4; /* has virtual bases */
|
|
|
|
|
hint_flags |= 0x8; /* has private base */
|
|
|
|
|
if (TYPE_POLYMORPHIC_P (type))
|
|
|
|
|
hint_flags |= 0x2;
|
|
|
|
|
|
|
|
|
|
return hint_flags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the CONSTRUCTOR expr for a type_info of class TYPE.
|
|
|
|
|
DESC provides information about the particular __class_type_info derivation,
|
|
|
|
|
which adds hint flags and TRAIL initializers to the type_info base. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
class_initializer (desc, target, trail)
|
|
|
|
|
tree desc;
|
|
|
|
|
tree target;
|
|
|
|
|
tree trail;
|
|
|
|
|
{
|
|
|
|
|
tree init = tinfo_base_init (desc, target);
|
|
|
|
|
int flags = class_hint_flags (target);
|
|
|
|
|
|
|
|
|
|
trail = tree_cons (NULL_TREE, build_int_2 (flags, 0), trail);
|
|
|
|
|
TREE_CHAIN (init) = trail;
|
|
|
|
|
init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, init);
|
|
|
|
|
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
|
|
|
|
|
return init;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Generate a pseudo_type_info VAR_DECL suitable for the supplied
|
|
|
|
|
TARGET_TYPE and given the REAL_NAME. This is the structure expected by
|
|
|
|
|
the runtime, and therefore has additional fields. If we need not emit a
|
|
|
|
|
definition (because the runtime must contain it), return NULL_TREE,
|
|
|
|
|
otherwise return the VAR_DECL. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
synthesize_tinfo_var (target_type, real_name)
|
|
|
|
|
tree target_type;
|
|
|
|
|
tree real_name;
|
|
|
|
|
{
|
|
|
|
|
tree var_init = NULL_TREE;
|
|
|
|
|
tree var_type = NULL_TREE;
|
|
|
|
|
|
|
|
|
|
my_friendly_assert (new_abi_rtti_p (), 20000118);
|
|
|
|
|
|
|
|
|
|
switch (TREE_CODE (target_type))
|
|
|
|
|
{
|
|
|
|
|
case POINTER_TYPE:
|
|
|
|
|
if (TYPE_PTRMEM_P (target_type))
|
|
|
|
|
{
|
|
|
|
|
var_type = ptmd_desc_type_node;
|
|
|
|
|
var_init = ptmd_initializer (var_type, target_type);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int code = TREE_CODE (TREE_TYPE (target_type));
|
|
|
|
|
|
|
|
|
|
if ((CP_TYPE_QUALS (TREE_TYPE (target_type)) | TYPE_QUAL_CONST)
|
|
|
|
|
== TYPE_QUAL_CONST
|
|
|
|
|
&& (code == INTEGER_TYPE || code == BOOLEAN_TYPE
|
|
|
|
|
|| code == CHAR_TYPE || code == REAL_TYPE
|
|
|
|
|
|| code == VOID_TYPE)
|
|
|
|
|
&& !doing_runtime)
|
|
|
|
|
/* These are in the runtime. */
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
var_type = ptr_desc_type_node;
|
2000-03-15 11:40:27 +01:00
|
|
|
|
var_init = ptr_initializer (var_type, target_type);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ENUMERAL_TYPE:
|
|
|
|
|
var_type = enum_desc_type_node;
|
|
|
|
|
var_init = generic_initializer (var_type, target_type);
|
|
|
|
|
break;
|
|
|
|
|
case FUNCTION_TYPE:
|
|
|
|
|
var_type = func_desc_type_node;
|
|
|
|
|
var_init = generic_initializer (var_type, target_type);
|
|
|
|
|
break;
|
|
|
|
|
case ARRAY_TYPE:
|
|
|
|
|
var_type = ary_desc_type_node;
|
|
|
|
|
var_init = generic_initializer (var_type, target_type);
|
|
|
|
|
break;
|
|
|
|
|
case UNION_TYPE:
|
|
|
|
|
case RECORD_TYPE:
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (target_type))
|
2000-01-28 14:30:13 +01:00
|
|
|
|
{
|
|
|
|
|
/* FIXME: incomplete type. Awaiting specification. */
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
else if (!CLASSTYPE_N_BASECLASSES (target_type))
|
|
|
|
|
{
|
|
|
|
|
var_type = class_desc_type_node;
|
|
|
|
|
var_init = class_initializer (var_type, target_type, NULL_TREE);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* if this has a single public non-virtual base, it's easier */
|
|
|
|
|
tree binfo = TYPE_BINFO (target_type);
|
|
|
|
|
int nbases = BINFO_N_BASETYPES (binfo);
|
|
|
|
|
tree base_binfos = BINFO_BASETYPES (binfo);
|
|
|
|
|
tree base_inits = NULL_TREE;
|
|
|
|
|
int is_simple = nbases == 1;
|
|
|
|
|
int ix;
|
|
|
|
|
|
|
|
|
|
/* Generate the base information initializer. */
|
|
|
|
|
for (ix = nbases; ix--;)
|
|
|
|
|
{
|
|
|
|
|
tree base_binfo = TREE_VEC_ELT (base_binfos, ix);
|
|
|
|
|
tree base_init = NULL_TREE;
|
|
|
|
|
int flags = 0;
|
|
|
|
|
tree tinfo;
|
|
|
|
|
tree offset;
|
|
|
|
|
|
|
|
|
|
if (TREE_VIA_VIRTUAL (base_binfo))
|
|
|
|
|
flags |= 1;
|
|
|
|
|
if (TREE_PUBLIC (base_binfo))
|
|
|
|
|
flags |= 2;
|
|
|
|
|
tinfo = get_tinfo_decl (BINFO_TYPE (base_binfo));
|
|
|
|
|
tinfo = build_unary_op (ADDR_EXPR, tinfo, 0);
|
|
|
|
|
offset = get_base_offset (base_binfo, target_type);
|
|
|
|
|
|
|
|
|
|
/* is it a single public inheritance? */
|
|
|
|
|
if (is_simple && flags == 2 && integer_zerop (offset))
|
|
|
|
|
{
|
|
|
|
|
base_inits = tree_cons (NULL_TREE, tinfo, NULL_TREE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
is_simple = 0;
|
|
|
|
|
|
|
|
|
|
base_init = tree_cons
|
|
|
|
|
(NULL_TREE, build_int_2 (flags, 0), base_init);
|
|
|
|
|
base_init = tree_cons (NULL_TREE, offset, base_init);
|
|
|
|
|
base_init = tree_cons (NULL_TREE, tinfo, base_init);
|
|
|
|
|
base_init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, base_init);
|
|
|
|
|
base_inits = tree_cons (NULL_TREE, base_init, base_inits);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_simple)
|
|
|
|
|
var_type = si_class_desc_type_node;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Prepend the number of bases. */
|
|
|
|
|
base_inits = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, base_inits);
|
|
|
|
|
base_inits = tree_cons (NULL_TREE, base_inits, NULL_TREE);
|
|
|
|
|
base_inits = tree_cons (NULL_TREE,
|
|
|
|
|
build_int_2 (nbases, 0), base_inits);
|
|
|
|
|
|
|
|
|
|
var_type = get_vmi_pseudo_type_info (nbases);
|
|
|
|
|
}
|
|
|
|
|
var_init = class_initializer (var_type, target_type, base_inits);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case INTEGER_TYPE:
|
|
|
|
|
case BOOLEAN_TYPE:
|
|
|
|
|
case CHAR_TYPE:
|
|
|
|
|
case REAL_TYPE:
|
|
|
|
|
case VOID_TYPE:
|
|
|
|
|
if (!doing_runtime)
|
|
|
|
|
/* These are guaranteed to be in the runtime. */
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
var_type = bltn_desc_type_node;
|
|
|
|
|
var_init = generic_initializer (var_type, target_type);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
my_friendly_abort (20000117);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return create_real_tinfo_var (real_name, TINFO_PSEUDO_TYPE (var_type), var_init);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create the real typeinfo variable. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
create_real_tinfo_var (name, type, init)
|
|
|
|
|
tree name;
|
|
|
|
|
tree type;
|
|
|
|
|
tree init;
|
|
|
|
|
{
|
|
|
|
|
tree decl;
|
|
|
|
|
|
|
|
|
|
decl = build_lang_decl (VAR_DECL, name,
|
|
|
|
|
build_qualified_type (type, TYPE_QUAL_CONST));
|
|
|
|
|
DECL_ARTIFICIAL (decl) = 1;
|
|
|
|
|
TREE_READONLY (decl) = 1;
|
|
|
|
|
TREE_STATIC (decl) = 1;
|
|
|
|
|
TREE_PUBLIC (decl) = 1;
|
|
|
|
|
DECL_EXTERNAL (decl) = 0;
|
|
|
|
|
|
|
|
|
|
comdat_linkage (decl);
|
|
|
|
|
DECL_ASSEMBLER_NAME (decl) = name;
|
|
|
|
|
DECL_INITIAL (decl) = init;
|
|
|
|
|
cp_finish_decl (decl, init, NULL_TREE, 0);
|
|
|
|
|
|
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Generate the RECORD_TYPE containing the data layout of a type_info
|
|
|
|
|
derivative as used by the runtime. This layout must be consistent with
|
|
|
|
|
that defined in the runtime support. Also generate the VAR_DECL for the
|
|
|
|
|
type's vtable. We explicitly manage the vtable member, and name it for
|
|
|
|
|
real type as used in the runtime. The RECORD type has a different name,
|
|
|
|
|
to avoid collisions. Return a TREE_LIST who's TINFO_PSEUDO_TYPE
|
|
|
|
|
is the generated type and TINFO_VTABLE_DECL is the vtable decl.
|
|
|
|
|
|
|
|
|
|
REAL_NAME is the runtime's name of the type. Trailing arguments are
|
|
|
|
|
additional FIELD_DECL's for the structure. The final argument must be
|
|
|
|
|
NULL. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
create_pseudo_type_info VPARAMS((const char *real_name, int ident, ...))
|
|
|
|
|
{
|
|
|
|
|
#ifndef ANSI_PROTOTYPES
|
|
|
|
|
char const *real_name;
|
|
|
|
|
int ident;
|
|
|
|
|
#endif
|
|
|
|
|
va_list ap;
|
|
|
|
|
tree real_type, pseudo_type;
|
|
|
|
|
char *pseudo_name;
|
|
|
|
|
tree vtable_decl;
|
|
|
|
|
int ix;
|
|
|
|
|
tree fields[10];
|
|
|
|
|
tree field_decl;
|
|
|
|
|
tree result;
|
|
|
|
|
|
|
|
|
|
VA_START (ap, ident);
|
|
|
|
|
#ifndef ANSI_PROTOTYPES
|
|
|
|
|
real_name = va_arg (ap, char const *);
|
|
|
|
|
ident = va_arg (app, int);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Generate the pseudo type name. */
|
|
|
|
|
pseudo_name = (char *)alloca (strlen (real_name) + 30);
|
|
|
|
|
strcpy (pseudo_name, real_name);
|
|
|
|
|
strcat (pseudo_name, "_pseudo");
|
|
|
|
|
if (ident)
|
|
|
|
|
sprintf (pseudo_name + strlen (pseudo_name), "%d", ident);
|
|
|
|
|
|
|
|
|
|
/* Get the vtable decl. */
|
|
|
|
|
real_type = xref_tag (class_type_node, get_identifier (real_name), 1);
|
|
|
|
|
vtable_decl = get_vtable_decl (real_type, /*complete=*/1);
|
|
|
|
|
|
|
|
|
|
/* First field is the pseudo type_info base class. */
|
|
|
|
|
fields[0] = build_lang_decl (FIELD_DECL, NULL_TREE, ti_desc_type_node);
|
|
|
|
|
|
|
|
|
|
/* Now add the derived fields. */
|
|
|
|
|
for (ix = 0; (field_decl = va_arg (ap, tree));)
|
|
|
|
|
fields[++ix] = field_decl;
|
|
|
|
|
|
|
|
|
|
/* Create the pseudo type. */
|
|
|
|
|
pseudo_type = make_aggr_type (RECORD_TYPE);
|
|
|
|
|
finish_builtin_type (pseudo_type, pseudo_name, fields, ix, ptr_type_node);
|
|
|
|
|
TYPE_HAS_CONSTRUCTOR (pseudo_type) = 1;
|
|
|
|
|
va_end (ap);
|
|
|
|
|
|
|
|
|
|
result = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE);
|
|
|
|
|
TINFO_VTABLE_DECL (result) = vtable_decl;
|
|
|
|
|
TINFO_PSEUDO_TYPE (result) = pseudo_type;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a descriptor for a vmi type with NUM_BASES bases. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
get_vmi_pseudo_type_info (num_bases)
|
|
|
|
|
int num_bases;
|
|
|
|
|
{
|
|
|
|
|
tree desc;
|
|
|
|
|
tree array_domain, base_array;
|
|
|
|
|
|
|
|
|
|
if (TREE_VEC_LENGTH (vmi_class_desc_type_node) <= num_bases)
|
|
|
|
|
{
|
|
|
|
|
int ix;
|
|
|
|
|
tree extend = make_tree_vec (num_bases + 5);
|
|
|
|
|
|
|
|
|
|
for (ix = TREE_VEC_LENGTH (vmi_class_desc_type_node); ix--;)
|
|
|
|
|
TREE_VEC_ELT (extend, ix) = TREE_VEC_ELT (vmi_class_desc_type_node, ix);
|
|
|
|
|
vmi_class_desc_type_node = extend;
|
|
|
|
|
}
|
|
|
|
|
desc = TREE_VEC_ELT (vmi_class_desc_type_node, num_bases);
|
|
|
|
|
|
|
|
|
|
if (desc)
|
|
|
|
|
return desc;
|
|
|
|
|
|
|
|
|
|
/* Add number of bases and trailing array of base_class_type_info. */
|
|
|
|
|
array_domain = build_index_type (build_int_2 (num_bases, 0));
|
|
|
|
|
base_array = build_array_type (base_desc_type_node, array_domain);
|
|
|
|
|
|
2000-03-21 17:12:25 +01:00
|
|
|
|
push_nested_namespace (abi_node);
|
2000-02-27 03:52:55 +01:00
|
|
|
|
|
2000-01-28 14:30:13 +01:00
|
|
|
|
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),
|
|
|
|
|
NULL);
|
2000-02-27 03:52:55 +01:00
|
|
|
|
|
2000-03-21 17:12:25 +01:00
|
|
|
|
pop_nested_namespace (abi_node);
|
2000-02-27 03:52:55 +01:00
|
|
|
|
|
2000-01-28 14:30:13 +01:00
|
|
|
|
TREE_VEC_ELT (vmi_class_desc_type_node, num_bases) = desc;
|
|
|
|
|
return desc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make sure the required builtin types exist for generating the type_info
|
|
|
|
|
varable definitions. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
create_tinfo_types ()
|
|
|
|
|
{
|
|
|
|
|
tree ptr_type_info;
|
|
|
|
|
|
|
|
|
|
if (bltn_desc_type_node)
|
|
|
|
|
return;
|
2000-03-21 17:12:25 +01:00
|
|
|
|
push_nested_namespace (abi_node);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
|
|
|
|
|
ptr_type_info = build_pointer_type
|
|
|
|
|
(build_qualified_type
|
|
|
|
|
(type_info_type_node, TYPE_QUAL_CONST));
|
|
|
|
|
|
|
|
|
|
/* Create the internal type_info structure. This is used as a base for
|
|
|
|
|
the other structures. */
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
finish_builtin_type (ti_desc_type_node, "__type_info_pseudo",
|
|
|
|
|
fields, 1, ptr_type_node);
|
|
|
|
|
TYPE_HAS_CONSTRUCTOR (ti_desc_type_node) = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Fundamental type_info */
|
|
|
|
|
bltn_desc_type_node = create_pseudo_type_info
|
|
|
|
|
("__fundamental_type_info", 0,
|
|
|
|
|
NULL);
|
|
|
|
|
|
2000-03-15 11:40:27 +01:00
|
|
|
|
/* Pointer type_info. Adds two fields, qualification mask
|
|
|
|
|
and pointer to the pointed to type. */
|
2000-01-28 14:30:13 +01:00
|
|
|
|
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),
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
/* Array, function and enum type_info. No additional fields. */
|
|
|
|
|
ary_desc_type_node = create_pseudo_type_info
|
|
|
|
|
("__array_type_info", 0,
|
|
|
|
|
NULL);
|
|
|
|
|
func_desc_type_node = create_pseudo_type_info
|
|
|
|
|
("__function_type_info", 0,
|
|
|
|
|
NULL);
|
|
|
|
|
enum_desc_type_node = create_pseudo_type_info
|
|
|
|
|
("__enum_type_info", 0,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
/* Class type_info. Add a flags field. */
|
|
|
|
|
class_desc_type_node = create_pseudo_type_info
|
|
|
|
|
("__class_type_info", 0,
|
|
|
|
|
build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node),
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
/* Single public non-virtual base class. Add pointer to base class. */
|
|
|
|
|
si_class_desc_type_node = create_pseudo_type_info
|
|
|
|
|
("__si_class_type_info", 0,
|
|
|
|
|
build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node),
|
|
|
|
|
build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
/* Base class internal helper. Pointer to base type, offset to base,
|
|
|
|
|
flags. */
|
|
|
|
|
{
|
|
|
|
|
tree fields[3];
|
|
|
|
|
|
|
|
|
|
fields[0] = build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
|
|
|
|
|
fields[1] = build_lang_decl (FIELD_DECL, NULL_TREE, ptrdiff_type_node),
|
|
|
|
|
fields[2] = build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node),
|
|
|
|
|
base_desc_type_node = make_aggr_type (RECORD_TYPE);
|
|
|
|
|
finish_builtin_type (base_desc_type_node, "__base_class_type_info_pseudo",
|
|
|
|
|
fields, 2, ptr_type_node);
|
|
|
|
|
TYPE_HAS_CONSTRUCTOR (base_desc_type_node) = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* General heirarchy is created as necessary in this vector. */
|
|
|
|
|
vmi_class_desc_type_node = make_tree_vec (10);
|
|
|
|
|
|
|
|
|
|
/* Pointer to member data type_info. Add pointer to the class, pointer
|
|
|
|
|
to the member's type info and qualifications flags. */
|
|
|
|
|
ptmd_desc_type_node = create_pseudo_type_info
|
2000-03-15 18:17:45 +01:00
|
|
|
|
("__pointer_to_member_type_info", 0,
|
2000-01-28 14:30:13 +01:00
|
|
|
|
build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
|
|
|
|
|
build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
|
|
|
|
|
build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node),
|
|
|
|
|
NULL);
|
|
|
|
|
|
2000-03-21 17:12:25 +01:00
|
|
|
|
pop_nested_namespace (abi_node);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Emit the type_info descriptors which are guaranteed to be in the runtime
|
|
|
|
|
support. Generating them here guarantees consistency with the other
|
|
|
|
|
structures. We use the following heuristic to determine when the runtime
|
|
|
|
|
is being generated. If std::__fundamental_type_info is defined, and it's
|
|
|
|
|
destructor is defined, then the runtime is being built. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
emit_support_tinfos ()
|
|
|
|
|
{
|
|
|
|
|
static tree *const fundamentals[] =
|
|
|
|
|
{
|
|
|
|
|
&void_type_node,
|
|
|
|
|
&boolean_type_node,
|
|
|
|
|
&wchar_type_node,
|
|
|
|
|
#if 0
|
|
|
|
|
&signed_wchar_type_node, &unsigned_wchar_type_node,
|
|
|
|
|
#endif
|
|
|
|
|
&char_type_node, &signed_char_type_node, &unsigned_char_type_node,
|
|
|
|
|
&short_integer_type_node, &short_unsigned_type_node,
|
|
|
|
|
&integer_type_node, &unsigned_type_node,
|
|
|
|
|
&long_integer_type_node, &long_unsigned_type_node,
|
|
|
|
|
&long_long_integer_type_node, &long_long_unsigned_type_node,
|
|
|
|
|
&float_type_node, &double_type_node, &long_double_type_node,
|
|
|
|
|
|
|
|
|
|
/* GCC extension types */
|
|
|
|
|
#if 0
|
|
|
|
|
&complex_integer_type_node,
|
|
|
|
|
&complex_float_type_node, &complex_double_type_node,
|
|
|
|
|
&complex_long_double_type_node,
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
};
|
|
|
|
|
int ix;
|
|
|
|
|
tree bltn_type, dtor;
|
|
|
|
|
|
2000-03-21 17:12:25 +01:00
|
|
|
|
push_nested_namespace (abi_node);
|
2000-01-28 14:30:13 +01:00
|
|
|
|
bltn_type = xref_tag (class_type_node,
|
|
|
|
|
get_identifier ("__fundamental_type_info"), 1);
|
2000-03-21 17:12:25 +01:00
|
|
|
|
pop_nested_namespace (abi_node);
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (bltn_type))
|
2000-01-28 14:30:13 +01:00
|
|
|
|
return;
|
|
|
|
|
dtor = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (bltn_type), 1);
|
|
|
|
|
if (DECL_EXTERNAL (dtor))
|
|
|
|
|
return;
|
|
|
|
|
doing_runtime = 1;
|
|
|
|
|
for (ix = 0; fundamentals[ix]; ix++)
|
|
|
|
|
{
|
|
|
|
|
tree bltn = *fundamentals[ix];
|
|
|
|
|
tree bltn_ptr = build_pointer_type (bltn);
|
|
|
|
|
tree bltn_const_ptr = build_pointer_type
|
|
|
|
|
(build_qualified_type (bltn, TYPE_QUAL_CONST));
|
|
|
|
|
tree tinfo;
|
|
|
|
|
|
|
|
|
|
tinfo = get_tinfo_decl (bltn);
|
|
|
|
|
TREE_USED (tinfo) = 1;
|
|
|
|
|
TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
|
|
|
|
|
|
|
|
|
|
tinfo = get_tinfo_decl (bltn_ptr);
|
|
|
|
|
TREE_USED (tinfo) = 1;
|
|
|
|
|
TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
|
|
|
|
|
|
|
|
|
|
tinfo = get_tinfo_decl (bltn_const_ptr);
|
|
|
|
|
TREE_USED (tinfo) = 1;
|
|
|
|
|
TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return non-zero, iff T is a type_info variable which has not had a
|
|
|
|
|
definition emitted for it. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
tinfo_decl_p (t, data)
|
|
|
|
|
tree t;
|
|
|
|
|
void *data ATTRIBUTE_UNUSED;
|
|
|
|
|
{
|
|
|
|
|
return TREE_CODE (t) == VAR_DECL
|
|
|
|
|
&& IDENTIFIER_GLOBAL_VALUE (DECL_NAME (t)) == (t)
|
|
|
|
|
&& TREE_TYPE (t) == tinfo_decl_type
|
|
|
|
|
&& TREE_TYPE (DECL_NAME (t));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Emit a suitable type_info definition for the type_info decl pointed to by
|
|
|
|
|
DECL_PTR. We emit a completely new variable, of the correct type for the
|
|
|
|
|
actual type this is describing. The DECL_ASSEMBLER_NAME of the generated
|
|
|
|
|
definition is set to that of the supplied decl, so that they can be tied
|
|
|
|
|
up. Mark the supplied decl as having been dealt with. Emitting one
|
|
|
|
|
definitions might cause other declarations to be emitted.
|
|
|
|
|
|
|
|
|
|
We need to do things this way, because we're trying to do something like
|
|
|
|
|
|
|
|
|
|
struct B : A {
|
|
|
|
|
...
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern const A tinfo_var;
|
|
|
|
|
|
|
|
|
|
const B tinfo_var = {...};
|
|
|
|
|
|
|
|
|
|
which is not permitted. Also, we've not necessarily seen the definition of B.
|
|
|
|
|
So we do something like the following,
|
|
|
|
|
|
|
|
|
|
extern const A tinfo_var;
|
|
|
|
|
|
|
|
|
|
struct pseudo_A {
|
|
|
|
|
const void *vtable_ptr;
|
|
|
|
|
const char *name;
|
|
|
|
|
};
|
|
|
|
|
struct pseudo_B {
|
|
|
|
|
pseudo_A base;
|
|
|
|
|
...
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const pseudo_B proxy_tinfo_var attribute((assembler_name="tinfo_var")) =
|
|
|
|
|
{
|
|
|
|
|
{&B::vtable, "..."},
|
|
|
|
|
...
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
pseudo_A and pseudo_B must be layout equivalent to the real definitions in
|
|
|
|
|
the runtime. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
emit_tinfo_decl (decl_ptr, data)
|
|
|
|
|
tree *decl_ptr;
|
|
|
|
|
void *data ATTRIBUTE_UNUSED;
|
|
|
|
|
{
|
|
|
|
|
tree tinfo_decl = *decl_ptr;
|
|
|
|
|
tree tinfo_type, decl;
|
|
|
|
|
|
|
|
|
|
my_friendly_assert (TREE_TYPE (tinfo_decl) == tinfo_decl_type, 20000121);
|
|
|
|
|
tinfo_type = TREE_TYPE (DECL_NAME (tinfo_decl));
|
|
|
|
|
my_friendly_assert (tinfo_type != NULL_TREE, 20000120);
|
|
|
|
|
|
|
|
|
|
/* Say we've dealt with it. */
|
|
|
|
|
TREE_TYPE (DECL_NAME (tinfo_decl)) = NULL_TREE;
|
|
|
|
|
|
|
|
|
|
if (!DECL_NEEDED_P (tinfo_decl))
|
|
|
|
|
return 0;
|
2000-03-24 17:36:06 +01:00
|
|
|
|
if (TREE_CODE (tinfo_type) == RECORD_TYPE && TYPE_POLYMORPHIC_P (tinfo_type)
|
|
|
|
|
&& !CLASSTYPE_VTABLE_NEEDS_WRITING (tinfo_type))
|
|
|
|
|
/* A polymorphic type only needs its type_info emitted when the vtable
|
|
|
|
|
is. */
|
|
|
|
|
return 0;
|
2000-01-28 14:30:13 +01:00
|
|
|
|
create_tinfo_types ();
|
|
|
|
|
decl = synthesize_tinfo_var (tinfo_type, DECL_ASSEMBLER_NAME (tinfo_decl));
|
|
|
|
|
|
|
|
|
|
return decl != 0;
|
|
|
|
|
}
|