]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Add 'artificial_p' parameter to build_unc_object_type
authorTom Tromey <tromey@adacore.com>
Wed, 10 Jul 2024 17:46:57 +0000 (11:46 -0600)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 25 Oct 2024 09:09:04 +0000 (11:09 +0200)
This adds an 'artificial_p' parameter to build_unc_object_type, so
that the artificiality of the type can be propagated to
create_type_decl.  This will affect the namelessness of the type in a
subsequent patch.

gcc/ada/ChangeLog:

* gcc-interface/decl.cc (gnat_to_gnu_entity): Pass artificial_p to
build_unc_object_type.
* gcc-interface/gigi.h (build_unc_object_type): Update.
* gcc-interface/utils.cc (build_unc_object_type) Add artificial_p
parameter.
(build_unc_object_type_from_ptr): Update.

gcc/ada/gcc-interface/decl.cc
gcc/ada/gcc-interface/gigi.h
gcc/ada/gcc-interface/utils.cc

index aa22c495a1697df3c7361d5e9589515b4e2914bd..14b39b336bd8b498bba024794dea10bb35a96612 100644 (file)
@@ -2496,7 +2496,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
            ? create_concat_name (gnat_name, "XUT")
            : gnu_entity_name;
        obj = build_unc_object_type (gnu_template_type, tem, xut_name,
-                                    debug_info_p);
+                                    artificial_p, debug_info_p);
 
        SET_TYPE_UNCONSTRAINED_ARRAY (obj, gnu_type);
        TYPE_OBJECT_RECORD_TYPE (gnu_type) = obj;
index f4b302be3e0bff2e8861ab5cd019e1fe5cf5b158..00f00d967c7370bb56a7a31994f7ec3711c8b7b5 100644 (file)
@@ -742,10 +742,13 @@ extern tree build_template (tree template_type, tree array_type, tree expr);
    is an unconstrained array.  This consists of a RECORD_TYPE containing a
    field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an ARRAY_TYPE.
    If ARRAY_TYPE is that of an unconstrained array, this is used to represent
-   an arbitrary unconstrained object.  Use NAME as the name of the record.
-   DEBUG_INFO_P is true if we need to write debug information for the type.  */
+   an arbitrary unconstrained object.  Use NAME as the name of the
+   record.  ARTIFICIAL_P is true if the type was generated by the
+   compiler, or false if the type came from source.  DEBUG_INFO_P is
+   true if we need to write debug information for the type.  */
 extern tree build_unc_object_type (tree template_type, tree object_type,
-                                  tree name, bool debug_info_p);
+                                  tree name, bool artificial_p,
+                                  bool debug_info_p);
 
 /* Same as build_unc_object_type, but taking a thin or fat pointer type
    instead of the template type.  */
index 951d3848d09bacd137d1f48e245d9de2bea941af..9e2715a8d81ff4b1959e5daf11f450bb5b6d16c0 100644 (file)
@@ -4465,12 +4465,14 @@ build_vector_type_for_array (tree array_type, tree attribute)
    is an unconstrained array.  This consists of a RECORD_TYPE containing a
    field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an ARRAY_TYPE.
    If ARRAY_TYPE is that of an unconstrained array, this is used to represent
-   an arbitrary unconstrained object.  Use NAME as the name of the record.
-   DEBUG_INFO_P is true if we need to write debug information for the type.  */
+   an arbitrary unconstrained object.  Use NAME as the name of the
+   record.  ARTIFICIAL_P is true if the type was generated by the
+   compiler, or false if the type came from source.  DEBUG_INFO_P is
+   true if we need to write debug information for the type.  */
 
 tree
 build_unc_object_type (tree template_type, tree object_type, tree name,
-                      bool debug_info_p)
+                      bool artificial_p, bool debug_info_p)
 {
   tree type = make_node (RECORD_TYPE);
   tree template_field
@@ -4487,7 +4489,7 @@ build_unc_object_type (tree template_type, tree object_type, tree name,
 
   /* Declare it now since it will never be declared otherwise.  This is
      necessary to ensure that its subtrees are properly marked.  */
-  create_type_decl (name, type, true, debug_info_p, Empty);
+  create_type_decl (name, type, artificial_p, debug_info_p, Empty);
 
   return type;
 }
@@ -4508,7 +4510,8 @@ build_unc_object_type_from_ptr (tree thin_fat_ptr_type, tree object_type,
        : TREE_TYPE (TYPE_FIELDS (TREE_TYPE (thin_fat_ptr_type))));
 
   return
-    build_unc_object_type (template_type, object_type, name, debug_info_p);
+    build_unc_object_type (template_type, object_type, name, true,
+                          debug_info_p);
 }
 
 /* Update anything previously pointing to OLD_TYPE to point to NEW_TYPE.