Commit 1aeb40dd by Eric Botcazou Committed by Eric Botcazou

gigi.h (record_builtin_type): Add ARTIFICIAL_P param.

	* gcc-interface/gigi.h (record_builtin_type): Add ARTIFICIAL_P param.
	* gcc-interface/utils.c (gnat_pushdecl): If this is a non-artificial
	declaration of an array type, then set DECL_ORIGINAL_TYPE to a distinct
	copy.
	(record_builtin_type): Add ARTIFICIAL_P parameter.  Set DECL_ARTIFICIAL
	flag of the type accordingly.
	* gcc-interface/trans.c (gigi): Adjust calls to record_builtin_type.

From-SVN: r171880
parent 80ec8b4c
2011-04-02 Eric Botcazou <ebotcazou@adacore.com> 2011-04-02 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (record_builtin_type): Add ARTIFICIAL_P param.
* gcc-interface/utils.c (gnat_pushdecl): If this is a non-artificial
declaration of an array type, then set DECL_ORIGINAL_TYPE to a distinct
copy.
(record_builtin_type): Add ARTIFICIAL_P parameter. Set DECL_ARTIFICIAL
flag of the type accordingly.
* gcc-interface/trans.c (gigi): Adjust calls to record_builtin_type.
2011-04-02 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Access_Type>: Defer * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Access_Type>: Defer
finalizing types when updating the pointers to the designated type. finalizing types when updating the pointers to the designated type.
<all>: Finalize the deferred types even if we didn't defer processing <all>: Finalize the deferred types even if we didn't defer processing
......
...@@ -504,8 +504,10 @@ extern void init_dummy_type (void); ...@@ -504,8 +504,10 @@ extern void init_dummy_type (void);
/* Make a dummy type corresponding to GNAT_TYPE. */ /* Make a dummy type corresponding to GNAT_TYPE. */
extern tree make_dummy_type (Entity_Id gnat_type); extern tree make_dummy_type (Entity_Id gnat_type);
/* Record TYPE as a builtin type for Ada. NAME is the name of the type. */ /* Record TYPE as a builtin type for Ada. NAME is the name of the type.
extern void record_builtin_type (const char *name, tree type); ARTIFICIAL_P is true if it's a type that was generated by the compiler. */
extern void record_builtin_type (const char *name, tree type,
bool artificial_p);
/* Given a record type RECORD_TYPE and a list of FIELD_DECL nodes FIELD_LIST, /* Given a record type RECORD_TYPE and a list of FIELD_DECL nodes FIELD_LIST,
finish constructing the record or union type. If REP_LEVEL is zero, this finish constructing the record or union type. If REP_LEVEL is zero, this
......
...@@ -308,10 +308,10 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -308,10 +308,10 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
/* Record the builtin types. Define `integer' and `character' first so that /* Record the builtin types. Define `integer' and `character' first so that
dbx will output them first. */ dbx will output them first. */
record_builtin_type ("integer", integer_type_node); record_builtin_type ("integer", integer_type_node, false);
record_builtin_type ("character", unsigned_char_type_node); record_builtin_type ("character", unsigned_char_type_node, false);
record_builtin_type ("boolean", boolean_type_node); record_builtin_type ("boolean", boolean_type_node, false);
record_builtin_type ("void", void_type_node); record_builtin_type ("void", void_type_node, false);
/* Save the type we made for integer as the type for Standard.Integer. */ /* Save the type we made for integer as the type for Standard.Integer. */
save_gnu_tree (Base_Type (standard_integer), save_gnu_tree (Base_Type (standard_integer),
...@@ -397,7 +397,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -397,7 +397,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
jmpbuf_type jmpbuf_type
= build_array_type (gnat_type_for_mode (Pmode, 0), = build_array_type (gnat_type_for_mode (Pmode, 0),
build_index_type (size_int (5))); build_index_type (size_int (5)));
record_builtin_type ("JMPBUF_T", jmpbuf_type); record_builtin_type ("JMPBUF_T", jmpbuf_type, true);
jmpbuf_ptr_type = build_pointer_type (jmpbuf_type); jmpbuf_ptr_type = build_pointer_type (jmpbuf_type);
/* Functions to get and set the jumpbuf pointer for the current thread. */ /* Functions to get and set the jumpbuf pointer for the current thread. */
...@@ -552,7 +552,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -552,7 +552,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
} }
finish_record_type (fdesc_type_node, nreverse (field_list), 0, false); finish_record_type (fdesc_type_node, nreverse (field_list), 0, false);
record_builtin_type ("descriptor", fdesc_type_node); record_builtin_type ("descriptor", fdesc_type_node, true);
null_fdesc_node = gnat_build_constructor (fdesc_type_node, null_vec); null_fdesc_node = gnat_build_constructor (fdesc_type_node, null_vec);
} }
...@@ -566,7 +566,8 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -566,7 +566,8 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
longest_float_type_node = make_node (REAL_TYPE); longest_float_type_node = make_node (REAL_TYPE);
TYPE_PRECISION (longest_float_type_node) = LONG_DOUBLE_TYPE_SIZE; TYPE_PRECISION (longest_float_type_node) = LONG_DOUBLE_TYPE_SIZE;
layout_type (longest_float_type_node); layout_type (longest_float_type_node);
record_builtin_type ("longest float type", longest_float_type_node); record_builtin_type ("longest float type", longest_float_type_node,
false);
} }
else else
longest_float_type_node = TREE_TYPE (long_long_float_type); longest_float_type_node = TREE_TYPE (long_long_float_type);
......
...@@ -508,7 +508,18 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) ...@@ -508,7 +508,18 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
tree t = TREE_TYPE (decl); tree t = TREE_TYPE (decl);
if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)) if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL))
; {
/* Array types aren't tagged types in the C sense so we force the
type to be associated with its typedef in the DWARF back-end,
in order to make sure that the latter is always preserved. */
if (!DECL_ARTIFICIAL (decl) && TREE_CODE (t) == ARRAY_TYPE)
{
tree tt = build_distinct_type_copy (t);
TYPE_NAME (tt) = DECL_NAME (decl);
TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (t);
DECL_ORIGINAL_TYPE (decl) = tt;
}
}
else if (TYPE_IS_FAT_POINTER_P (t)) else if (TYPE_IS_FAT_POINTER_P (t))
{ {
tree tt = build_variant_type_copy (t); tree tt = build_variant_type_copy (t);
...@@ -535,14 +546,15 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) ...@@ -535,14 +546,15 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
} }
} }
/* Record TYPE as a builtin type for Ada. NAME is the name of the type. */ /* Record TYPE as a builtin type for Ada. NAME is the name of the type.
ARTIFICIAL_P is true if it's a type that was generated by the compiler. */
void void
record_builtin_type (const char *name, tree type) record_builtin_type (const char *name, tree type, bool artificial_p)
{ {
tree type_decl = build_decl (input_location, tree type_decl = build_decl (input_location,
TYPE_DECL, get_identifier (name), type); TYPE_DECL, get_identifier (name), type);
DECL_ARTIFICIAL (type_decl) = artificial_p;
gnat_pushdecl (type_decl, Empty); gnat_pushdecl (type_decl, Empty);
if (debug_hooks->type_decl) if (debug_hooks->type_decl)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment