Commit c1eb7f5c by Nathan Sidwell

mangle.c (conv_type_names): Holds IDENTIFIER_NODEs only.

	* mangle.c (conv_type_names): Holds IDENTIFIER_NODEs only.
	(hash_type): Use TYPE_UID of the identifier's type.
	(compare_type): Adjust.
	(mangle_conv_op_name_for_type): Store identifier nodes only, use
	TYPE_UID has hash value.

From-SVN: r74538
parent c1fb3625
2003-12-11 Nathan Sidwell <nathan@codesourcery.com>
* mangle.c (conv_type_names): Holds IDENTIFIER_NODEs only.
(hash_type): Use TYPE_UID of the identifier's type.
(compare_type): Adjust.
(mangle_conv_op_name_for_type): Store identifier nodes only, use
TYPE_UID has hash value.
2003-12-10 Mark Mitchell <mark@codesourcery.com> 2003-12-10 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (DECL_CONV_FN_P): Check that DECL_NAME is non-NULL. * cp-tree.h (DECL_CONV_FN_P): Check that DECL_NAME is non-NULL.
...@@ -7,11 +15,11 @@ ...@@ -7,11 +15,11 @@
PR c/13134 PR c/13134
* decl.c (duplicate_decls): Copy visibility flag when appropriate. * decl.c (duplicate_decls): Copy visibility flag when appropriate.
2003-12-09 Giovanni Bajo <giovannibajo@gcc.gnu.org> 2003-12-09 Giovanni Bajo <giovannibajo@gcc.gnu.org>
* init.c (build_new_1): Deal with an OVERLOAD set when * init.c (build_new_1): Deal with an OVERLOAD set when
looking up for _Jv_AllocObject. looking up for _Jv_AllocObject.
* except.c (build_throw): Likewise for _Jv_Throw. * except.c (build_throw): Likewise for _Jv_Throw.
2003-12-08 Jason Merrill <jason@redhat.com> 2003-12-08 Jason Merrill <jason@redhat.com>
......
...@@ -2602,8 +2602,8 @@ mangle_thunk (tree fn_decl, const int this_adjusting, tree fixed_offset, ...@@ -2602,8 +2602,8 @@ mangle_thunk (tree fn_decl, const int this_adjusting, tree fixed_offset,
} }
/* This hash table maps TYPEs to the IDENTIFIER for a conversion /* This hash table maps TYPEs to the IDENTIFIER for a conversion
operator to TYPE. The nodes are TREE_LISTs whose TREE_PURPOSE is operator to TYPE. The nodes are IDENTIFIERs whose TREE_TYPE is the
the TYPE and whose TREE_VALUE is the IDENTIFIER. */ TYPE. */
static GTY ((param_is (union tree_node))) htab_t conv_type_names; static GTY ((param_is (union tree_node))) htab_t conv_type_names;
...@@ -2612,7 +2612,7 @@ static GTY ((param_is (union tree_node))) htab_t conv_type_names; ...@@ -2612,7 +2612,7 @@ static GTY ((param_is (union tree_node))) htab_t conv_type_names;
static hashval_t static hashval_t
hash_type (const void *val) hash_type (const void *val)
{ {
return htab_hash_pointer (TREE_PURPOSE ((tree) val)); return (hashval_t) TYPE_UID (TREE_TYPE ((tree) val));
} }
/* Compare VAL1 (a node in the table) with VAL2 (a TYPE). */ /* Compare VAL1 (a node in the table) with VAL2 (a TYPE). */
...@@ -2620,7 +2620,7 @@ hash_type (const void *val) ...@@ -2620,7 +2620,7 @@ hash_type (const void *val)
static int static int
compare_type (const void *val1, const void *val2) compare_type (const void *val1, const void *val2)
{ {
return TREE_PURPOSE ((tree) val1) == (tree) val2; return TREE_TYPE ((tree) val1) == (tree) val2;
} }
/* Return an identifier for the mangled unqualified name for a /* Return an identifier for the mangled unqualified name for a
...@@ -2632,29 +2632,32 @@ mangle_conv_op_name_for_type (const tree type) ...@@ -2632,29 +2632,32 @@ mangle_conv_op_name_for_type (const tree type)
{ {
void **slot; void **slot;
tree identifier; tree identifier;
char buffer[64];
if (conv_type_names == NULL) if (conv_type_names == NULL)
conv_type_names = htab_create_ggc (31, &hash_type, &compare_type, NULL); conv_type_names = htab_create_ggc (31, &hash_type, &compare_type, NULL);
slot = htab_find_slot_with_hash (conv_type_names, type, slot = htab_find_slot_with_hash (conv_type_names, type,
htab_hash_pointer (type), INSERT); (hashval_t) TYPE_UID (type), INSERT);
if (*slot) identifier = (tree)*slot;
return TREE_VALUE ((tree) *slot); if (!identifier)
{
/* Create a unique name corresponding to TYPE. */ char buffer[64];
sprintf (buffer, "operator %lu",
(unsigned long) htab_elements (conv_type_names)); /* Create a unique name corresponding to TYPE. */
identifier = get_identifier (buffer); sprintf (buffer, "operator %lu",
*slot = build_tree_list (type, identifier); (unsigned long) htab_elements (conv_type_names));
identifier = get_identifier (buffer);
*slot = identifier;
/* Hang TYPE off the identifier so it can be found easily later
when performing conversions. */
TREE_TYPE (identifier) = type;
/* Set bits on the identifier so we know later it's a conversion. */
IDENTIFIER_OPNAME_P (identifier) = 1;
IDENTIFIER_TYPENAME_P (identifier) = 1;
}
/* Set bits on the identifier so we know later it's a conversion. */
IDENTIFIER_OPNAME_P (identifier) = 1;
IDENTIFIER_TYPENAME_P (identifier) = 1;
/* Hang TYPE off the identifier so it can be found easily later when
performing conversions. */
TREE_TYPE (identifier) = type;
return identifier; return identifier;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment