[1/9] dwarf: add dw_get_die_parent function

Message ID 20220607214342.19463-2-david.faust@oracle.com
State New
Headers
Series Add debug_annotate attributes |

Commit Message

David Faust June 7, 2022, 9:43 p.m. UTC
  gcc/

	* dwarf2out.cc (dw_get_die_parent): New function.
	* dwarf2out.h (dw_get_die_parent): Declare it here.
---
 gcc/dwarf2out.cc | 8 ++++++++
 gcc/dwarf2out.h  | 1 +
 2 files changed, 9 insertions(+)
  

Comments

Richard Biener June 13, 2022, 10:13 a.m. UTC | #1
On Tue, Jun 7, 2022 at 11:44 PM David Faust via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:

OK

> gcc/
>
>         * dwarf2out.cc (dw_get_die_parent): New function.
>         * dwarf2out.h (dw_get_die_parent): Declare it here.
> ---
>  gcc/dwarf2out.cc | 8 ++++++++
>  gcc/dwarf2out.h  | 1 +
>  2 files changed, 9 insertions(+)
>
> diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
> index 29f32ec6939..9c61026bb34 100644
> --- a/gcc/dwarf2out.cc
> +++ b/gcc/dwarf2out.cc
> @@ -5235,6 +5235,14 @@ dw_get_die_sib (dw_die_ref die)
>    return die->die_sib;
>  }
>
> +/* Return a reference to the parent of a given DIE.  */
> +
> +dw_die_ref
> +dw_get_die_parent (dw_die_ref die)
> +{
> +  return die->die_parent;
> +}
> +
>  /* Add an address constant attribute value to a DIE.  When using
>     dwarf_split_debug_info, address attributes in dies destined for the
>     final executable should be direct references--setting the parameter
> diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
> index 656ef94afde..e6962fb4848 100644
> --- a/gcc/dwarf2out.h
> +++ b/gcc/dwarf2out.h
> @@ -455,6 +455,7 @@ extern dw_die_ref lookup_type_die (tree);
>
>  extern dw_die_ref dw_get_die_child (dw_die_ref);
>  extern dw_die_ref dw_get_die_sib (dw_die_ref);
> +extern dw_die_ref dw_get_die_parent (dw_die_ref);
>  extern enum dwarf_tag dw_get_die_tag (dw_die_ref);
>
>  /* Data about a single source file.  */
> --
> 2.36.1
>
  

Patch

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 29f32ec6939..9c61026bb34 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -5235,6 +5235,14 @@  dw_get_die_sib (dw_die_ref die)
   return die->die_sib;
 }
 
+/* Return a reference to the parent of a given DIE.  */
+
+dw_die_ref
+dw_get_die_parent (dw_die_ref die)
+{
+  return die->die_parent;
+}
+
 /* Add an address constant attribute value to a DIE.  When using
    dwarf_split_debug_info, address attributes in dies destined for the
    final executable should be direct references--setting the parameter
diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
index 656ef94afde..e6962fb4848 100644
--- a/gcc/dwarf2out.h
+++ b/gcc/dwarf2out.h
@@ -455,6 +455,7 @@  extern dw_die_ref lookup_type_die (tree);
 
 extern dw_die_ref dw_get_die_child (dw_die_ref);
 extern dw_die_ref dw_get_die_sib (dw_die_ref);
+extern dw_die_ref dw_get_die_parent (dw_die_ref);
 extern enum dwarf_tag dw_get_die_tag (dw_die_ref);
 
 /* Data about a single source file.  */