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]

C++ PATCH: Fix dwarf2 handling of artificial parms


We were failing to set the artificial flag on the in-charge and VTT parms
for constructor declarations, and incorrectly setting it on the argument to
the copy constructor/assignment operator.

Applied to trunk and branch.

2001-02-21  Jason Merrill  <jason@redhat.com>

	* dwarf2out.c (gen_formal_types_die): Also accept a FUNCTION_DECL.
	(get_subprogram_die): Pass it in.

2001-02-21  Jason Merrill  <jason@redhat.com>

	* method.c (implicitly_declare_fn): Don't set DECL_ARTIFICIAL on
	second parm of op=.

*** dwarf2out.c.~1~	Wed Feb 21 11:49:49 2001
--- dwarf2out.c	Wed Feb 21 11:50:00 2001
*************** gen_formal_types_die (function_or_method
*** 9936,9959 ****
  {
    register tree link;
    register tree formal_type = NULL;
!   register tree first_parm_type = TYPE_ARG_TYPES (function_or_method_type);
  
! #if 0
!   /* In the case where we are generating a formal types list for a C++
!      non-static member function type, skip over the first thing on the
!      TYPE_ARG_TYPES list because it only represents the type of the hidden
!      `this pointer'.  The debugger should be able to figure out (without
!      being explicitly told) that this non-static member function type takes a
!      `this pointer' and should be able to figure what the type of that hidden
!      parameter is from the DW_AT_member attribute of the parent
!      DW_TAG_subroutine_type DIE.  */
!   if (TREE_CODE (function_or_method_type) == METHOD_TYPE)
!     first_parm_type = TREE_CHAIN (first_parm_type);
! #endif
  
    /* Make our first pass over the list of formal parameter types and output a
       DW_TAG_formal_parameter DIE for each one.  */
!   for (link = first_parm_type; link; link = TREE_CHAIN (link))
      {
        register dw_die_ref parm_die;
  
--- 9937,9958 ----
  {
    register tree link;
    register tree formal_type = NULL;
!   register tree first_parm_type;
!   tree arg;
  
!   if (TREE_CODE (function_or_method_type) == FUNCTION_DECL)
!     {
!       arg = DECL_ARGUMENTS (function_or_method_type);
!       function_or_method_type = TREE_TYPE (function_or_method_type);
!     }
!   else
!     arg = NULL_TREE;
!   
!   first_parm_type = TYPE_ARG_TYPES (function_or_method_type);
  
    /* Make our first pass over the list of formal parameter types and output a
       DW_TAG_formal_parameter DIE for each one.  */
!   for (link = first_parm_type; link; )
      {
        register dw_die_ref parm_die;
  
*************** gen_formal_types_die (function_or_method
*** 9963,9971 ****
  
        /* Output a (nameless) DIE to represent the formal parameter itself.  */
        parm_die = gen_formal_parameter_die (formal_type, context_die);
!       if (TREE_CODE (function_or_method_type) == METHOD_TYPE
! 	  && link == first_parm_type)
  	add_AT_flag (parm_die, DW_AT_artificial, 1);
      }
  
    /* If this function type has an ellipsis, add a
--- 9962,9975 ----
  
        /* Output a (nameless) DIE to represent the formal parameter itself.  */
        parm_die = gen_formal_parameter_die (formal_type, context_die);
!       if ((TREE_CODE (function_or_method_type) == METHOD_TYPE
! 	   && link == first_parm_type)
! 	  || (arg && DECL_ARTIFICIAL (arg)))
  	add_AT_flag (parm_die, DW_AT_artificial, 1);
+ 
+       link = TREE_CHAIN (link);
+       if (arg)
+ 	arg = TREE_CHAIN (arg);
      }
  
    /* If this function type has an ellipsis, add a
*************** gen_subprogram_die (decl, context_die)
*** 10261,10267 ****
    if (debug_info_level <= DINFO_LEVEL_TERSE)
      ;
    else if (declaration)
!     gen_formal_types_die (TREE_TYPE (decl), subr_die);
    else
      {
        /* Generate DIEs to represent all known formal parameters */
--- 10269,10275 ----
    if (debug_info_level <= DINFO_LEVEL_TERSE)
      ;
    else if (declaration)
!     gen_formal_types_die (decl, subr_die);
    else
      {
        /* Generate DIEs to represent all known formal parameters */
*** cp/method.c.~1~	Wed Feb 21 11:49:52 2001
--- cp/method.c	Wed Feb 21 11:50:07 2001
*************** implicitly_declare_fn (kind, type, const
*** 1026,1033 ****
  
    my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 20000408);
  
-   if (kind != sfk_constructor && kind != sfk_destructor)
-     DECL_ARTIFICIAL (TREE_CHAIN (DECL_ARGUMENTS (fn))) = 1;
    DECL_ARTIFICIAL (fn) = 1;
    DECL_NOT_REALLY_EXTERN (fn) = 1;
    DECL_THIS_INLINE (fn) = 1;
--- 1026,1031 ----

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