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]

PATCH[b-i-b]: fix cp/*.c to use REAL_IDENTIFIER_TYPE_VALUE


This is a follow-on to this patch:
http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00447.html
(which is still waiting for review).  This is a little less
trivial.  Specifically, in mangle.c and pt.c I check if a
type's name is an IDENTIFIER_NODE or not.  I don't know if
this is really needed.

Again, this is a precursor to a change to redefine
SET_IDENTIFIER_TYPE_VALUE and REAL_IDENTIFIER_TYPE_VALUE
to look somewhere *otherf* than TYPE_VALUE.

2002-12-10  Per Bothner  <pbothner@apple.com>

	* decl.c (cp_finish_decl, grokdeclarator, grok_op_properties):
	Use REAL_IDENTIFIER_TYPE_VALUE raher than TREE_TYPE.
	* call.c (build_new_op): Likewise.
	* rtti.c (unemitted_tinfo_decl_p, emit_tinfo_decl):  Likewise.
	(get_tinfo_decl, emit_tinfo_decl):  Use SET_IDENTIFIER_TYPE_VALUE.
	* mangle.c (write_unqualified_name):  Likewise, but also handle
	non-IDENTIFIER_NODE.
	* pt.c (lookup_template_function):  Likewise.


--
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/
diff -up cp.old/call.c cp/call.c
--- cp.old/call.c	Tue Dec 10 17:51:28 2002
+++ cp/call.c	Mon Dec  9 18:29:31 2002
@@ -3421,7 +3421,8 @@ build_new_op (code, flags, arg1, arg2, a
 	  templates = tree_cons (NULL_TREE, fn, templates);
 	  candidates 
 	    = add_template_candidate (candidates, fn, NULL_TREE, NULL_TREE,
-				      arglist, TREE_TYPE (fnname),
+				      arglist,
+				      REAL_IDENTIFIER_TYPE_VALUE (fnname),
 				      /*access_path=*/NULL_TREE,
 				      /*conversion_path=*/NULL_TREE,
 				      flags, DEDUCE_CALL); 
@@ -3467,7 +3468,8 @@ build_new_op (code, flags, arg1, arg2, a
 		= add_template_candidate (candidates, fn, 
 					  BINFO_TYPE (conversion_path),
 					  NULL_TREE,
-					  this_arglist,  TREE_TYPE (fnname),
+					  this_arglist,
+					  REAL_IDENTIFIER_TYPE_VALUE (fnname),
 					  access_path, conversion_path,
 					  flags, DEDUCE_CALL); 
 	    }
diff -up cp.old/decl.c cp/decl.c
--- cp.old/decl.c	Tue Dec 10 18:02:01 2002
+++ cp/decl.c	Mon Dec  9 18:32:56 2002
@@ -8395,7 +8395,8 @@ cp_finish_decl (decl, init, asmspec_tree
       if (type != error_mark_node
 	  && IS_AGGR_TYPE (type) && DECL_NAME (decl))
 	{
-	  if (TREE_TYPE (DECL_NAME (decl)) && TREE_TYPE (decl) != type)
+	  if (REAL_IDENTIFIER_TYPE_VALUE (DECL_NAME (decl))
+	      && TREE_TYPE (decl) != type)
 	    warning ("shadowing previous type declaration of `%#D'", decl);
 	  set_identifier_type_value (DECL_NAME (decl), type);
 	  CLASSTYPE_GOT_SEMICOLON (type) = 1;
@@ -10179,7 +10180,7 @@ grokdeclarator (declarator, declspecs, d
 	      {
 		my_friendly_assert (flags == NO_SPECIAL, 154);
 		flags = TYPENAME_FLAG;
-		ctor_return_type = TREE_TYPE (dname);
+		ctor_return_type = REAL_IDENTIFIER_TYPE_VALUE (dname);
 		sfk = sfk_conversion;
 		if (IDENTIFIER_GLOBAL_VALUE (dname)
 		    && (TREE_CODE (IDENTIFIER_GLOBAL_VALUE (dname))
@@ -12792,7 +12793,7 @@ grok_op_properties (decl, friendp)
 
       if (IDENTIFIER_TYPENAME_P (name) && ! DECL_TEMPLATE_INFO (decl))
 	{
-	  tree t = TREE_TYPE (name);
+	  tree t = REAL_IDENTIFIER_TYPE_VALUE (name);
 	  if (! friendp)
 	    {
 	      int ref = (TREE_CODE (t) == REFERENCE_TYPE);
diff -up cp.old/mangle.c cp/mangle.c
--- cp.old/mangle.c	Tue Dec 10 17:51:33 2002
+++ cp/mangle.c	Tue Dec 10 18:07:45 2002
@@ -1018,7 +1018,12 @@ write_unqualified_name (decl)
 	  type = TREE_TYPE (fn_type);
 	}
       else
-	type = TREE_TYPE (DECL_NAME (decl));
+	{
+	  type = DECL_NAME (decl);
+	  type = TREE_CODE (type) == IDENTIFIER_NODE
+	    ? REAL_IDENTIFIER_TYPE_VALUE (type)
+	    : TREE_TYPE (type);
+	}
       write_conversion_operator_name (type);
     }
   else if (DECL_OVERLOADED_OPERATOR_P (decl))
diff -up cp.old/pt.c cp/pt.c
--- cp.old/pt.c	Tue Dec 10 18:02:01 2002
+++ cp/pt.c	Mon Dec  9 18:38:43 2002
@@ -3861,7 +3861,8 @@ lookup_template_function (fns, arglist)
       return fns;
     }
 
-  type = TREE_TYPE (fns);
+  type = TREE_CODE (fns) == IDENTIFIER_NODE ? REAL_IDENTIFIER_TYPE_VALUE (fns)
+    : TREE_TYPE (fns);
   if (TREE_CODE (fns) == OVERLOAD || !type)
     type = unknown_type_node;
   
diff -up cp.old/rtti.c cp/rtti.c
--- cp.old/rtti.c	Tue Dec 10 17:51:36 2002
+++ cp/rtti.c	Mon Dec  9 18:43:12 2002
@@ -362,7 +362,7 @@ get_tinfo_decl (type)
 	CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
 
       /* Remember the type it is for.  */
-      TREE_TYPE (name) = type;
+      SET_IDENTIFIER_TYPE_VALUE (name, type);
     }
 
   return d;
@@ -1444,10 +1444,10 @@ unemitted_tinfo_decl_p (t, data)
 {
   if (/* It's a var decl */
       TREE_CODE (t) == VAR_DECL
-      /* whos name points back to itself */
+      /* whose name points back to itself */
       && IDENTIFIER_GLOBAL_VALUE (DECL_NAME (t)) == t
       /* whose name's type is non-null */
-      && TREE_TYPE (DECL_NAME (t))
+      && REAL_IDENTIFIER_TYPE_VALUE (DECL_NAME (t))
       /* and whose type is a struct */
       && TREE_CODE (TREE_TYPE (t)) == RECORD_TYPE
       /* with a field */
@@ -1468,7 +1468,7 @@ emit_tinfo_decl (decl_ptr, data)
      void *data ATTRIBUTE_UNUSED;
 {
   tree decl = *decl_ptr;
-  tree type = TREE_TYPE (DECL_NAME (decl));
+  tree type = REAL_IDENTIFIER_TYPE_VALUE (DECL_NAME (decl));
   int non_public;
   int in_library = typeinfo_in_lib_p (type);
   tree var_desc, var_init;
@@ -1494,7 +1494,7 @@ emit_tinfo_decl (decl_ptr, data)
   /* cp_finish_decl will have dealt with linkage.  */
   
   /* Say we've dealt with it.  */
-  TREE_TYPE (DECL_NAME (decl)) = NULL_TREE;
+  SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (decl), NULL_TREE);
 
   return 1;
 }

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