aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <derodat@adacore.com>2017-09-09 13:05:40 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2017-09-09 13:05:40 +0000
commit95b7c2e0c5439e4e9904c5bc4d78e553a4e802c7 (patch)
tree88b17edddeafc6a440d4364ca02b928d737f82fe /gcc/ada
parenta713e7bb72617e88e9b2b64cecaffae7499146fb (diff)
downloadgcc-95b7c2e0c5439e4e9904c5bc4d78e553a4e802c7.zip
gcc-95b7c2e0c5439e4e9904c5bc4d78e553a4e802c7.tar.gz
gcc-95b7c2e0c5439e4e9904c5bc4d78e553a4e802c7.tar.bz2
decl.c (gnat_to_gnu_entity): Don't generate debug info for inner record types if -fgnat-encodings=minimal.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Don't generate debug info for inner record types if -fgnat-encodings=minimal. (gnat_to_gnu_entity) <E_Record_Subtype>: Use the ultimate base record type as the debug type. From-SVN: r251937
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/gcc-interface/decl.c24
-rw-r--r--gcc/ada/gcc-interface/utils2.c2
3 files changed, 27 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index e929eff..dee1897e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2017-09-09 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Don't
+ generate debug info for inner record types if -fgnat-encodings=minimal.
+ (gnat_to_gnu_entity) <E_Record_Subtype>: Use the ultimate base record
+ type as the debug type.
+
2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (components_to_record): Do not reorder in non-
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 569e64d..7b30497 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -3308,10 +3308,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
= build_subst_list (gnat_entity, gnat_parent_type, definition);
/* Set the layout of the type to match that of the parent type,
- doing required substitutions. */
- copy_and_substitute_in_layout (gnat_entity, gnat_parent_type,
- gnu_type, gnu_parent_type,
- gnu_subst_list, debug_info_p);
+ doing required substitutions. If we are in minimal GNAT
+ encodings mode, we don't need debug info for the inner record
+ types, as they will be part of the embedding variant record's
+ debug info. */
+ copy_and_substitute_in_layout
+ (gnat_entity, gnat_parent_type, gnu_type, gnu_parent_type,
+ gnu_subst_list,
+ debug_info_p && gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL);
}
else
{
@@ -3439,7 +3443,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
gnu_type = make_node (RECORD_TYPE);
TYPE_NAME (gnu_type) = gnu_entity_name;
if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
- SET_TYPE_DEBUG_TYPE (gnu_type, gnu_base_type);
+ {
+ /* Use the ultimate base record type as the debug type.
+ Subtypes and derived types bring no useful
+ information. */
+ Entity_Id gnat_debug_type = gnat_entity;
+ while (Etype (gnat_debug_type) != gnat_debug_type)
+ gnat_debug_type = Etype (gnat_debug_type);
+ tree gnu_debug_type
+ = TYPE_MAIN_VARIANT (gnat_to_gnu_type (gnat_debug_type));
+ SET_TYPE_DEBUG_TYPE (gnu_type, gnu_debug_type);
+ }
TYPE_PACKED (gnu_type) = TYPE_PACKED (gnu_base_type);
TYPE_REVERSE_STORAGE_ORDER (gnu_type)
= Reverse_Storage_Order (gnat_entity);
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index 072e105..6f109c7 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2016, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2017, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *