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]

[c++ patch]: set specialization locations


Hi,
this patch sets a specialization's location in a couple of places that it
wasn't being updated.

This make the decl's location correct when it is a definition and will
help my lineno reorganization effort.

booted & tested on i686-pc-linux-gnu, ok?

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2003-05-09  Nathan Sidwell  <nathan@codesourcery.com>

	* pt.c (register_specialization): Update the decl's location,
	if necessary.
	(check_explicit_specialization): Likewise.

Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.688
diff -c -3 -p -r1.688 pt.c
*** cp/pt.c	3 May 2003 11:37:22 -0000	1.688
--- cp/pt.c	9 May 2003 19:45:49 -0000
*************** register_specialization (spec, tmpl, arg
*** 1041,1047 ****
  		}
  	      else if (DECL_TEMPLATE_SPECIALIZATION (fn))
  		{
! 		  duplicate_decls (spec, fn);
  		  return fn;
  		}
  	    }
--- 1041,1052 ----
  		}
  	      else if (DECL_TEMPLATE_SPECIALIZATION (fn))
  		{
! 		  if (!duplicate_decls (spec, fn) && DECL_INITIAL (spec))
! 		    /* Dup decl failed, but this is a new
! 		       definition. Set the line number so any errors
! 		       match this new definition. */
! 		    DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (spec);
! 		  
  		  return fn;
  		}
  	    }
*************** check_explicit_specialization (declarato
*** 1851,1856 ****
--- 1856,1867 ----
  	    {
  	      SET_DECL_TEMPLATE_SPECIALIZATION (tmpl);
  	      DECL_INITIAL (DECL_TEMPLATE_RESULT (tmpl)) = NULL_TREE;
+ 	      if (have_def)
+ 		{
+ 		  DECL_SOURCE_LOCATION (tmpl) = DECL_SOURCE_LOCATION (decl);
+ 		  DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (tmpl))
+ 		    = DECL_SOURCE_LOCATION (decl);
+ 		}
  	      return tmpl;
  	    }
  

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