aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-07-10 11:46:57 -0600
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-10-25 11:09:04 +0200
commitb857742bc8b675073b5c2ab7687ce09a42789ead (patch)
tree6f835fd14dc8e64ec8c6b7319c210248d643d7b6 /gcc
parentc895db1080349d230a2c23f544905b4c703a5ee4 (diff)
downloadgcc-b857742bc8b675073b5c2ab7687ce09a42789ead.zip
gcc-b857742bc8b675073b5c2ab7687ce09a42789ead.tar.gz
gcc-b857742bc8b675073b5c2ab7687ce09a42789ead.tar.bz2
ada: Add 'artificial_p' parameter to build_unc_object_type
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/gcc-interface/decl.cc2
-rw-r--r--gcc/ada/gcc-interface/gigi.h9
-rw-r--r--gcc/ada/gcc-interface/utils.cc13
3 files changed, 15 insertions, 9 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index aa22c49..14b39b3 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -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;
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h
index f4b302b..00f00d9 100644
--- a/gcc/ada/gcc-interface/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -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. */
diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index 951d384..9e2715a 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -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.