From 459c43ad0041d6b63c0125b0833cf9813579f6c5 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 12 Jun 2000 06:43:27 +0000 Subject: [PATCH] mangle.c (NESTED_TEMPLATE_MATCH): Fix typo in comment. * mangle.c (NESTED_TEMPLATE_MATCH): Fix typo in comment. (is_std_substitution): Don't check CLASSTYPE_USE_TEMPLATE here. (find_substitution): Only use the `Sa' substitution for std::allocator, not instantiations of it. (write_template_prefix): Move comment. Only use a TREE_LIST to represent substitutions for a member template. (write_array_type): Mangle array dimensions correctly. * optimize.c (maybe_clone_body): Copy more information from the cloned function. * pt.c (regenerate_decl_from_template): Preserve DECL_USE_TEMPLATE on the regenerated declaration. From-SVN: r34497 --- gcc/cp/ChangeLog | 21 +++++++++++++++ gcc/cp/class.c | 9 +++---- gcc/cp/mangle.c | 81 +++++++++++++++++++++++++++++-------------------------- gcc/cp/optimize.c | 4 +++ gcc/cp/pt.c | 1 + 5 files changed, 73 insertions(+), 43 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f20402f..f1ea463 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,24 @@ +2000-06-11 Mark Mitchell + + * mangle.c (NESTED_TEMPLATE_MATCH): Fix typo in comment. + (is_std_substitution): Don't check CLASSTYPE_USE_TEMPLATE here. + (find_substitution): Only use the `Sa' substitution for + std::allocator, not instantiations of it. + (write_template_prefix): Move comment. Only use a TREE_LIST to + represent substitutions for a member template. + (write_array_type): Mangle array dimensions correctly. + * optimize.c (maybe_clone_body): Copy more information from the + cloned function. + * pt.c (regenerate_decl_from_template): Preserve DECL_USE_TEMPLATE + on the regenerated declaration. + +2000-06-11 Chip Salzenberg + Mark Mitchell + + * class.c (build_vtable): Clarify comment. + (build_ctor_vtbl_group): Pass the most derived type to + build_vtable. + 2000-06-11 Kaveh R. Ghazi * decl2.c (compare_options): Don't needlessly cast away const-ness. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 77a5b7e..c34deb0 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -673,7 +673,6 @@ get_vfield_offset (binfo) on method calling is expected to point to a DECL_CONTEXT (fndecl) object, and not a baseclass of it. */ - static tree get_derived_offset (binfo, type) tree binfo, type; @@ -695,9 +694,9 @@ get_derived_offset (binfo, type) return size_binop (MINUS_EXPR, offset1, offset2); } -/* Create a VAR_DECL for a primary or secondary vtable for - CLASS_TYPE. Use NAME for the name of the vtable, and VTABLE_TYPE - for its type. */ +/* Create a VAR_DECL for a primary or secondary vtable for CLASS_TYPE. + (For a secondary vtable for B-in-D, CLASS_TYPE should be D, not B.) + Use NAME for the name of the vtable, and VTABLE_TYPE for its type. */ static tree build_vtable (class_type, name, vtable_type) @@ -6781,7 +6780,7 @@ build_ctor_vtbl_group (binfo, t) /* Build a version of VTBL (with the wrong type) for use in constructing the addresses of secondary vtables in the construction vtable group. */ - vtbl = build_vtable (BINFO_TYPE (binfo), id, ptr_type_node); + vtbl = build_vtable (t, id, ptr_type_node); list = build_tree_list (vtbl, NULL_TREE); accumulate_vtbl_inits (binfo, TYPE_BINFO (TREE_TYPE (binfo)), binfo, t, list); diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index f4aa12d..57c49de 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -208,8 +208,8 @@ static tree mangle_special_for_type PARAMS ((tree, const char *)); #define mangled_position() \ obstack_object_size (&G.name_obstack) -/* Non-zero if NODE1__ and NODE2__ are both TREE_LIST nodes and have - the same purpose (context, which may be a type) and value (template +/* Non-zero if NODE1 and NODE2 are both TREE_LIST nodes and have the + same purpose (context, which may be a type) and value (template decl). See write_template_prefix for more information on what this is used for. */ #define NESTED_TEMPLATE_MATCH(NODE1, NODE2) \ @@ -348,12 +348,11 @@ is_std_substitution (node, index) /* These are not the droids you're looking for. */ return 0; - return - DECL_NAMESPACE_STD_P (CP_DECL_CONTEXT (decl)) - && TYPE_LANG_SPECIFIC (type) - && CLASSTYPE_USE_TEMPLATE (type) - && (DECL_NAME (CLASSTYPE_TI_TEMPLATE (type)) - == subst_identifiers[index]); + return (DECL_NAMESPACE_STD_P (CP_DECL_CONTEXT (decl)) + && TYPE_LANG_SPECIFIC (type) + && CLASSTYPE_TEMPLATE_INFO (type) + && (DECL_NAME (CLASSTYPE_TI_TEMPLATE (type)) + == subst_identifiers[index])); } /* Helper function for find_substitution. Returns non-zero if NODE, @@ -441,7 +440,9 @@ find_substitution (node) type = TYPE_P (node) ? node : TREE_TYPE (node); /* Check for std::allocator. */ - if (decl && is_std_substitution (decl, SUBID_ALLOCATOR)) + if (decl + && is_std_substitution (decl, SUBID_ALLOCATOR) + && !CLASSTYPE_USE_TEMPLATE (TREE_TYPE (decl))) { write_string ("Sa"); return 1; @@ -782,32 +783,7 @@ write_prefix (node) } /* ::=