aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2010-11-09 11:59:55 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-11-09 11:59:55 +0000
commit98cd3025d4d3204a18f327627a61b6773fd377a5 (patch)
treef3683767b5743cd5036a7a65c1816ad7f965366b /gcc/ada/gcc-interface/decl.c
parentb9cb66d281d279a13ed9628a9046e4523cb677d5 (diff)
downloadgcc-98cd3025d4d3204a18f327627a61b6773fd377a5.zip
gcc-98cd3025d4d3204a18f327627a61b6773fd377a5.tar.gz
gcc-98cd3025d4d3204a18f327627a61b6773fd377a5.tar.bz2
tree.h (contains_placeholder_p): Fix comment.
* tree.h (contains_placeholder_p): Fix comment. (type_contains_placeholder_p): Adjust comment. * tree.c (contains_placeholder_p): Fix comment. (type_contains_placeholder_1): Do not recurse on pointed-to types and adjust comment. (type_contains_placeholder_p): Add comment. ada/ * gcc-interface/decl.c (finish_fat_pointer_type): New function. (gnat_to_gnu_entity) <E_Array_Type>: Use it to build the fat pointer type. <E_Access_Type>: Likewise. From-SVN: r166484
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index b7fe778..c2b8278 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -177,6 +177,7 @@ static tree create_variant_part_from (tree, VEC(variant_desc,heap) *, tree,
tree, VEC(subst_pair,heap) *);
static void copy_and_substitute_in_size (tree, tree, VEC(subst_pair,heap) *);
static void rest_of_type_decl_compilation_no_defer (tree);
+static void finish_fat_pointer_type (tree, tree);
/* The relevant constituents of a subprogram binding to a GCC builtin. Used
to pass around calls performing profile compatibilty checks. */
@@ -188,7 +189,6 @@ typedef struct {
} intrin_binding_t;
static bool intrin_profiles_compatible_p (intrin_binding_t *);
-
/* Given GNAT_ENTITY, a GNAT defining identifier node, which denotes some Ada
entity, return the equivalent GCC tree for that entity (a ..._DECL node)
@@ -1915,23 +1915,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* Build the fat pointer type. Use a "void *" object instead of
a pointer to the array type since we don't have the array type
yet (it will reference the fat pointer via the bounds). */
- tem = chainon (chainon (NULL_TREE,
- create_field_decl (get_identifier ("P_ARRAY"),
- ptr_void_type_node,
- gnu_fat_type, NULL_TREE,
- NULL_TREE, 0, 0)),
- create_field_decl (get_identifier ("P_BOUNDS"),
- gnu_ptr_template,
- gnu_fat_type, NULL_TREE,
- NULL_TREE, 0, 0));
-
- /* Make sure we can put this into a register. */
- TYPE_ALIGN (gnu_fat_type) = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE);
-
- /* Do not emit debug info for this record type since the types of its
- fields are still incomplete at this point. */
- finish_record_type (gnu_fat_type, tem, 0, false);
- TYPE_FAT_POINTER_P (gnu_fat_type) = 1;
+ tem
+ = create_field_decl (get_identifier ("P_ARRAY"), ptr_void_type_node,
+ gnu_fat_type, NULL_TREE, NULL_TREE, 0, 0);
+ TREE_CHAIN (tem)
+ = create_field_decl (get_identifier ("P_BOUNDS"), gnu_ptr_template,
+ gnu_fat_type, NULL_TREE, NULL_TREE, 0, 0);
+ finish_fat_pointer_type (gnu_fat_type, tem);
/* Build a reference to the template from a PLACEHOLDER_EXPR that
is the fat pointer. This will be used to access the individual
@@ -3587,15 +3577,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
= create_field_decl (get_identifier ("P_BOUNDS"),
gnu_ptr_template, gnu_type,
NULL_TREE, NULL_TREE, 0, 0);
-
- /* Make sure we can place this into a register. */
- TYPE_ALIGN (gnu_type)
- = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE);
- TYPE_FAT_POINTER_P (gnu_type) = 1;
-
- /* Do not emit debug info for this record type since the types
- of its fields are incomplete. */
- finish_record_type (gnu_type, fields, 0, false);
+ finish_fat_pointer_type (gnu_type, fields);
TYPE_OBJECT_RECORD_TYPE (gnu_desig_type)
= make_node (RECORD_TYPE);
@@ -5125,6 +5107,28 @@ rest_of_type_decl_compilation_no_defer (tree decl)
}
}
+/* Given a record type RECORD_TYPE and a list of FIELD_DECL nodes FIELD_LIST,
+ finish constructing the record type as a fat pointer type. */
+
+static void
+finish_fat_pointer_type (tree record_type, tree field_list)
+{
+ /* Make sure we can put it into a register. */
+ TYPE_ALIGN (record_type) = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE);
+
+ /* Show what it really is. */
+ TYPE_FAT_POINTER_P (record_type) = 1;
+
+ /* Do not emit debug info for it since the types of its fields may still be
+ incomplete at this point. */
+ finish_record_type (record_type, field_list, 0, false);
+
+ /* Force type_contains_placeholder_p to return true on it. Although the
+ PLACEHOLDER_EXPRs are referenced only indirectly, this isn't a pointer
+ type but the representation of the unconstrained array. */
+ TYPE_CONTAINS_PLACEHOLDER_INTERNAL (record_type) = 2;
+}
+
/* Finalize any From_With_Type incomplete types. We do this after processing
our compilation unit and after processing its spec, if this is a body. */