]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* dwarf2out.c (modified_type_die): Set DW_AT_GNAT_descriptive_type and
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Feb 2012 18:28:41 +0000 (18:28 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Feb 2012 18:28:41 +0000 (18:28 +0000)
DW_AT_artificial attributes at the end of the processing.
(gen_array_type_die): Likewise.
(gen_enumeration_type_die): Likewise.
(gen_struct_or_union_type_die): Likewise.
(add_gnat_descriptive_type_attribute): Do not suppress debug info for
the parent type.
ada/
* gcc-interface/decl.c (components_to_record): Add ARTIFICIAL parameter
and set TYPE_ARTIFICIAL according to it.  Adjust recursive call.
(gnat_to_gnu_entity) <E_Record_Type>: Adjust call to above function.
* gcc-interface/utils.c (rest_of_record_type_compilation): Do not
invoke rest_of_type_decl_compilation on the parallel type, if any.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184667 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c
gcc/ada/gcc-interface/utils.c
gcc/dwarf2out.c

index 8de6c89ae00a54f7d708552e9fcb5d3382c4db0c..1b781138362341e7ee37bdfbe28580b08a818c03 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-29  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * dwarf2out.c (modified_type_die): Set DW_AT_GNAT_descriptive_type and
+       DW_AT_artificial attributes at the end of the processing.
+       (gen_array_type_die): Likewise.
+       (gen_enumeration_type_die): Likewise.
+       (gen_struct_or_union_type_die): Likewise.
+       (add_gnat_descriptive_type_attribute): Do not suppress debug info for
+       the parent type.
+
 2012-02-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/52419
index 6303fb8e05f4f6c795b426868abdf5cc5bbad1c9..e586354c32a29bafb6a007be163cd4926efc0fc3 100644 (file)
@@ -1,3 +1,11 @@
+2012-02-29  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/decl.c (components_to_record): Add ARTIFICIAL parameter
+       and set TYPE_ARTIFICIAL according to it.  Adjust recursive call.
+       (gnat_to_gnu_entity) <E_Record_Type>: Adjust call to above function.
+       * gcc-interface/utils.c (rest_of_record_type_compilation): Do not
+       invoke rest_of_type_decl_compilation on the parallel type, if any.
+
 2012-02-29  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/utils.c (gnat_write_global_declarations): Make sure the
index 80ad5a3fdbb5c264d66d5f52eb89384b82ff733e..5b6d2f78eee7fd27497b97b67f4a05421e65b9dc 100644 (file)
@@ -160,7 +160,7 @@ static bool compile_time_known_address_p (Node_Id);
 static bool cannot_be_superflat_p (Node_Id);
 static bool constructor_address_p (tree);
 static void components_to_record (tree, Node_Id, tree, int, bool, bool, bool,
-                                 bool, bool, bool, bool, tree, tree *);
+                                 bool, bool, bool, bool, bool, tree, tree *);
 static Uint annotate_value (tree);
 static void annotate_rep (Entity_Id, tree);
 static tree build_position_list (tree, bool, tree, tree, unsigned int, tree);
@@ -3128,7 +3128,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
        /* Add the fields into the record type and finish it up.  */
        components_to_record (gnu_type, Component_List (record_definition),
                              gnu_field_list, packed, definition, false,
-                             all_rep, is_unchecked_union, debug_info_p,
+                             all_rep, is_unchecked_union,
+                             !Comes_From_Source (gnat_entity), debug_info_p,
                              false, OK_To_Reorder_Components (gnat_entity),
                              all_rep ? NULL_TREE : bitsize_zero_node, NULL);
 
@@ -7275,6 +7276,8 @@ compare_field_bitpos (const PTR rt1, const PTR rt2)
    UNCHECKED_UNION is true if we are building this type for a record with a
    Pragma Unchecked_Union.
 
+   ARTIFICIAL is true if this is a type that was generated by the compiler.
+
    DEBUG_INFO is true if we need to write debug information about the type.
 
    MAYBE_UNUSED is true if this type may be unused in the end; this doesn't
@@ -7294,8 +7297,8 @@ static void
 components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
                      tree gnu_field_list, int packed, bool definition,
                      bool cancel_alignment, bool all_rep,
-                     bool unchecked_union, bool debug_info,
-                     bool maybe_unused, bool reorder,
+                     bool unchecked_union, bool artificial,
+                     bool debug_info, bool maybe_unused, bool reorder,
                      tree first_free_pos, tree *p_gnu_rep_list)
 {
   bool all_rep_and_size = all_rep && TYPE_SIZE (gnu_record_type);
@@ -7464,7 +7467,8 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
          components_to_record (gnu_variant_type, Component_List (variant),
                                NULL_TREE, packed, definition,
                                !all_rep_and_size, all_rep, unchecked_union,
-                               debug_info, true, reorder, this_first_free_pos,
+                               true, debug_info, true, reorder,
+                               this_first_free_pos,
                                all_rep || this_first_free_pos
                                ? NULL : &gnu_rep_list);
 
@@ -7706,7 +7710,10 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
     TYPE_ALIGN (gnu_record_type) = 0;
 
   finish_record_type (gnu_record_type, nreverse (gnu_field_list),
-                     layout_with_rep ? 1 : 0, debug_info && !maybe_unused);
+                     layout_with_rep ? 1 : 0, false);
+  TYPE_ARTIFICIAL (gnu_record_type) = artificial;
+  if (debug_info && !maybe_unused)
+    rest_of_record_type_compilation (gnu_record_type);
 }
 \f
 /* Given GNU_SIZE, a GCC tree representing a size, return a Uint to be
index ab405db814ef509c908ada2cbd1df712fbfc0152..062df3a8f55ad9231dd42def0ea4b122f820f9ca 100644 (file)
@@ -918,8 +918,6 @@ rest_of_record_type_compilation (tree record_type)
       TYPE_SIZE_UNIT (new_record_type)
        = size_int (TYPE_ALIGN (record_type) / BITS_PER_UNIT);
 
-      add_parallel_type (TYPE_STUB_DECL (record_type), new_record_type);
-
       /* Now scan all the fields, replacing each field with a new
         field corresponding to the new encoding.  */
       for (old_field = TYPE_FIELDS (record_type); old_field;
@@ -1058,7 +1056,12 @@ rest_of_record_type_compilation (tree record_type)
       TYPE_FIELDS (new_record_type)
        = nreverse (TYPE_FIELDS (new_record_type));
 
-      rest_of_type_decl_compilation (TYPE_STUB_DECL (new_record_type));
+      /* We used to explicitly invoke rest_of_type_decl_compilation on the
+        parallel type for the sake of STABS.  We don't do it any more, so
+        as to ensure that the parallel type be processed after the type
+        by the debug back-end and, thus, prevent it from interfering with
+        the processing of a recursive type.  */
+      add_parallel_type (TYPE_STUB_DECL (record_type), new_record_type);
     }
 
   rest_of_type_decl_compilation (TYPE_STUB_DECL (record_type));
index 5c7d8aabadc9c5096615ecfb47b28f39eb2d4e7f..63c46c00ea04bd5e53970055f15ad338871eba9a 100644 (file)
@@ -9929,9 +9929,6 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type,
           useful source coordinates anyway.  */
        name = DECL_NAME (name);
       add_name_attribute (mod_type_die, IDENTIFIER_POINTER (name));
-      add_gnat_descriptive_type_attribute (mod_type_die, type, context_die);
-      if (TYPE_ARTIFICIAL (type))
-       add_AT_flag (mod_type_die, DW_AT_artificial, 1);
     }
   /* This probably indicates a bug.  */
   else if (mod_type_die && mod_type_die->die_tag == DW_TAG_base_type)
@@ -9960,6 +9957,10 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type,
   if (sub_die != NULL)
     add_AT_die_ref (mod_type_die, DW_AT_type, sub_die);
 
+  add_gnat_descriptive_type_attribute (mod_type_die, type, context_die);
+  if (TYPE_ARTIFICIAL (type))
+    add_AT_flag (mod_type_die, DW_AT_artificial, 1);
+
   return mod_type_die;
 }
 
@@ -15493,11 +15494,7 @@ add_gnat_descriptive_type_attribute (dw_die_ref die, tree type,
   dtype_die = lookup_type_die (dtype);
   if (!dtype_die)
     {
-      /* The descriptive type indirectly references TYPE if this is also the
-        case for TYPE itself.  Do not deal with the circularity here.  */
-      TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (type)) = 1;
       gen_type_die (dtype, context_die);
-      TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (type)) = 0;
       dtype_die = lookup_type_die (dtype);
       gcc_assert (dtype_die);
     }
@@ -16384,9 +16381,6 @@ gen_array_type_die (tree type, dw_die_ref context_die)
 
   array_die = new_die (DW_TAG_array_type, scope_die, type);
   add_name_attribute (array_die, type_tag (type));
-  add_gnat_descriptive_type_attribute (array_die, type, context_die);
-  if (TYPE_ARTIFICIAL (type))
-    add_AT_flag (array_die, DW_AT_artificial, 1);
   equate_type_number_to_die (type, array_die);
 
   if (TREE_CODE (type) == VECTOR_TYPE)
@@ -16446,6 +16440,10 @@ gen_array_type_die (tree type, dw_die_ref context_die)
 
   add_type_attribute (array_die, element_type, 0, 0, context_die);
 
+  add_gnat_descriptive_type_attribute (array_die, type, context_die);
+  if (TYPE_ARTIFICIAL (type))
+    add_AT_flag (array_die, DW_AT_artificial, 1);
+
   if (get_AT (array_die, DW_AT_name))
     add_pubtype (type, array_die);
 }
@@ -16689,9 +16687,6 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die)
                          scope_die_for (type, context_die), type);
       equate_type_number_to_die (type, type_die);
       add_name_attribute (type_die, type_tag (type));
-      add_gnat_descriptive_type_attribute (type_die, type, context_die);
-      if (TYPE_ARTIFICIAL (type))
-       add_AT_flag (type_die, DW_AT_artificial, 1);
       if (dwarf_version >= 4 || !dwarf_strict)
        {
          if (ENUM_IS_SCOPED (type))
@@ -16747,6 +16742,10 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die)
            add_AT_int (enum_die, DW_AT_const_value,
                        tree_low_cst (value, tree_int_cst_sgn (value) > 0));
        }
+
+      add_gnat_descriptive_type_attribute (type_die, type, context_die);
+      if (TYPE_ARTIFICIAL (type))
+       add_AT_flag (type_die, DW_AT_artificial, 1);
     }
   else
     add_AT_flag (type_die, DW_AT_declaration, 1);
@@ -18659,12 +18658,7 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_die,
       if (old_die)
        add_AT_specification (type_die, old_die);
       else
-       {
-         add_name_attribute (type_die, type_tag (type));
-         add_gnat_descriptive_type_attribute (type_die, type, context_die);
-         if (TYPE_ARTIFICIAL (type))
-           add_AT_flag (type_die, DW_AT_artificial, 1);
-       }
+       add_name_attribute (type_die, type_tag (type));
     }
   else
     remove_AT (type_die, DW_AT_declaration);
@@ -18697,6 +18691,10 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_die,
       gen_member_die (type, type_die);
       pop_decl_scope ();
 
+      add_gnat_descriptive_type_attribute (type_die, type, context_die);
+      if (TYPE_ARTIFICIAL (type))
+       add_AT_flag (type_die, DW_AT_artificial, 1);
+
       /* GNU extension: Record what type our vtable lives in.  */
       if (TYPE_VFIELD (type))
        {