aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c58
1 files changed, 32 insertions, 26 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index d568dff..db38701 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -239,17 +239,24 @@ static tree convert_to_fat_pointer (tree, tree);
static unsigned int scale_by_factor_of (tree, unsigned int);
static bool potential_alignment_gap (tree, tree, tree);
-/* A linked list used as a queue to defer the initialization of the
- DECL_CONTEXT attribute of ..._DECL nodes and of the TYPE_CONTEXT attribute
- of ..._TYPE nodes. */
+/* Linked list used as a queue to defer the initialization of the DECL_CONTEXT
+ of ..._DECL nodes and of the TYPE_CONTEXT of ..._TYPE nodes. */
struct deferred_decl_context_node
{
- tree decl; /* The ..._DECL node to work on. */
- Entity_Id gnat_scope; /* The corresponding entity's Scope attribute. */
- int force_global; /* force_global value when pushing DECL. */
- vec<tree, va_heap, vl_ptr> types; /* A list of ..._TYPE nodes to propagate the
- context to. */
- struct deferred_decl_context_node *next; /* The next queue item. */
+ /* The ..._DECL node to work on. */
+ tree decl;
+
+ /* The corresponding entity's Scope. */
+ Entity_Id gnat_scope;
+
+ /* The value of force_global when DECL was pushed. */
+ int force_global;
+
+ /* The list of ..._TYPE nodes to propagate the context to. */
+ vec<tree> types;
+
+ /* The next queue item. */
+ struct deferred_decl_context_node *next;
};
static struct deferred_decl_context_node *deferred_decl_context_queue = NULL;
@@ -1217,7 +1224,8 @@ lookup_and_insert_pad_type (tree type)
IS_COMPONENT_TYPE is true if this is being done for the component type of
an array. IS_USER_TYPE is true if the original type needs to be completed.
DEFINITION is true if this type is being defined. SET_RM_SIZE is true if
- the RM size of the resulting type is to be set to SIZE too. */
+ the RM size of the resulting type is to be set to SIZE too; in this case,
+ the padded type is canonicalized before being returned. */
tree
maybe_pad_type (tree type, tree size, unsigned int align,
@@ -1280,8 +1288,6 @@ maybe_pad_type (tree type, tree size, unsigned int align,
type and name. */
record = make_node (RECORD_TYPE);
TYPE_PADDING_P (record) = 1;
- if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
- SET_TYPE_DEBUG_TYPE (record, type);
/* ??? Padding types around packed array implementation types will be
considered as root types in the array descriptor language hook (see
@@ -1337,9 +1343,12 @@ maybe_pad_type (tree type, tree size, unsigned int align,
bitsize_zero_node, 0, 1);
DECL_INTERNAL_P (field) = 1;
- /* Do not emit debug info until after the auxiliary record is built. */
+ /* We will output additional debug info manually below. */
finish_record_type (record, field, 1, false);
+ if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
+ SET_TYPE_DEBUG_TYPE (record, type);
+
/* Set the RM size if requested. */
if (set_rm_size)
{
@@ -1409,8 +1418,6 @@ maybe_pad_type (tree type, tree size, unsigned int align,
}
}
- rest_of_record_type_compilation (record);
-
built:
/* If a simple size was explicitly given, maybe issue a warning. */
if (!size
@@ -1672,7 +1679,7 @@ finish_fat_pointer_type (tree record_type, tree field_list)
laid out already; only set the sizes and alignment. If REP_LEVEL is two,
this record is derived from a parent record and thus inherits its layout;
only make a pass on the fields to finalize them. DEBUG_INFO_P is true if
- we need to write debug information about this type. */
+ additional debug info needs to be output for this type. */
void
finish_record_type (tree record_type, tree field_list, int rep_level,
@@ -1927,10 +1934,9 @@ has_parallel_type (tree type)
return DECL_PARALLEL_TYPE (decl) != NULL_TREE;
}
-/* Wrap up compilation of RECORD_TYPE, i.e. output all the debug information
- associated with it. It need not be invoked directly in most cases since
- finish_record_type takes care of doing so, but this can be necessary if
- a parallel type is to be attached to the record type. */
+/* Wrap up compilation of RECORD_TYPE, i.e. output additional debug info
+ associated with it. It need not be invoked directly in most cases as
+ finish_record_type takes care of doing so. */
void
rest_of_record_type_compilation (tree record_type)
@@ -2072,7 +2078,7 @@ rest_of_record_type_compilation (tree record_type)
field_type = build_pointer_type (field_type);
if (align != 0 && TYPE_ALIGN (field_type) > align)
{
- field_type = copy_node (field_type);
+ field_type = copy_type (field_type);
SET_TYPE_ALIGN (field_type, align);
}
var = true;
@@ -2284,10 +2290,10 @@ copy_type (tree type)
aliased with TREE_CHAIN. */
TYPE_STUB_DECL (new_type) = TYPE_STUB_DECL (type);
- TYPE_POINTER_TO (new_type) = 0;
- TYPE_REFERENCE_TO (new_type) = 0;
+ TYPE_POINTER_TO (new_type) = NULL_TREE;
+ TYPE_REFERENCE_TO (new_type) = NULL_TREE;
TYPE_MAIN_VARIANT (new_type) = new_type;
- TYPE_NEXT_VARIANT (new_type) = 0;
+ TYPE_NEXT_VARIANT (new_type) = NULL_TREE;
TYPE_CANONICAL (new_type) = new_type;
return new_type;
@@ -3431,14 +3437,14 @@ gnat_signed_or_unsigned_type_for (int unsignedp, tree type_node)
if (TREE_CODE (type_node) == INTEGER_TYPE && TYPE_MODULAR_P (type_node))
{
- type = copy_node (type);
+ type = copy_type (type);
TREE_TYPE (type) = type_node;
}
else if (TREE_TYPE (type_node)
&& TREE_CODE (TREE_TYPE (type_node)) == INTEGER_TYPE
&& TYPE_MODULAR_P (TREE_TYPE (type_node)))
{
- type = copy_node (type);
+ type = copy_type (type);
TREE_TYPE (type) = TREE_TYPE (type_node);
}