This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Patch PR debug/41065


Le 21/09/2009 17:08, Jason Merrill a écrit :
On 09/01/2009 05:22 PM, Dodji Seketeli wrote:
+hashval_t
+types_used_by_vars_do_hash (const void *x)
+{
+ return htab_hash_pointer
+ (((const struct types_used_by_vars_entry*)x)->type);
+}
+
+/*Equality function of the types_used_by_vars_entry hash table. */
+
+int
+types_used_by_vars_eq (const void *x1, const void *x2)
+{
+ return htab_eq_pointer
+ (((const struct types_used_by_vars_entry *)x1)->type,
+ (const union tree_node*) x2);

Why don't these hash/compare the var_decl?



My understanding is that we want to keep the type used by the var_decl because the var_decl itself might loose the information. For instance, in the example of the patch, the information about v being initialized by the CONST_DECL 'a' is lost as we only keep the integral value of 'a' in finish_id_expression:


/* Similarly, we resolve enumeration constants to their

underlying values. */

else if (TREE_CODE (decl) == CONST_DECL)
{
*idk = CP_ID_KIND_NONE;
if (!processing_template_decl)


{
used_types_insert (TREE_TYPE (decl));


return DECL_INITIAL (decl);

        }
      return decl;
    }

Hence the type hashing, rather than the var_decl hashing.

--
Dodji Seketeli
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]