aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-04-02 08:28:21 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-04-02 08:28:21 +0000
commit1aeb40dd6d0e8d5a62d25679fa6b0533d72fd4dd (patch)
treed56f7d3a44278a2ed83858803463e8d2b84bb2c4 /gcc/ada/gcc-interface/utils.c
parent80ec8b4cf19ac985c95e2a222d84e48324cb8994 (diff)
downloadgcc-1aeb40dd6d0e8d5a62d25679fa6b0533d72fd4dd.zip
gcc-1aeb40dd6d0e8d5a62d25679fa6b0533d72fd4dd.tar.gz
gcc-1aeb40dd6d0e8d5a62d25679fa6b0533d72fd4dd.tar.bz2
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
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c20
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)