* 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
+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
/* Make a dummy type corresponding to 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. */
-extern void record_builtin_type (const char *name, tree 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. */
+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,
finish constructing the record or union type. If REP_LEVEL is zero, this
/* Record the builtin types. Define `integer' and `character' first so that
dbx will output them first. */
- record_builtin_type ("integer", integer_type_node);
- record_builtin_type ("character", unsigned_char_type_node);
- record_builtin_type ("boolean", boolean_type_node);
- record_builtin_type ("void", void_type_node);
+ record_builtin_type ("integer", integer_type_node, false);
+ record_builtin_type ("character", unsigned_char_type_node, false);
+ record_builtin_type ("boolean", boolean_type_node, false);
+ record_builtin_type ("void", void_type_node, false);
/* Save the type we made for integer as the type for Standard.Integer. */
save_gnu_tree (Base_Type (standard_integer),
jmpbuf_type
= build_array_type (gnat_type_for_mode (Pmode, 0),
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);
/* Functions to get and set the jumpbuf pointer for the current thread. */
}
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);
}
longest_float_type_node = make_node (REAL_TYPE);
TYPE_PRECISION (longest_float_type_node) = LONG_DOUBLE_TYPE_SIZE;
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
longest_float_type_node = TREE_TYPE (long_long_float_type);
tree t = TREE_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))
{
tree tt = build_variant_type_copy (t);
}
}
\f
-/* 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
-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,
TYPE_DECL, get_identifier (name), type);
-
+ DECL_ARTIFICIAL (type_decl) = artificial_p;
gnat_pushdecl (type_decl, Empty);
if (debug_hooks->type_decl)