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: Replace DECL_SOURCE_{FILE + LINE} with DECL_SOURCE_LOCATION


This patchlet replaces the combinaison

   DECL_SOURCE_FILE (this_decl) = DECL_SOURCE_FILE (that_decl);
   DECL_SOURCE_LINE (this_decl) = DECL_SOURCE_LINE (that_decl);

with 

   DECL_SOURCE_LOCATION (this_decl) = DECL_SOURCE_LOCATION (that_decl);

Bootstrapped and tested on an i686-pc-linux.  Applied to mainline.

There remain similar patterns with input_filename and lineno.
They will be handled in 3.4.

-- Gaby
2002-08-11  Gabriel Dos Reis  <gdr@nerim.net>

	* decl.c (duplicate_decls): Replace DECL_SOURCE_FILE +
	DECL_SOURCE_LINE with DECL_SOURCE_LOCATION.
	* optimize.c (maybe_clone_body): Likewise.
	* pt.c (tsubst_enum): Likewise.
	(lookup_template_class): Likewise.
	* tree.c (cp_copy_res_decl_for_inlining): Likewise.

Index: decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.929
diff -p -r1.929 decl.c
*** decl.c	9 Aug 2002 19:57:00 -0000	1.929
--- decl.c	11 Aug 2002 16:04:21 -0000
*************** duplicate_decls (newdecl, olddecl)
*** 3402,3413 ****
        if (DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)) == NULL_TREE
  	  && DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl)) != NULL_TREE)
  	{
! 	  DECL_SOURCE_LINE (olddecl) 
! 	    = DECL_SOURCE_LINE (DECL_TEMPLATE_RESULT (olddecl))
! 	    = DECL_SOURCE_LINE (newdecl);
! 	  DECL_SOURCE_FILE (olddecl) 
! 	    = DECL_SOURCE_FILE (DECL_TEMPLATE_RESULT (olddecl))
! 	    = DECL_SOURCE_FILE (newdecl);
  	}
  
        return 1;
--- 3402,3410 ----
        if (DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)) == NULL_TREE
  	  && DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl)) != NULL_TREE)
  	{
! 	  DECL_SOURCE_LOCATION (olddecl) 
! 	    = DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (olddecl))
! 	    = DECL_SOURCE_LOCATION (newdecl);
  	}
  
        return 1;
*************** duplicate_decls (newdecl, olddecl)
*** 3478,3485 ****
  	  && DECL_INITIAL (olddecl) != NULL_TREE)
  	{
  	  DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
! 	  DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl);
! 	  DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl);
  	  if (CAN_HAVE_FULL_LANG_DECL_P (newdecl)
  	      && DECL_LANG_SPECIFIC (newdecl)
  	      && DECL_LANG_SPECIFIC (olddecl))
--- 3475,3481 ----
  	  && DECL_INITIAL (olddecl) != NULL_TREE)
  	{
  	  DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
! 	  DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl);
  	  if (CAN_HAVE_FULL_LANG_DECL_P (newdecl)
  	      && DECL_LANG_SPECIFIC (newdecl)
  	      && DECL_LANG_SPECIFIC (olddecl))
Index: optimize.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/optimize.c,v
retrieving revision 1.81
diff -p -r1.81 optimize.c
*** optimize.c	16 Dec 2001 16:07:00 -0000	1.81
--- optimize.c	11 Aug 2002 16:04:21 -0000
*************** update_cloned_parm (parm, cloned_parm)
*** 129,136 ****
    
    /* The name may have changed from the declaration. */
    DECL_NAME (cloned_parm) = DECL_NAME (parm);
!   DECL_SOURCE_FILE (cloned_parm) = DECL_SOURCE_FILE (parm);
!   DECL_SOURCE_LINE (cloned_parm) = DECL_SOURCE_LINE (parm);
  }
  
  /* FN is a function that has a complete body.  Clone the body as
--- 129,135 ----
    
    /* The name may have changed from the declaration. */
    DECL_NAME (cloned_parm) = DECL_NAME (parm);
!   DECL_SOURCE_LOCATION (cloned_parm) = DECL_SOURCE_LOCATION (parm);
  }
  
  /* FN is a function that has a complete body.  Clone the body as
*************** maybe_clone_body (fn)
*** 164,171 ****
        splay_tree decl_map;
  
        /* Update CLONE's source position information to match FN's.  */
!       DECL_SOURCE_FILE (clone) = DECL_SOURCE_FILE (fn);
!       DECL_SOURCE_LINE (clone) = DECL_SOURCE_LINE (fn);
        DECL_INLINE (clone) = DECL_INLINE (fn);
        DECL_DECLARED_INLINE_P (clone) = DECL_DECLARED_INLINE_P (fn);
        DECL_COMDAT (clone) = DECL_COMDAT (fn);
--- 163,169 ----
        splay_tree decl_map;
  
        /* Update CLONE's source position information to match FN's.  */
!       DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn);
        DECL_INLINE (clone) = DECL_INLINE (fn);
        DECL_DECLARED_INLINE_P (clone) = DECL_DECLARED_INLINE_P (fn);
        DECL_COMDAT (clone) = DECL_COMDAT (fn);
Index: pt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/pt.c,v
retrieving revision 1.609
diff -p -r1.609 pt.c
*** pt.c	9 Aug 2002 01:16:39 -0000	1.609
--- pt.c	11 Aug 2002 16:04:26 -0000
*************** lookup_template_class (d1, arglist, in_d
*** 4215,4224 ****
  	  type_decl = create_implicit_typedef (DECL_NAME (template), t);
  	  DECL_CONTEXT (type_decl) = TYPE_CONTEXT (t);
  	  TYPE_STUB_DECL (t) = type_decl;
! 	  DECL_SOURCE_FILE (type_decl) 
! 	    = DECL_SOURCE_FILE (TYPE_STUB_DECL (template_type));
! 	  DECL_SOURCE_LINE (type_decl) 
! 	    = DECL_SOURCE_LINE (TYPE_STUB_DECL (template_type));
  	}
        else
  	type_decl = TYPE_NAME (t);
--- 4215,4222 ----
  	  type_decl = create_implicit_typedef (DECL_NAME (template), t);
  	  DECL_CONTEXT (type_decl) = TYPE_CONTEXT (t);
  	  TYPE_STUB_DECL (t) = type_decl;
! 	  DECL_SOURCE_LOCATION (type_decl) 
! 	    = DECL_SOURCE_LOCATION (TYPE_STUB_DECL (template_type));
  	}
        else
  	type_decl = TYPE_NAME (t);
*************** tsubst_enum (tag, newtag, args)
*** 10363,10370 ****
      }
  
    finish_enum (newtag);
!   DECL_SOURCE_LINE (TYPE_NAME (newtag)) = DECL_SOURCE_LINE (TYPE_NAME (tag));
!   DECL_SOURCE_FILE (TYPE_NAME (newtag)) = DECL_SOURCE_FILE (TYPE_NAME (tag));
  }
  
  /* DECL is a FUNCTION_DECL that is a template specialization.  Return
--- 10361,10368 ----
      }
  
    finish_enum (newtag);
!   DECL_SOURCE_LOCATION (TYPE_NAME (newtag))
!     = DECL_SOURCE_LOCATION (TYPE_NAME (tag));
  }
  
  /* DECL is a FUNCTION_DECL that is a template specialization.  Return
Index: tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tree.c,v
retrieving revision 1.294
diff -p -r1.294 tree.c
*** tree.c	10 Aug 2002 13:11:41 -0000	1.294
--- tree.c	11 Aug 2002 16:04:27 -0000
*************** cp_copy_res_decl_for_inlining (result, f
*** 2289,2296 ****
  	     position so we can get reasonable debugging information, and
  	     register the return variable as its equivalent.  */
  	  DECL_NAME (var) = DECL_NAME (nrv);
! 	  DECL_SOURCE_FILE (var) = DECL_SOURCE_FILE (nrv);
! 	  DECL_SOURCE_LINE (var) = DECL_SOURCE_LINE (nrv);
  	  DECL_ABSTRACT_ORIGIN (var) = DECL_ORIGIN (nrv);
  	  /* Don't lose initialization info.  */
  	  DECL_INITIAL (var) = DECL_INITIAL (nrv);
--- 2289,2295 ----
  	     position so we can get reasonable debugging information, and
  	     register the return variable as its equivalent.  */
  	  DECL_NAME (var) = DECL_NAME (nrv);
! 	  DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (nrv);
  	  DECL_ABSTRACT_ORIGIN (var) = DECL_ORIGIN (nrv);
  	  /* Don't lose initialization info.  */
  	  DECL_INITIAL (var) = DECL_INITIAL (nrv);


  


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