mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-06 02:20:34 +08: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
This commit is contained in:
parent
e1a86dbb90
commit
db1147b2e2
@ -1,3 +1,49 @@
|
||||
2000-01-24 Nathan Sidwell <sidwell@codesourcery.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2000-01-23 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* cp-tree.h (__eprintf): Remove declaration.
|
||||
|
@ -496,16 +496,18 @@ enum cp_tree_index
|
||||
CPTI_DELTA_TYPE,
|
||||
CPTI_CLEANUP_TYPE,
|
||||
|
||||
CPTI_TP_DESC_TYPE,
|
||||
CPTI_ACCESS_MODE_TYPE,
|
||||
CPTI_TI_DESC_TYPE,
|
||||
CPTI_BLTN_DESC_TYPE,
|
||||
CPTI_USER_DESC_TYPE,
|
||||
CPTI_CLASS_DESC_TYPE,
|
||||
CPTI_PTR_DESC_TYPE,
|
||||
CPTI_ATTR_DESC_TYPE,
|
||||
CPTI_REF_DESC_TYPE,
|
||||
CPTI_ARY_DESC_TYPE,
|
||||
CPTI_FUNC_DESC_TYPE,
|
||||
CPTI_PTMF_DESC_TYPE,
|
||||
CPTI_ENUM_DESC_TYPE,
|
||||
CPTI_CLASS_DESC_TYPE,
|
||||
CPTI_SI_CLASS_DESC_TYPE,
|
||||
CPTI_VMI_CLASS_DESC_TYPE,
|
||||
CPTI_PTMD_DESC_TYPE,
|
||||
CPTI_BASE_DESC_TYPE,
|
||||
|
||||
CPTI_CLASS_STAR_TYPE,
|
||||
CPTI_CLASS_TYPE,
|
||||
@ -517,8 +519,9 @@ enum cp_tree_index
|
||||
CPTI_VTBL_PTR_TYPE,
|
||||
CPTI_STD,
|
||||
CPTI_TYPE_INFO_TYPE,
|
||||
CPTI_TINFO_FN_ID,
|
||||
CPTI_TINFO_FN_TYPE,
|
||||
CPTI_TINFO_DECL_ID,
|
||||
CPTI_TINFO_DECL_TYPE,
|
||||
CPTI_TINFO_VAR_ID,
|
||||
CPTI_ABORT_FNDECL,
|
||||
CPTI_GLOBAL_DELETE_FNDECL,
|
||||
|
||||
@ -573,16 +576,20 @@ extern tree cp_global_trees[CPTI_MAX];
|
||||
#define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL]
|
||||
#define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
|
||||
#define delta_type_node cp_global_trees[CPTI_DELTA_TYPE]
|
||||
#define __tp_desc_type_node cp_global_trees[CPTI_TP_DESC_TYPE]
|
||||
#define __access_mode_type_node cp_global_trees[CPTI_ACCESS_MODE_TYPE]
|
||||
#define __bltn_desc_type_node cp_global_trees[CPTI_BLTN_DESC_TYPE]
|
||||
#define __user_desc_type_node cp_global_trees[CPTI_USER_DESC_TYPE]
|
||||
#define __class_desc_type_node cp_global_trees[CPTI_CLASS_DESC_TYPE]
|
||||
#define __ptr_desc_type_node cp_global_trees[CPTI_PTR_DESC_TYPE]
|
||||
#define __attr_desc_type_node cp_global_trees[CPTI_ATTR_DESC_TYPE]
|
||||
#define __func_desc_type_node cp_global_trees[CPTI_FUNC_DESC_TYPE]
|
||||
#define __ptmf_desc_type_node cp_global_trees[CPTI_PTMF_DESC_TYPE]
|
||||
#define __ptmd_desc_type_node cp_global_trees[CPTI_PTMD_DESC_TYPE]
|
||||
|
||||
#define ti_desc_type_node cp_global_trees[CPTI_TI_DESC_TYPE]
|
||||
#define bltn_desc_type_node cp_global_trees[CPTI_BLTN_DESC_TYPE]
|
||||
#define ptr_desc_type_node cp_global_trees[CPTI_PTR_DESC_TYPE]
|
||||
#define ref_desc_type_node cp_global_trees[CPTI_REF_DESC_TYPE]
|
||||
#define ary_desc_type_node cp_global_trees[CPTI_ARY_DESC_TYPE]
|
||||
#define func_desc_type_node cp_global_trees[CPTI_FUNC_DESC_TYPE]
|
||||
#define enum_desc_type_node cp_global_trees[CPTI_ENUM_DESC_TYPE]
|
||||
#define class_desc_type_node cp_global_trees[CPTI_CLASS_DESC_TYPE]
|
||||
#define si_class_desc_type_node cp_global_trees[CPTI_SI_CLASS_DESC_TYPE]
|
||||
#define vmi_class_desc_type_node cp_global_trees[CPTI_VMI_CLASS_DESC_TYPE]
|
||||
#define ptmd_desc_type_node cp_global_trees[CPTI_PTMD_DESC_TYPE]
|
||||
#define base_desc_type_node cp_global_trees[CPTI_BASE_DESC_TYPE]
|
||||
|
||||
#define class_star_type_node cp_global_trees[CPTI_CLASS_STAR_TYPE]
|
||||
#define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
|
||||
#define record_type_node cp_global_trees[CPTI_RECORD_TYPE]
|
||||
@ -593,8 +600,9 @@ extern tree cp_global_trees[CPTI_MAX];
|
||||
#define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
|
||||
#define std_node cp_global_trees[CPTI_STD]
|
||||
#define type_info_type_node cp_global_trees[CPTI_TYPE_INFO_TYPE]
|
||||
#define tinfo_fn_id cp_global_trees[CPTI_TINFO_FN_ID]
|
||||
#define tinfo_fn_type cp_global_trees[CPTI_TINFO_FN_TYPE]
|
||||
#define tinfo_decl_id cp_global_trees[CPTI_TINFO_DECL_ID]
|
||||
#define tinfo_decl_type cp_global_trees[CPTI_TINFO_DECL_TYPE]
|
||||
#define tinfo_var_id cp_global_trees[CPTI_TINFO_VAR_ID]
|
||||
#define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL]
|
||||
#define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
|
||||
|
||||
@ -1830,7 +1838,8 @@ struct lang_decl
|
||||
for an object with virtual baseclasses. */
|
||||
#define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
|
||||
|
||||
/* Non-zero for a FUNCTION_DECL that declares a type-info function. */
|
||||
/* Non-zero for a FUNCTION_DECL that declares a type-info function.
|
||||
This only happens in the old abi. */
|
||||
#define DECL_TINFO_FN_P(NODE) \
|
||||
(TREE_CODE (NODE) == FUNCTION_DECL \
|
||||
&& DECL_ARTIFICIAL (NODE) \
|
||||
|
@ -208,10 +208,12 @@ tree error_mark_list;
|
||||
#if 0
|
||||
tree __tp_desc_type_node;
|
||||
#endif
|
||||
tree __access_mode_type_node;
|
||||
tree __bltn_desc_type_node, __user_desc_type_node, __class_desc_type_node;
|
||||
tree __ptr_desc_type_node, __attr_desc_type_node, __func_desc_type_node;
|
||||
tree __ptmf_desc_type_node, __ptmd_desc_type_node;
|
||||
tree ti_desc_type_node;
|
||||
tree bltn_desc_type_node, ptr_desc_type_node, ref_desc_type_node;
|
||||
tree ary_desc_type_node, func_desc_type_node, enum_desc_type_node;
|
||||
tree class_desc_type_node, si_class_desc_type_node, vmi_class_desc_type_node;
|
||||
tree ptmd_desc_type_node;
|
||||
tree base_desc_type_node;
|
||||
#if 0
|
||||
Not needed yet? May be needed one day?
|
||||
tree __bltn_desc_array_type, __user_desc_array_type, __class_desc_array_type;
|
||||
@ -243,7 +245,8 @@ tree error_mark_list;
|
||||
tree global_delete_fndecl;
|
||||
|
||||
Used by RTTI
|
||||
tree type_info_type_node, tinfo_fn_id, tinfo_fn_type;
|
||||
tree type_info_type_node, tinfo_decl_id, tinfo_decl_type;
|
||||
tree tinfo_var_id;
|
||||
|
||||
*/
|
||||
|
||||
|
134
gcc/cp/rtti.c
134
gcc/cp/rtti.c
@ -40,6 +40,8 @@ static tree build_headof_sub PROTO((tree));
|
||||
static tree build_headof PROTO((tree));
|
||||
static tree get_tinfo_var PROTO((tree));
|
||||
static tree ifnonnull PROTO((tree, tree));
|
||||
static tree tinfo_name PROTO((tree));
|
||||
static tree get_base_offset PROTO((tree, tree));
|
||||
static tree build_dynamic_cast_1 PROTO((tree, tree));
|
||||
static void expand_si_desc PROTO((tree, tree));
|
||||
static void expand_class_desc PROTO((tree, tree));
|
||||
@ -60,11 +62,14 @@ init_rtti_processing ()
|
||||
(class_type_node, get_identifier ("type_info"), 1);
|
||||
if (flag_honor_std)
|
||||
pop_namespace ();
|
||||
tinfo_fn_id = get_identifier ("__tf");
|
||||
tinfo_fn_type = build_function_type
|
||||
(build_reference_type (build_qualified_type (type_info_type_node,
|
||||
TYPE_QUAL_CONST)),
|
||||
void_list_node);
|
||||
|
||||
tinfo_decl_id = get_identifier ("__tf");
|
||||
tinfo_decl_type = build_function_type
|
||||
(build_reference_type
|
||||
(build_qualified_type
|
||||
(type_info_type_node, TYPE_QUAL_CONST)),
|
||||
void_list_node);
|
||||
tinfo_var_id = get_identifier ("__ti");
|
||||
}
|
||||
|
||||
/* Given a pointer to an object with at least one virtual table
|
||||
@ -224,7 +229,7 @@ get_tinfo_decl_dynamic (exp)
|
||||
t = build_vfn_ref ((tree *) 0, exp, integer_one_node);
|
||||
else
|
||||
t = build_vfn_ref ((tree *) 0, exp, integer_zero_node);
|
||||
TREE_TYPE (t) = build_pointer_type (tinfo_fn_type);
|
||||
TREE_TYPE (t) = build_pointer_type (tinfo_decl_type);
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -238,7 +243,6 @@ build_typeid (exp)
|
||||
tree exp;
|
||||
{
|
||||
tree cond = NULL_TREE;
|
||||
tree type;
|
||||
int nonnull = 0;
|
||||
|
||||
if (! flag_rtti)
|
||||
@ -287,7 +291,7 @@ static tree
|
||||
get_tinfo_var (type)
|
||||
tree type;
|
||||
{
|
||||
tree tname = build_overload_with_type (get_identifier ("__ti"), type);
|
||||
tree tname = build_overload_with_type (tinfo_var_id, type);
|
||||
tree arrtype;
|
||||
int size;
|
||||
|
||||
@ -325,11 +329,21 @@ get_tinfo_var (type)
|
||||
return declare_global_var (tname, arrtype);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* Returns a decl for a function or variable which can be used to obtain a
|
||||
type_info object for TYPE. The old-abi uses functions, the new-abi will
|
||||
use the type_info object directly. You can take the address of the
|
||||
returned decl, to save the decl. To use the generator call
|
||||
tinfo_from_generator. You must arrange that the decl is mark_used, if
|
||||
returned decl, to save the decl. To use the decl call
|
||||
tinfo_from_decl. You must arrange that the decl is mark_used, if
|
||||
actually use it --- decls in vtables are only used if the vtable is
|
||||
output. */
|
||||
|
||||
@ -346,12 +360,12 @@ get_tinfo_decl (type)
|
||||
type = build_function_type (TREE_TYPE (type),
|
||||
TREE_CHAIN (TYPE_ARG_TYPES (type)));
|
||||
|
||||
name = build_overload_with_type (tinfo_fn_id, type);
|
||||
name = build_overload_with_type (tinfo_decl_id, type);
|
||||
|
||||
if (IDENTIFIER_GLOBAL_VALUE (name))
|
||||
return IDENTIFIER_GLOBAL_VALUE (name);
|
||||
|
||||
d = build_lang_decl (FUNCTION_DECL, name, tinfo_fn_type);
|
||||
d = build_lang_decl (FUNCTION_DECL, name, tinfo_decl_type);
|
||||
DECL_EXTERNAL (d) = 1;
|
||||
TREE_PUBLIC (d) = 1;
|
||||
DECL_ARTIFICIAL (d) = 1;
|
||||
@ -373,7 +387,7 @@ static tree
|
||||
tinfo_from_decl (expr)
|
||||
tree expr;
|
||||
{
|
||||
tree t = build_call (expr, TREE_TYPE (tinfo_fn_type), NULL_TREE);
|
||||
tree t = build_call (expr, TREE_TYPE (tinfo_decl_type), NULL_TREE);
|
||||
|
||||
return t;
|
||||
}
|
||||
@ -439,6 +453,42 @@ ifnonnull (test, result)
|
||||
result);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
{
|
||||
tree offset;
|
||||
|
||||
if (!TREE_VIA_VIRTUAL (binfo))
|
||||
offset = BINFO_OFFSET (binfo);
|
||||
else if (!vbase_offsets_in_vtable_p ())
|
||||
{
|
||||
tree t = BINFO_TYPE (binfo);
|
||||
const char *name;
|
||||
tree field;
|
||||
|
||||
FORMAT_VBASE_NAME (name, t);
|
||||
field = lookup_field (parent, get_identifier (name), 0, 0);
|
||||
offset = size_binop (FLOOR_DIV_EXPR,
|
||||
DECL_FIELD_BITPOS (field),
|
||||
size_int (BITS_PER_UNIT));
|
||||
offset = convert (sizetype, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Under the new ABI, we store the vtable offset at which
|
||||
the virtual base offset can be found. */
|
||||
tree vbase = BINFO_FOR_VBASE (BINFO_TYPE (binfo), parent);
|
||||
offset = convert (sizetype, BINFO_VPTR_FIELD (vbase));
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
/* Execute a dynamic cast, as described in section 5.2.6 of the 9/93 working
|
||||
paper. */
|
||||
|
||||
@ -710,8 +760,7 @@ expand_si_desc (tdecl, type)
|
||||
tree type;
|
||||
{
|
||||
tree t, elems, fn;
|
||||
const char *name = build_overload_name (type, 1, 1);
|
||||
tree name_string = combine_strings (build_string (strlen (name)+1, name));
|
||||
tree name_string = tinfo_name (type);
|
||||
|
||||
type = BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0));
|
||||
finish_expr_stmt (get_typeid_1 (type));
|
||||
@ -756,7 +805,6 @@ expand_class_desc (tdecl, type)
|
||||
{
|
||||
tree name_string;
|
||||
tree fn, tmp;
|
||||
const char *name;
|
||||
|
||||
int i = CLASSTYPE_N_BASECLASSES (type);
|
||||
int base_cnt = 0;
|
||||
@ -768,15 +816,14 @@ expand_class_desc (tdecl, type)
|
||||
#endif
|
||||
tree base, elems, access, offset, isvir;
|
||||
tree elt, elts = NULL_TREE;
|
||||
static tree base_info_type_node;
|
||||
|
||||
if (base_info_type_node == NULL_TREE)
|
||||
if (base_desc_type_node == NULL_TREE)
|
||||
{
|
||||
tree fields [4];
|
||||
|
||||
/* A reasonably close approximation of __class_type_info::base_info */
|
||||
|
||||
base_info_type_node = make_aggr_type (RECORD_TYPE);
|
||||
base_desc_type_node = make_aggr_type (RECORD_TYPE);
|
||||
|
||||
/* Actually const __user_type_info * */
|
||||
fields [0] = build_lang_decl
|
||||
@ -801,7 +848,7 @@ expand_class_desc (tdecl, type)
|
||||
DECL_BIT_FIELD (fields[3]) = 1;
|
||||
DECL_FIELD_SIZE (fields[3]) = 2;
|
||||
|
||||
finish_builtin_type (base_info_type_node, "__base_info", fields,
|
||||
finish_builtin_type (base_desc_type_node, "__base_info", fields,
|
||||
3, ptr_type_node);
|
||||
}
|
||||
|
||||
@ -811,33 +858,8 @@ expand_class_desc (tdecl, type)
|
||||
|
||||
finish_expr_stmt (get_typeid_1 (BINFO_TYPE (binfo)));
|
||||
base = decay_conversion (get_tinfo_var (BINFO_TYPE (binfo)));
|
||||
|
||||
if (TREE_VIA_VIRTUAL (binfo))
|
||||
{
|
||||
if (!vbase_offsets_in_vtable_p ())
|
||||
{
|
||||
tree t = BINFO_TYPE (binfo);
|
||||
const char *name;
|
||||
tree field;
|
||||
|
||||
FORMAT_VBASE_NAME (name, t);
|
||||
field = lookup_field (type, get_identifier (name), 0, 0);
|
||||
offset = size_binop (FLOOR_DIV_EXPR,
|
||||
DECL_FIELD_BITPOS (field),
|
||||
size_int (BITS_PER_UNIT));
|
||||
offset = convert (sizetype, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Under the new ABI, we store the vtable offset at which
|
||||
the virtual base offset can be found. */
|
||||
tree vbase = BINFO_FOR_VBASE (BINFO_TYPE (binfo), type);
|
||||
offset = convert (sizetype, BINFO_VPTR_FIELD (vbase));
|
||||
}
|
||||
}
|
||||
else
|
||||
offset = BINFO_OFFSET (binfo);
|
||||
|
||||
offset = get_base_offset (binfo, type);
|
||||
|
||||
if (TREE_VIA_PUBLIC (binfo))
|
||||
access = access_public_node;
|
||||
else if (TREE_VIA_PROTECTED (binfo))
|
||||
@ -850,7 +872,7 @@ expand_class_desc (tdecl, type)
|
||||
isvir = boolean_false_node;
|
||||
|
||||
elt = build
|
||||
(CONSTRUCTOR, base_info_type_node, NULL_TREE, tree_cons
|
||||
(CONSTRUCTOR, base_desc_type_node, NULL_TREE, tree_cons
|
||||
(NULL_TREE, base, tree_cons
|
||||
(NULL_TREE, offset, tree_cons
|
||||
(NULL_TREE, isvir, tree_cons
|
||||
@ -893,11 +915,10 @@ expand_class_desc (tdecl, type)
|
||||
}
|
||||
#endif
|
||||
|
||||
name = build_overload_name (type, 1, 1);
|
||||
name_string = combine_strings (build_string (strlen (name)+1, name));
|
||||
name_string = tinfo_name (type);
|
||||
|
||||
{
|
||||
tree arrtype = build_array_type (base_info_type_node, NULL_TREE);
|
||||
tree arrtype = build_array_type (base_desc_type_node, NULL_TREE);
|
||||
elts = build (CONSTRUCTOR, arrtype, NULL_TREE, elts);
|
||||
TREE_HAS_CONSTRUCTOR (elts) = TREE_CONSTANT (elts)
|
||||
= TREE_STATIC (elts) = 1;
|
||||
@ -919,7 +940,7 @@ expand_class_desc (tdecl, type)
|
||||
tmp = tree_cons
|
||||
(NULL_TREE, ptr_type_node, tree_cons
|
||||
(NULL_TREE, const_string_type_node, tree_cons
|
||||
(NULL_TREE, build_pointer_type (base_info_type_node), tree_cons
|
||||
(NULL_TREE, build_pointer_type (base_desc_type_node), tree_cons
|
||||
(NULL_TREE, sizetype, void_list_node))));
|
||||
tmp = build_function_type (void_type_node, tmp);
|
||||
|
||||
@ -944,8 +965,7 @@ expand_ptr_desc (tdecl, type)
|
||||
tree type;
|
||||
{
|
||||
tree t, elems, fn;
|
||||
const char *name = build_overload_name (type, 1, 1);
|
||||
tree name_string = combine_strings (build_string (strlen (name)+1, name));
|
||||
tree name_string = tinfo_name (type);
|
||||
|
||||
type = TREE_TYPE (type);
|
||||
finish_expr_stmt (get_typeid_1 (type));
|
||||
@ -989,8 +1009,7 @@ expand_attr_desc (tdecl, type)
|
||||
tree type;
|
||||
{
|
||||
tree elems, t, fn;
|
||||
const char *name = build_overload_name (type, 1, 1);
|
||||
tree name_string = combine_strings (build_string (strlen (name)+1, name));
|
||||
tree name_string = tinfo_name (type);
|
||||
tree attrval = build_int_2 (TYPE_QUALS (type), 0);
|
||||
|
||||
finish_expr_stmt (get_typeid_1 (TYPE_MAIN_VARIANT (type)));
|
||||
@ -1035,8 +1054,7 @@ expand_generic_desc (tdecl, type, fnname)
|
||||
tree type;
|
||||
const char *fnname;
|
||||
{
|
||||
const char *name = build_overload_name (type, 1, 1);
|
||||
tree name_string = combine_strings (build_string (strlen (name)+1, name));
|
||||
tree name_string = tinfo_name (type);
|
||||
tree elems = tree_cons
|
||||
(NULL_TREE, decay_conversion (tdecl), tree_cons
|
||||
(NULL_TREE, decay_conversion (name_string), NULL_TREE));
|
||||
|
@ -44,7 +44,7 @@ convert_to_base (void *addr, bool is_virtual, USItype offset)
|
||||
if (!is_virtual)
|
||||
return (char *) addr + offset;
|
||||
|
||||
#ifdef __GXX_ABI_VERSION
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
|
||||
// Under the new ABI, the offset gives us an index into the vtable,
|
||||
// which contains an offset to the virtual base. The vptr is always
|
||||
// the first thing in the object.
|
||||
|
@ -167,7 +167,7 @@ public:
|
||||
|
||||
// type_info for a general class.
|
||||
|
||||
#ifdef __GXX_ABI_VERSION
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
|
||||
typedef int USItype __attribute__ ((mode (SI)));
|
||||
#else
|
||||
typedef unsigned int USItype __attribute__ ((mode (SI)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user