Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 18/22] Remove sibling_die
Date: Sun, 22 Mar 2020 12:45:19 -0600	[thread overview]
Message-ID: <20200322184523.28959-19-tom@tromey.com> (raw)
In-Reply-To: <20200322184523.28959-1-tom@tromey.com>

The sibling_die helper function does not seem to add much value,
considering that many other fields of die_info are directly accessed.
So, this removes it.

gdb/ChangeLog
2020-03-22  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (read_import_statement, read_file_scope)
	(read_type_unit_scope, inherit_abstract_dies, read_func_scope)
	(read_lexical_block_scope, read_call_site_scope)
	(dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds)
	(handle_struct_member_die, process_structure_scope)
	(update_enumeration_type_from_children)
	(process_enumeration_scope, read_array_type, read_common_block)
	(read_namespace, read_module, read_subroutine_type): Update.
	(sibling_die): Remove.
---
 gdb/ChangeLog     | 12 +++++++++
 gdb/dwarf2/read.c | 62 ++++++++++++++++++++---------------------------
 2 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 87c4cae9b01..9d744ab0825 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1416,8 +1416,6 @@ static const char *dwarf_bool_name (unsigned int);
 
 static const char *dwarf_type_encoding_name (unsigned int);
 
-static struct die_info *sibling_die (struct die_info *);
-
 static void dump_die_shallow (struct ui_file *, int indent, struct die_info *);
 
 static void dump_die_for_error (struct die_info *);
@@ -10461,7 +10459,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
 
   if (die->tag == DW_TAG_imported_module && cu->language == language_fortran)
     for (child_die = die->child; child_die && child_die->tag;
-	 child_die = sibling_die (child_die))
+	 child_die = child_die->sibling)
       {
 	/* DWARF-4: A Fortran use statement with a “rename list” may be
 	   represented by an imported module entry with an import attribute
@@ -10739,7 +10737,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
       while (child_die && child_die->tag)
 	{
 	  process_die (child_die, cu);
-	  child_die = sibling_die (child_die);
+	  child_die = child_die->sibling;
 	}
     }
 
@@ -10907,7 +10905,7 @@ read_type_unit_scope (struct die_info *die, struct dwarf2_cu *cu)
       while (child_die && child_die->tag)
 	{
 	  process_die (child_die, cu);
-	  child_die = sibling_die (child_die);
+	  child_die = child_die->sibling;
 	}
     }
 }
@@ -12680,7 +12678,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
 
   for (child_die = die->child;
        child_die && child_die->tag;
-       child_die = sibling_die (child_die))
+       child_die = child_die->sibling)
     {
       struct die_info *child_origin_die;
       struct dwarf2_cu *child_origin_cu;
@@ -12757,7 +12755,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
 	  if (!origin_child_die->in_process)
 	    process_die (origin_child_die, origin_cu);
 	}
-      origin_child_die = sibling_die (origin_child_die);
+      origin_child_die = origin_child_die->sibling;
     }
   origin_cu->list_in_scope = origin_previous_list_in_scope;
 
@@ -12826,7 +12824,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 
   /* If we have any template arguments, then we must allocate a
      different sort of symbol.  */
-  for (child_die = die->child; child_die; child_die = sibling_die (child_die))
+  for (child_die = die->child; child_die; child_die = child_die->sibling)
     {
       if (child_die->tag == DW_TAG_template_type_param
 	  || child_die->tag == DW_TAG_template_value_param)
@@ -12879,7 +12877,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 	    }
 	  else
 	    process_die (child_die, cu);
-	  child_die = sibling_die (child_die);
+	  child_die = child_die->sibling;
 	}
     }
 
@@ -12901,7 +12899,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 	    {
 	      if (child_die->tag == DW_TAG_imported_module)
 		process_die (child_die, spec_cu);
-	      child_die = sibling_die (child_die);
+	      child_die = child_die->sibling;
 	    }
 
 	  /* In some cases, GCC generates specification DIEs that
@@ -12990,7 +12988,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
 	 GCC does no longer produces such DWARF since GCC r224161.  */
       for (child_die = die->child;
 	   child_die != NULL && child_die->tag;
-	   child_die = sibling_die (child_die))
+	   child_die = child_die->sibling)
 	process_die (child_die, cu);
       return;
     case PC_BOUNDS_INVALID:
@@ -13006,7 +13004,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
       while (child_die && child_die->tag)
 	{
 	  process_die (child_die, cu);
-	  child_die = sibling_die (child_die);
+	  child_die = child_die->sibling;
 	}
     }
   inherit_abstract_dies (die, cu);
@@ -13087,7 +13085,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 
   nparams = 0;
   for (child_die = die->child; child_die && child_die->tag;
-       child_die = sibling_die (child_die))
+       child_die = child_die->sibling)
     {
       if (child_die->tag != DW_TAG_call_site_parameter
           && child_die->tag != DW_TAG_GNU_call_site_parameter)
@@ -13232,7 +13230,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 
   for (child_die = die->child;
        child_die && child_die->tag;
-       child_die = sibling_die (child_die))
+       child_die = child_die->sibling)
     {
       struct call_site_parameter *parameter;
       struct attribute *loc, *origin;
@@ -13859,7 +13857,7 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
       if (child->tag == DW_TAG_subprogram
           || child->tag == DW_TAG_lexical_block)
         dwarf2_get_subprogram_pc_bounds (child, lowpc, highpc, cu);
-      child = sibling_die (child);
+      child = child->sibling;
     }
 }
 
@@ -13915,7 +13913,7 @@ get_scope_pc_bounds (struct die_info *die,
 	    break;
 	  }
 
-	  child = sibling_die (child);
+	  child = child->sibling;
 	}
     }
 
@@ -15153,7 +15151,7 @@ handle_struct_member_die (struct die_info *child_die, struct type *type,
 
       for (die_info *variant_child = child_die->child;
 	   variant_child != NULL;
-	   variant_child = sibling_die (variant_child))
+	   variant_child = variant_child->sibling)
 	{
 	  if (variant_child->tag == DW_TAG_member)
 	    {
@@ -15243,7 +15241,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
 	  if (is_variant_part && discr_offset == child_die->sect_off)
 	    fi.fields.back ().variant.is_discriminant = true;
 
-	  child_die = sibling_die (child_die);
+	  child_die = child_die->sibling;
 	}
 
       /* Attach template arguments to type.  */
@@ -15391,7 +15389,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
       else
 	process_die (child_die, cu);
 
-      child_die = sibling_die (child_die);
+      child_die = child_die->sibling;
     }
 
   /* Do not consider external references.  According to the DWARF standard,
@@ -15452,7 +15450,7 @@ update_enumeration_type_from_children (struct die_info *die,
 
   for (child_die = die->child;
        child_die != NULL && child_die->tag;
-       child_die = sibling_die (child_die))
+       child_die = child_die->sibling)
     {
       struct attribute *attr;
       LONGEST value;
@@ -15628,7 +15626,7 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
 		}
 	    }
 
-	  child_die = sibling_die (child_die);
+	  child_die = child_die->sibling;
 	}
 
       if (!fields.empty ())
@@ -15739,7 +15737,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
 	      range_types.push_back (child_type);
             }
 	}
-      child_die = sibling_die (child_die);
+      child_die = child_die->sibling;
     }
 
   /* Dwarf2 dimensions are output from left to right, create the
@@ -15976,7 +15974,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
 
       for (child_die = die->child;
 	   child_die && child_die->tag;
-	   child_die = sibling_die (child_die))
+	   child_die = child_die->sibling)
 	++n_entries;
 
       size = (sizeof (struct common_block)
@@ -15989,7 +15987,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
 
       for (child_die = die->child;
 	   child_die && child_die->tag;
-	   child_die = sibling_die (child_die))
+	   child_die = child_die->sibling)
 	{
 	  /* Create the symbol in the DW_TAG_common_block block in the current
 	     symbol scope.  */
@@ -16111,7 +16109,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
       while (child_die && child_die->tag)
 	{
 	  process_die (child_die, cu);
-	  child_die = sibling_die (child_die);
+	  child_die = child_die->sibling;
 	}
     }
 }
@@ -16147,7 +16145,7 @@ read_module (struct die_info *die, struct dwarf2_cu *cu)
   while (child_die && child_die->tag)
     {
       process_die (child_die, cu);
-      child_die = sibling_die (child_die);
+      child_die = child_die->sibling;
     }
 }
 
@@ -16646,7 +16644,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
 	    nparams++;
 	  else if (child_die->tag == DW_TAG_unspecified_parameters)
 	    TYPE_VARARGS (ftype) = 1;
-	  child_die = sibling_die (child_die);
+	  child_die = child_die->sibling;
 	}
 
       /* Allocate storage for parameters and fill them in.  */
@@ -16717,7 +16715,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
 	      TYPE_FIELD_TYPE (ftype, iparams) = arg_type;
 	      iparams++;
 	    }
-	  child_die = sibling_die (child_die);
+	  child_die = child_die->sibling;
 	}
     }
 
@@ -21238,14 +21236,6 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
     }
 }
 
-/* Return sibling of die, NULL if no sibling.  */
-
-static struct die_info *
-sibling_die (struct die_info *die)
-{
-  return die->sibling;
-}
-
 /* Get name of a die, return NULL if not found.  */
 
 static const char *
-- 
2.17.2



  parent reply	other threads:[~2020-03-22 18:45 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-22 18:45 [PATCH 00/22] More splitting of dwarf2/read.c Tom Tromey
2020-03-22 18:45 ` [PATCH 01/22] Introduce dwarf2/dwz.h Tom Tromey
2020-03-22 18:45 ` [PATCH 02/22] Add dwz.c and dwz_file::read_string Tom Tromey
2020-03-22 18:45 ` [PATCH 03/22] Change dwarf_decode_macro_bytes calling convention Tom Tromey
2020-03-22 18:45 ` [PATCH 04/22] Split dwarf_decode_macros into two overloads Tom Tromey
2020-03-23 16:13   ` Christian Biesinger
2020-03-26  2:09     ` Tom Tromey
2020-03-24  1:58   ` Simon Marchi
2020-03-26  2:10     ` Tom Tromey
2020-03-22 18:45 ` [PATCH 05/22] Move dwarf2_section_buffer_overflow_complaint to dwarf2/section.c Tom Tromey
2020-03-22 18:45 ` [PATCH 06/22] Convert dwarf2_section_buffer_overflow_complaint to a method Tom Tromey
2020-03-22 18:45 ` [PATCH 07/22] Add dwarf2_section_info::read_string method Tom Tromey
2020-03-22 18:45 ` [PATCH 08/22] Move code to new file dwarf2/macro.c Tom Tromey
2020-03-22 18:45 ` [PATCH 09/22] Make some line_header methods const Tom Tromey
2020-03-22 18:45 ` [PATCH 10/22] Use a const line_header in macro reader Tom Tromey
2020-03-22 18:45 ` [PATCH 11/22] Use a const dwarf2_section_info " Tom Tromey
2020-03-22 18:45 ` [PATCH 12/22] Trivial fix in dwarf_decode_macro_bytes Tom Tromey
2020-03-22 18:45 ` [PATCH 13/22] Convert read_indirect_line_string to a method Tom Tromey
2020-03-24  2:49   ` Simon Marchi
2020-03-22 18:45 ` [PATCH 14/22] Move more code to line-header.c Tom Tromey
2020-03-22 18:45 ` [PATCH 15/22] Move die_info to new header Tom Tromey
2020-03-22 18:45 ` [PATCH 16/22] Remove dwarf2_cu::base_known Tom Tromey
2020-03-22 18:45 ` [PATCH 17/22] Change dwarf2_attr_no_follow to be a method Tom Tromey
2020-03-22 18:45 ` Tom Tromey [this message]
2020-03-22 18:45 ` [PATCH 19/22] Change two more functions to be methods on die_info Tom Tromey
2020-03-23 19:07   ` Christian Biesinger
2020-03-26  2:17     ` Tom Tromey
2020-03-22 18:45 ` [PATCH 20/22] Rewrite new die_info methods Tom Tromey
2020-03-22 18:45 ` [PATCH 21/22] Move DWARF-constant stringifying code to new file Tom Tromey
2020-03-22 18:45 ` [PATCH 22/22] Change two functions to be methods on struct attribute Tom Tromey
2020-03-24 13:34 ` [PATCH 00/22] More splitting of dwarf2/read.c Simon Marchi
2020-03-26 15:32   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200322184523.28959-19-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox