aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.cc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-12-12 09:21:14 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-01-09 14:13:32 +0100
commit63da219a948a4d9f98f5a0d23e9c19fe48bc0734 (patch)
treecb46975dded6a47d64da8f4f43bc9166898d175e /gcc/ada/gcc-interface/decl.cc
parent9b7d674fadd07aed242711e91232dbd049ef35be (diff)
downloadgcc-63da219a948a4d9f98f5a0d23e9c19fe48bc0734.zip
gcc-63da219a948a4d9f98f5a0d23e9c19fe48bc0734.tar.gz
gcc-63da219a948a4d9f98f5a0d23e9c19fe48bc0734.tar.bz2
ada: Preliminary cleanup in aliasing support code
This declares an explicit temporary for the fields of the fat pointer type in gnat_to_gnu_entity and removes the GNU_ prefix of the parameters of the relate_alias_sets routine for the sake of brevity. No functional changes. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Type>: Use a separate FLD local variable to hold the first field of the fat pointer type being built. * gcc-interface/gigi.h (relate_alias_sets): Remove GNU_ prefix on the first two parameters. * gcc-interface/utils.cc (relate_alias_sets): Likewise and adjust.
Diffstat (limited to 'gcc/ada/gcc-interface/decl.cc')
-rw-r--r--gcc/ada/gcc-interface/decl.cc27
1 files changed, 13 insertions, 14 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 89a374f..221baeb 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -2111,7 +2111,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
tree *gnu_index_types = XALLOCAVEC (tree, ndim);
tree *gnu_temp_fields = XALLOCAVEC (tree, ndim);
tree gnu_max_size = size_one_node;
- tree comp_type, tem, obj;
+ tree comp_type, fld, tem, obj;
Entity_Id gnat_index;
alias_set_type ptr_set = -1;
int index;
@@ -2184,11 +2184,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
if the FIELD_DECLs are distinct as objects. */
if (COMPLETE_TYPE_P (gnu_fat_type))
{
- tem = TYPE_FIELDS (gnu_fat_type);
- if (TYPE_ALIAS_SET_KNOWN_P (TREE_TYPE (tem)))
- ptr_set = TYPE_ALIAS_SET (TREE_TYPE (tem));
- TREE_TYPE (tem) = ptr_type_node;
- TREE_TYPE (DECL_CHAIN (tem)) = gnu_ptr_template;
+ fld = TYPE_FIELDS (gnu_fat_type);
+ if (TYPE_ALIAS_SET_KNOWN_P (TREE_TYPE (fld)))
+ ptr_set = TYPE_ALIAS_SET (TREE_TYPE (fld));
+ TREE_TYPE (fld) = ptr_type_node;
+ TREE_TYPE (DECL_CHAIN (fld)) = gnu_ptr_template;
TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (gnu_fat_type)) = 0;
for (tree t = gnu_fat_type; t; t = TYPE_NEXT_VARIANT (t))
SET_TYPE_UNCONSTRAINED_ARRAY (t, gnu_type);
@@ -2197,15 +2197,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
{
/* We make the fields addressable for the sake of compatibility
with languages for which the regular fields are addressable. */
- tem
+ fld
= create_field_decl (get_identifier ("P_ARRAY"),
ptr_type_node, gnu_fat_type,
NULL_TREE, NULL_TREE, 0, 1);
- DECL_CHAIN (tem)
+ DECL_CHAIN (fld)
= create_field_decl (get_identifier ("P_BOUNDS"),
gnu_ptr_template, gnu_fat_type,
NULL_TREE, NULL_TREE, 0, 1);
- finish_fat_pointer_type (gnu_fat_type, tem);
+ finish_fat_pointer_type (gnu_fat_type, fld);
SET_TYPE_UNCONSTRAINED_ARRAY (gnu_fat_type, gnu_type);
}
@@ -2230,7 +2230,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
fields once we build them. */
tem = build3 (COMPONENT_REF, gnu_ptr_template,
build0 (PLACEHOLDER_EXPR, gnu_fat_type),
- DECL_CHAIN (TYPE_FIELDS (gnu_fat_type)), NULL_TREE);
+ DECL_CHAIN (fld), NULL_TREE);
gnu_template_reference
= build_unary_op (INDIRECT_REF, gnu_template_type, tem);
TREE_READONLY (gnu_template_reference) = 1;
@@ -2413,12 +2413,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
type since the implementation type may vary between constrained
subtypes and unconstrained base type. */
if (Present (PAT))
- TREE_TYPE (TYPE_FIELDS (gnu_fat_type))
- = build_pointer_type_for_mode (tem, ptr_mode, true);
+ TREE_TYPE (fld) = build_pointer_type_for_mode (tem, ptr_mode, true);
else
- TREE_TYPE (TYPE_FIELDS (gnu_fat_type)) = build_pointer_type (tem);
+ TREE_TYPE (fld) = build_pointer_type (tem);
if (ptr_set != -1)
- TYPE_ALIAS_SET (TREE_TYPE (TYPE_FIELDS (gnu_fat_type))) = ptr_set;
+ TYPE_ALIAS_SET (TREE_TYPE (fld)) = ptr_set;
/* If the maximum size doesn't overflow, use it. */
if (gnu_max_size