From: Eric Botcazou Date: Sat, 2 Apr 2011 08:28:21 +0000 (+0000) Subject: gigi.h (record_builtin_type): Add ARTIFICIAL_P param. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1aeb40dd6d0e8d5a62d25679fa6b0533d72fd4dd;p=gcc.git 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e4928c4b4bb..4e109b48f17 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2011-04-02 Eric Botcazou + + * 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 * gcc-interface/decl.c (gnat_to_gnu_entity) : Defer diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h index a50010cb6e3..fbf8a0b59e6 100644 --- a/gcc/ada/gcc-interface/gigi.h +++ b/gcc/ada/gcc-interface/gigi.h @@ -504,8 +504,10 @@ extern void init_dummy_type (void); /* 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 diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 332f715f457..cca9523e760 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -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 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), @@ -397,7 +397,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, 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. */ @@ -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); - 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); } @@ -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); 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); diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 2cfd1ce4997..78d5506259d 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)