From 1aeb40dd6d0e8d5a62d25679fa6b0533d72fd4dd Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 2 Apr 2011 08:28:21 +0000 Subject: 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 --- gcc/ada/gcc-interface/utils.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'gcc/ada/gcc-interface/utils.c') diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 2cfd1ce..78d5506 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -508,7 +508,18 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) 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); @@ -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 -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) -- cgit v1.1