public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1674] [Ada] Do not generate DW_TAG_typedef for constrained array types
@ 2022-07-13 10:04 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-13 10:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:589163e18a291ce6f0befc67be4ca9ad6924d959

commit r13-1674-g589163e18a291ce6f0befc67be4ca9ad6924d959
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Wed Jun 22 20:38:15 2022 +0200

    [Ada] Do not generate DW_TAG_typedef for constrained array types
    
    It no longer serves any useful purpose at this point.
    
    gcc/ada/
    
            * gcc-interface/utils.cc (gnat_pushdecl): Build DECL_ORIGINAL_TYPE
            only for pointer types.

Diff:
---
 gcc/ada/gcc-interface/utils.cc | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index 05adacd52ea..a57143021a7 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -877,21 +877,18 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
     {
       tree t = TREE_TYPE (decl);
 
-      /* Array and pointer types aren't tagged types in the C sense so we need
-	 to generate a typedef in DWARF for them and make sure it is preserved,
-	 unless the type is artificial.  */
+      /* Pointer types aren't named types in the C sense so we need to generate
+         a typedef in DWARF for them and make sure it is preserved, unless the
+         type is artificial.  */
       if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)
-	  && ((TREE_CODE (t) != ARRAY_TYPE && TREE_CODE (t) != POINTER_TYPE)
-	      || DECL_ARTIFICIAL (decl)))
+	  && (TREE_CODE (t) != POINTER_TYPE || DECL_ARTIFICIAL (decl)))
 	;
-      /* For array and pointer types, create the DECL_ORIGINAL_TYPE that will
-	 generate the typedef in DWARF.  Also do that for fat pointer types
-	 because, even though they are tagged types in the C sense, they are
-	 still XUP types attached to the base array type at this point.  */
+      /* For pointer types, create the DECL_ORIGINAL_TYPE that will generate
+	 the typedef in DWARF.  Also do that for fat pointer types because,
+	 even though they are named types in the C sense, they are still the
+	 XUP types created for the base array type at this point.  */
       else if (!DECL_ARTIFICIAL (decl)
-	       && (TREE_CODE (t) == ARRAY_TYPE
-		   || TREE_CODE (t) == POINTER_TYPE
-		   || TYPE_IS_FAT_POINTER_P (t)))
+	       && (TREE_CODE (t) == POINTER_TYPE || TYPE_IS_FAT_POINTER_P (t)))
 	{
 	  tree tt = build_variant_type_copy (t);
 	  TYPE_NAME (tt) = decl;
@@ -905,10 +902,6 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
 	    DECL_ORIGINAL_TYPE (decl) = DECL_ORIGINAL_TYPE (TYPE_NAME (t));
 	  else
 	    DECL_ORIGINAL_TYPE (decl) = t;
-	  /* Array types need to have a name so that they can be related to
-	     their GNAT encodings.  */
-	  if (TREE_CODE (t) == ARRAY_TYPE && !TYPE_NAME (t))
-	    TYPE_NAME (t) = DECL_NAME (decl);
 	  /* Remark the canonical fat pointer type as artificial.  */
 	  if (TYPE_IS_FAT_POINTER_P (t))
 	    TYPE_ARTIFICIAL (t) = 1;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-13 10:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 10:04 [gcc r13-1674] [Ada] Do not generate DW_TAG_typedef for constrained array types Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).