diff options
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 20 |
1 files changed, 16 insertions, 4 deletions
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) |