From bc712852cdef0fad0484d07e6ea0ecca92904c0c Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 2 Jul 2011 18:13:47 +0000 Subject: [PATCH] tree.h (TYPE_ARTIFICIAL): New flag. * 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 Co-Authored-By: Olivier Hainque From-SVN: r175781 --- gcc/ChangeLog | 13 +++++++++++++ gcc/ada/ChangeLog | 9 +++++++++ gcc/ada/gcc-interface/utils.c | 3 +++ gcc/dwarf2out.c | 8 ++++++++ gcc/lto-streamer-in.c | 5 ++++- gcc/lto-streamer-out.c | 5 ++++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/specs/debug1.ads | 14 ++++++++++++++ gcc/tree.h | 6 ++++++ 9 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/specs/debug1.ads diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 90433ee59b1..63f2bd39eb8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2011-07-02 Eric Botcazou + Olivier Hainque + Nicolas Setton + + * 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 * tree-object-size.c (pass_through_call): Handle diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d21f2e0fb94..9e778c102c5 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2011-07-02 Eric Botcazou + Olivier Hainque + Nicolas Setton + + * 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 * gcc-interface/Make-lang.in (gnat1): Prepend '+' to the command. diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index e7496321702..9b6e7211bfe 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -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); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 9ab551d8ed2..a0714c45d26 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -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 diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 25ccb24a105..7a4f7225bdc 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -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); diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 19b0ae8bb1e..6345d83d2c9 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 925423540c8..8460d89c917 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-07-02 Eric Botcazou + + * gnat.dg/specs/debug1.ads: New test. + 2011-07-02 Janus Weil 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 index 00000000000..30ccf2891c0 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/debug1.ads @@ -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 } } diff --git a/gcc/tree.h b/gcc/tree.h index 20ba295a219..ab0b6cc66c6 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -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) \ -- 2.30.2