[debug-early] do not add location info/etc to abstract instances
diff mbox

Message ID 542DA680.6010606@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez Oct. 2, 2014, 7:24 p.m. UTC
On 10/02/14 08:53, Jason Merrill wrote:
> On 09/30/2014 02:43 PM, Aldy Hernandez wrote:
>> +  if (parm_die
>> +      /* Make sure the function to which this parameter belongs to is
>> +     not an abstract instance.  If it is, we can't reuse anything.
>> +     We must create a new DW_TAG_formal_parameter with a
>> +     corresponding DW_AT_abstract_origin.  */
>> +      && !get_AT (context_die, DW_AT_abstract_origin))
>
> Can we use the same test here that we do later in this function, namely
> origin && origin != node?

Actually yes.  But I think you mean "!origin", for the parm_die==true 
case anyhow.  So something like the following (as in the attached patch):

   /* If we have a previously generated DIE, use it, unless this is an
      abstract instance (origin != NULL), in which case we need a new
      DIE with a corresponding DW_AT_abstract_origin.  */
   bool reusing_die;
   if (parm_die && origin == NULL)
     reusing_die = true;
   else
     {
       parm_die = new_die (DW_TAG_formal_parameter, context_die, node);
       reusing_die = false;
     }

>
>> -  if (origin != NULL && origin != decl)
>> +  if (origin != NULL && (origin != decl || old_die))
>
> Don't we want to go back to "if (origin != NULL)" here too?

Sure.

If you are ok with this incremental patch, I will push it to the branch.

Thanks for your comments.
Aldy
commit 96593217826a123b907c600c205fd46b012c77e4
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu Oct 2 12:21:12 2014 -0700

    	* dwarf2out.c (gen_formal_parameter_die): Simplify check for
    	abstract instance.
    	(gen_subprogram_die): Same.

Comments

Jason Merrill Oct. 3, 2014, 2:08 p.m. UTC | #1
On 10/02/2014 03:24 PM, Aldy Hernandez wrote:
> If you are ok with this incremental patch, I will push it to the branch.

Looks good.  In general I don't think you need to wait for approval 
before checking something in on your own branch.  :)

Jason
Aldy Hernandez Oct. 3, 2014, 2:10 p.m. UTC | #2
I know.... It just makes me feel better to know we're in agreement. Old habits die hard I guess ;-).

On Oct 3, 2014 7:08 AM, Jason Merrill <jason@redhat.com> wrote:
>
> On 10/02/2014 03:24 PM, Aldy Hernandez wrote: 
> > If you aOn 10/02/2014 03:24 PM, Aldy Hernandez wrote:
> If you are ok with this incremental patch, I will push it to the branch.

Looks good.  In general I don't think you need to wait for approval 
before checking something in on your own branch.  :)

Jason

Patch
diff mbox

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 6830abd..16998c5 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -17786,13 +17786,11 @@  gen_formal_parameter_die (tree node, tree origin, bool emit_name_p,
 	}
     }
 
+  /* If we have a previously generated DIE, use it, unless this is an
+     abstract instance (origin != NULL), in which case we need a new
+     DIE with a corresponding DW_AT_abstract_origin.  */
   bool reusing_die;
-  if (parm_die
-      /* Make sure the function to which this parameter belongs to is
-	 not an abstract instance.  If it is, we can't reuse anything.
-	 We must create a new DW_TAG_formal_parameter with a
-	 corresponding DW_AT_abstract_origin.  */
-      && !get_AT (context_die, DW_AT_abstract_origin))
+  if (parm_die && origin == NULL)
     reusing_die = true;
   else
     {
@@ -18349,7 +18347,7 @@  gen_subprogram_die (tree decl, dw_die_ref context_die)
       && debug_info_level > DINFO_LEVEL_TERSE)
     old_die = force_decl_die (decl);
 
-  if (origin != NULL && (origin != decl || old_die))
+  if (origin != NULL)
     {
       gcc_assert (!declaration || local_scope_p (context_die));