tree.h (TYPE_ARTIFICIAL): New flag.
authorEric Botcazou <ebotcazou@adacore.com>
Sat, 2 Jul 2011 18:13:47 +0000 (18:13 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sat, 2 Jul 2011 18:13:47 +0000 (18:13 +0000)
* tree.h (TYPE_ARTIFICIAL): New flag.
* dwarf2out.c (modified_type_die): Add a DW_AT_artificial attribute to
the DIE of the type if it is artificial.
(gen_array_type_die): Likewise.
(gen_enumeration_type_die): Likewise.
(gen_struct_or_union_type_die): Likewise.
* lto-streamer-in.c (unpack_ts_base_value_fields): Use TYPE_ARTIFICIAL.
* lto-streamer-out.c (pack_ts_base_value_fields): Likewise.
ada/
* gcc-interface/utils.c (record_builtin_type): Set TYPE_ARTIFICIAL on
the type according to the ARTIFICIAL_P parameter.
(create_type_decl): Likewise.
(create_type_stub_decl): Set TYPE_ARTIFICIAL on the type to 1.

Co-Authored-By: Nicolas Setton <setton@adacore.com>
Co-Authored-By: Olivier Hainque <hainque@adacore.com>
From-SVN: r175781

gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils.c
gcc/dwarf2out.c
gcc/lto-streamer-in.c
gcc/lto-streamer-out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/specs/debug1.ads [new file with mode: 0644]
gcc/tree.h

index 90433ee59b100a8ccfe9bb893f8d6bf6f720c554..63f2bd39eb8aeef4032eda089f168f79d67c246a 100644 (file)
@@ -1,3 +1,16 @@
+2011-07-02  Eric Botcazou  <ebotcazou@adacore.com>
+           Olivier Hainque  <hainque@adacore.com>
+           Nicolas Setton  <setton@adacore.com>
+
+       * tree.h (TYPE_ARTIFICIAL): New flag.
+       * dwarf2out.c (modified_type_die): Add a DW_AT_artificial attribute to
+       the DIE of the type if it is artificial.
+       (gen_array_type_die): Likewise.
+       (gen_enumeration_type_die): Likewise.
+       (gen_struct_or_union_type_die): Likewise.
+       * lto-streamer-in.c (unpack_ts_base_value_fields): Use TYPE_ARTIFICIAL.
+       * lto-streamer-out.c (pack_ts_base_value_fields): Likewise.
+
 2011-07-01  Jakub Jelinek  <jakub@redhat.com>
 
        * tree-object-size.c (pass_through_call): Handle
index d21f2e0fb945662f22ace23fa31a3eec53b85a8e..9e778c102c52c3aadb18ba6fabd0b4089eae476e 100644 (file)
@@ -1,3 +1,12 @@
+2011-07-02  Eric Botcazou  <ebotcazou@adacore.com>
+           Olivier Hainque  <hainque@adacore.com>
+           Nicolas Setton  <setton@adacore.com>
+
+       * gcc-interface/utils.c (record_builtin_type): Set TYPE_ARTIFICIAL on
+       the type according to the ARTIFICIAL_P parameter.
+       (create_type_decl): Likewise.
+       (create_type_stub_decl): Set TYPE_ARTIFICIAL on the type to 1.
+
 2011-07-01  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/Make-lang.in (gnat1): Prepend '+' to the command.
index e7496321702646db4c6a528a3e4d01d1c065ce94..9b6e7211bfe06943e043e38319f13c1c49c4084f 100644 (file)
@@ -614,6 +614,7 @@ 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;
+  TYPE_ARTIFICIAL (type) = artificial_p;
   gnat_pushdecl (type_decl, Empty);
 
   if (debug_hooks->type_decl)
@@ -1297,6 +1298,7 @@ create_type_stub_decl (tree type_name, tree type)
   tree type_decl = build_decl (input_location,
                               TYPE_DECL, type_name, type);
   DECL_ARTIFICIAL (type_decl) = 1;
+  TYPE_ARTIFICIAL (type) = 1;
   return type_decl;
 }
 
@@ -1329,6 +1331,7 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list,
                            TYPE_DECL, type_name, type);
 
   DECL_ARTIFICIAL (type_decl) = artificial_p;
+  TYPE_ARTIFICIAL (type) = artificial_p;
 
   /* Add this decl to the current binding level.  */
   gnat_pushdecl (type_decl, gnat_node);
index 9ab551d8ed23f776dc1774f9c93eedc85e475f63..a0714c45d26a5e5b688b4421302803b4f98aec50 100644 (file)
@@ -13189,6 +13189,8 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type,
        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)
@@ -19444,6 +19446,8 @@ 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)
@@ -19747,6 +19751,8 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die)
       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))
@@ -21604,6 +21610,8 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_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);
        }
     }
   else
index 25ccb24a105764c61afe8454c6055903400eb233..7a4f7225bdc14ec58d8388a0a8b3de093b5abd14 100644 (file)
@@ -1563,7 +1563,10 @@ unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
   else
     bp_unpack_value (bp, 1);
   TREE_ASM_WRITTEN (expr) = (unsigned) bp_unpack_value (bp, 1);
-  TREE_NO_WARNING (expr) = (unsigned) bp_unpack_value (bp, 1);
+  if (TYPE_P (expr))
+    TYPE_ARTIFICIAL (expr) = (unsigned) bp_unpack_value (bp, 1);
+  else
+    TREE_NO_WARNING (expr) = (unsigned) bp_unpack_value (bp, 1);
   TREE_USED (expr) = (unsigned) bp_unpack_value (bp, 1);
   TREE_NOTHROW (expr) = (unsigned) bp_unpack_value (bp, 1);
   TREE_STATIC (expr) = (unsigned) bp_unpack_value (bp, 1);
index 19b0ae8bb1e59627a8a96d27620eb389778f60cb..6345d83d2c999f5a98c2b9211f95007840bc887c 100644 (file)
@@ -340,7 +340,10 @@ pack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
     bp_pack_value (bp, 0, 1);
   /* We write debug info two times, do not confuse the second one.  */
   bp_pack_value (bp, TYPE_P (expr) ? 0 : TREE_ASM_WRITTEN (expr), 1);
-  bp_pack_value (bp, TREE_NO_WARNING (expr), 1);
+  if (TYPE_P (expr))
+    bp_pack_value (bp, TYPE_ARTIFICIAL (expr), 1);
+  else
+    bp_pack_value (bp, TREE_NO_WARNING (expr), 1);
   bp_pack_value (bp, TREE_USED (expr), 1);
   bp_pack_value (bp, TREE_NOTHROW (expr), 1);
   bp_pack_value (bp, TREE_STATIC (expr), 1);
index 925423540c80cec3c5ffd45c9663282f5a2215f9..8460d89c91719a9ed86d6dcaf6038b63ac22ac28 100644 (file)
@@ -1,3 +1,7 @@
+2011-07-02  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/specs/debug1.ads: New test.
+
 2011-07-02  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/49562
diff --git a/gcc/testsuite/gnat.dg/specs/debug1.ads b/gcc/testsuite/gnat.dg/specs/debug1.ads
new file mode 100644 (file)
index 0000000..30ccf28
--- /dev/null
@@ -0,0 +1,14 @@
+-- { dg-do compile { target *-*-linux* } }
+-- { dg-options "-gdwarf-2 -cargs -dA" }
+
+package Debug1 is
+
+  function N return Integer;
+  pragma Import (Ada, N);
+
+  type Arr is array (-N .. N) of Boolean;
+  A : Arr;
+
+end Debug1;
+
+-- { dg-final { scan-assembler-times "byte\t0x1\t# DW_AT_artificial" 4 } }
index 20ba295a219ad52fecf2c0ee94621d54dc7ede63..ab0b6cc66c6183e0d9c1b0dc5438d5ca42309de9 100644 (file)
@@ -699,6 +699,9 @@ struct GTY(()) tree_common {
            all expressions
            all decls
 
+       TYPE_ARTIFICIAL in
+           all types
+
    default_def_flag:
 
        TYPE_VECTOR_OPAQUE in
@@ -1243,6 +1246,9 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
    emitted.  */
 #define TREE_NO_WARNING(NODE) ((NODE)->base.nowarning_flag)
 
+/* Used to indicate that this TYPE represents a compiler-generated entity.  */
+#define TYPE_ARTIFICIAL(NODE) (TYPE_CHECK (NODE)->base.nowarning_flag)
+
 /* In an IDENTIFIER_NODE, this means that assemble_name was called with
    this string as an argument.  */
 #define TREE_SYMBOL_REFERENCED(NODE) \