C++ PATCH for c++/53756 (-g and C++1y auto)

Paolo Carlini paolo.carlini@oracle.com
Wed Jan 29 21:28:00 GMT 2014


Hi,

On 01/29/2014 09:49 PM, Jason Merrill wrote:
> OK, thanks.
Applied.
>> By the way, when I said 3/4 uses (in fact, at least 4 in the file), I 
>> meant the pattern:
>>
>>         tree name = TYPE_NAME (type);
>>         if (TREE_CODE (name) == TYPE_DECL)
>>           name = DECL_NAME (name);
>>
>> which I noticed yesterday. Could be a new macro? (post 4.9 maybe)
>
> Sure.  Maybe call it TYPE_IDENTIFIER, replacing the one in cp-tree.h 
> with a conditional one in tree.h.
Interesting. If you like we can do now the below, as preparatory 
clean-up for the above, which I would do when 4.9 branches.

Thanks,
Paolo.

/////////////////////
-------------- next part --------------
2014-01-29  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (duplicate_decls, typename_hash, typename_compare):
	Use TYPE_IDENTIFIER.
	* error.c (dump_type): Likewise.
	* mangle.c (dump_substitution_candidates): Likewise.
-------------- next part --------------
Index: decl.c
===================================================================
--- decl.c	(revision 207281)
+++ decl.c	(working copy)
@@ -1381,7 +1381,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool
 
 		    if (TYPE_PTR_P (t)
 			&& TYPE_NAME (TREE_TYPE (t))
-			&& DECL_NAME (TYPE_NAME (TREE_TYPE (t)))
+			&& TYPE_IDENTIFIER (TREE_TYPE (t))
 			   == get_identifier ("FILE")
 			&& compparms (TREE_CHAIN (t1), TREE_CHAIN (t2)))
 		      {
@@ -3213,7 +3213,7 @@ typename_hash (const void* k)
   const_tree const t = (const_tree) k;
 
   hash = (htab_hash_pointer (TYPE_CONTEXT (t))
-	  ^ htab_hash_pointer (DECL_NAME (TYPE_NAME (t))));
+	  ^ htab_hash_pointer (TYPE_IDENTIFIER (t)));
 
   return hash;
 }
@@ -3235,7 +3235,7 @@ typename_compare (const void * k1, const void * k2
   const_tree const t1 = (const_tree) k1;
   const typename_info *const t2 = (const typename_info *) k2;
 
-  return (DECL_NAME (TYPE_NAME (t1)) == t2->name
+  return (TYPE_IDENTIFIER (t1) == t2->name
 	  && TYPE_CONTEXT (t1) == t2->scope
 	  && TYPENAME_TYPE_FULLNAME (t1) == t2->template_id
 	  && TYPENAME_IS_ENUM_P (t1) == t2->enum_p
Index: error.c
===================================================================
--- error.c	(revision 207281)
+++ error.c	(working copy)
@@ -512,7 +512,7 @@ dump_type (cxx_pretty_printer *pp, tree t, int fla
 	  pp_cxx_colon_colon (pp);
 	}
       pp_cxx_ws_string (pp, "template");
-      dump_type (pp, DECL_NAME (TYPE_NAME (t)), flags);
+      dump_type (pp, TYPE_IDENTIFIER (t), flags);
       break;
 
     case TYPEOF_TYPE:
Index: mangle.c
===================================================================
--- mangle.c	(revision 207281)
+++ mangle.c	(working copy)
@@ -323,7 +323,7 @@ dump_substitution_candidates (void)
       else if (TREE_CODE (el) == TREE_LIST)
 	name = IDENTIFIER_POINTER (DECL_NAME (TREE_VALUE (el)));
       else if (TYPE_NAME (el))
-	name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (el)));
+	name = IDENTIFIER_POINTER (TYPE_IDENTIFIER (el));
       fprintf (stderr, " S%d_ = ", i - 1);
       if (TYPE_P (el) &&
 	  (CP_TYPE_RESTRICT_P (el)


More information about the Gcc-patches mailing list