diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-07-29 09:52:16 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-07-29 09:52:16 +0200 |
commit | e071b7678195f4176938730e348503cddc2a87b4 (patch) | |
tree | 5d2a520e61da9c40f3bbcda6527ff9005b07e520 | |
parent | 226b828937458a958cd6d681f9a6d3288b46f58e (diff) | |
download | gcc-e071b7678195f4176938730e348503cddc2a87b4.zip gcc-e071b7678195f4176938730e348503cddc2a87b4.tar.gz gcc-e071b7678195f4176938730e348503cddc2a87b4.tar.bz2 |
debug.h (struct gcc_debug_hooks): Add IMPLICIT argument to imported_module_or_decl hook.
* debug.h (struct gcc_debug_hooks): Add IMPLICIT argument
to imported_module_or_decl hook.
(debug_nothing_tree_tree_tree_bool): Remove.
(debug_nothing_tree_tree_tree_bool_bool): New declaration.
* debug.c (do_nothing_debug_hooks): Use
debug_nothing_tree_tree_tree_bool_bool instead of
debug_nothing_tree_tree_tree_bool.
* vmsdbgout.c (vmsdbg_debug_hooks): Likewise.
* dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Likewise.
* sdbout.c (sdb_debug_hooks): Likewise.
* dwarf2out.c (dwarf2_lineno_debug_hooks): Likewise.
(gen_namespace_die): Add DW_AT_export_symbols attribute if
langhook wants it.
(dwarf2out_imported_module_or_decl): Add IMPLICIT argument,
if true, -gdwarf-5 and decl will have DW_AT_export_symbols
attribute, don't add anything.
cp/
* cp-objcp-common.c (cp_decl_dwarf_attribute): Handle
DW_AT_export_symbols.
* name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT
argument, pass it through to the debug hook.
(finish_namespace_using_directive): Adjust
emit_debug_info_using_namespace caller.
(push_namespace): Likewise. Call it after setting
DECL_NAMESPACE_INLINE_P.
(cp_emit_debug_info_for_using): Pass false as new argument to
the imported_module_or_decl debug hook.
fortran/
* trans-decl.c (gfc_trans_use_stmts): Pass false as new argument to
the imported_module_or_decl debug hook.
ada/
* gcc-interface/utils.c (gnat_write_global_declarations): Pass false
as new argument to the imported_module_or_decl debug hook.
testsuite/
* g++.dg/debug/dwarf2/inline-ns-1.C: New test.
* g++.dg/debug/dwarf2/inline-ns-2.C: New test.
From-SVN: r250713
-rw-r--r-- | gcc/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 2 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/cp/cp-objcp-common.c | 7 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 17 | ||||
-rw-r--r-- | gcc/dbxout.c | 4 | ||||
-rw-r--r-- | gcc/debug.c | 11 | ||||
-rw-r--r-- | gcc/debug.h | 6 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 25 | ||||
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 5 | ||||
-rw-r--r-- | gcc/sdbout.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-1.C | 23 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-2.C | 23 | ||||
-rw-r--r-- | gcc/vmsdbgout.c | 2 |
17 files changed, 148 insertions, 26 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2aafa71..ad347ad 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2017-07-29 Jakub Jelinek <jakub@redhat.com> + + * debug.h (struct gcc_debug_hooks): Add IMPLICIT argument + to imported_module_or_decl hook. + (debug_nothing_tree_tree_tree_bool): Remove. + (debug_nothing_tree_tree_tree_bool_bool): New declaration. + * debug.c (do_nothing_debug_hooks): Use + debug_nothing_tree_tree_tree_bool_bool instead of + debug_nothing_tree_tree_tree_bool. + * vmsdbgout.c (vmsdbg_debug_hooks): Likewise. + * dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Likewise. + * sdbout.c (sdb_debug_hooks): Likewise. + * dwarf2out.c (dwarf2_lineno_debug_hooks): Likewise. + (gen_namespace_die): Add DW_AT_export_symbols attribute if + langhook wants it. + (dwarf2out_imported_module_or_decl): Add IMPLICIT argument, + if true, -gdwarf-5 and decl will have DW_AT_export_symbols + attribute, don't add anything. + 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * fold-const.c (fold_build1_stat_loc): Remove _stat from name. diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3daed1e..dda51d4 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2017-07-29 Jakub Jelinek <jakub@redhat.com> + + * gcc-interface/utils.c (gnat_write_global_declarations): Pass false + as new argument to the imported_module_or_decl debug hook. + 2017-07-25 Javier Miranda <miranda@adacore.com> * checks.adb (Apply_Divide_Checks): Ensure that operands are not diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 9e65657..475261b 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -5553,7 +5553,7 @@ gnat_write_global_declarations (void) FOR_EACH_VEC_SAFE_ELT (global_decls, i, iter) if (TREE_CODE (iter) == IMPORTED_DECL && !DECL_IGNORED_P (iter)) debug_hooks->imported_module_or_decl (iter, DECL_NAME (iter), - DECL_CONTEXT (iter), 0); + DECL_CONTEXT (iter), false, false); } /* ************************************************************************ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 806235f..3d988a6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +2017-07-29 Jakub Jelinek <jakub@redhat.com> + + * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle + DW_AT_export_symbols. + * name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT + argument, pass it through to the debug hook. + (finish_namespace_using_directive): Adjust + emit_debug_info_using_namespace caller. + (push_namespace): Likewise. Call it after setting + DECL_NAMESPACE_INLINE_P. + (cp_emit_debug_info_for_using): Pass false as new argument to + the imported_module_or_decl debug hook. + 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * lex.c (copy_decl): Adjust. diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index 5a7da5b..4475b6c 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -212,6 +212,13 @@ cp_decl_dwarf_attribute (const_tree decl, int attr) } break; + case DW_AT_export_symbols: + if (TREE_CODE (decl) == NAMESPACE_DECL + && (DECL_NAMESPACE_INLINE_P (decl) + || (DECL_NAME (decl) == NULL_TREE && dwarf_version >= 5))) + return 1; + break; + default: break; } diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index cd7428a..4dc19da 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -6045,11 +6045,12 @@ add_using_namespace (vec<tree, va_gc> *&usings, tree target) /* Tell the debug system of a using directive. */ static void -emit_debug_info_using_namespace (tree from, tree target) +emit_debug_info_using_namespace (tree from, tree target, bool implicit) { /* Emit debugging info. */ tree context = from != global_namespace ? from : NULL_TREE; - debug_hooks->imported_module_or_decl (target, NULL_TREE, context, false); + debug_hooks->imported_module_or_decl (target, NULL_TREE, context, false, + implicit); } /* Process a namespace-scope using directive. */ @@ -6064,7 +6065,7 @@ finish_namespace_using_directive (tree target, tree attribs) add_using_namespace (DECL_NAMESPACE_USING (current_namespace), ORIGINAL_NAMESPACE (target)); emit_debug_info_using_namespace (current_namespace, - ORIGINAL_NAMESPACE (target)); + ORIGINAL_NAMESPACE (target), false); if (attribs == error_mark_node) return; @@ -6223,14 +6224,14 @@ push_namespace (tree name, bool make_inline) else if (TREE_PUBLIC (current_namespace)) TREE_PUBLIC (ns) = 1; - if (name == anon_identifier || make_inline) - emit_debug_info_using_namespace (current_namespace, ns); - if (make_inline) { DECL_NAMESPACE_INLINE_P (ns) = true; vec_safe_push (DECL_NAMESPACE_INLINEES (current_namespace), ns); } + + if (name == anon_identifier || make_inline) + emit_debug_info_using_namespace (current_namespace, ns, true); } } @@ -6358,8 +6359,8 @@ cp_emit_debug_info_for_using (tree t, tree context) if (building_stmt_list_p ()) add_stmt (build_stmt (input_location, USING_STMT, fn)); else - debug_hooks->imported_module_or_decl (fn, - NULL_TREE, context, false); + debug_hooks->imported_module_or_decl (fn, NULL_TREE, context, + false, false); } } } diff --git a/gcc/dbxout.c b/gcc/dbxout.c index b278c6d..3d9268c 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -371,7 +371,7 @@ const struct gcc_debug_hooks dbx_debug_hooks = dbxout_early_global_decl, /* early_global_decl */ dbxout_late_global_decl, /* late_global_decl */ dbxout_type_decl, /* type_decl */ - debug_nothing_tree_tree_tree_bool, /* imported_module_or_decl */ + debug_nothing_tree_tree_tree_bool_bool,/* imported_module_or_decl */ debug_nothing_tree, /* deferred_inline_function */ debug_nothing_tree, /* outlining_inline_function */ debug_nothing_rtx_code_label, /* label */ @@ -411,7 +411,7 @@ const struct gcc_debug_hooks xcoff_debug_hooks = dbxout_early_global_decl, /* early_global_decl */ dbxout_late_global_decl, /* late_global_decl */ dbxout_type_decl, /* type_decl */ - debug_nothing_tree_tree_tree_bool, /* imported_module_or_decl */ + debug_nothing_tree_tree_tree_bool_bool,/* imported_module_or_decl */ debug_nothing_tree, /* deferred_inline_function */ debug_nothing_tree, /* outlining_inline_function */ debug_nothing_rtx_code_label, /* label */ diff --git a/gcc/debug.c b/gcc/debug.c index 860f1e3..d68c30f 100644 --- a/gcc/debug.c +++ b/gcc/debug.c @@ -47,7 +47,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks = debug_nothing_tree, /* early_global_decl */ debug_nothing_tree, /* late_global_decl */ debug_nothing_tree_int, /* type_decl */ - debug_nothing_tree_tree_tree_bool, /* imported_module_or_decl */ + debug_nothing_tree_tree_tree_bool_bool,/* imported_module_or_decl */ debug_nothing_tree, /* deferred_inline_function */ debug_nothing_tree, /* outlining_inline_function */ debug_nothing_rtx_code_label, /* label */ @@ -80,10 +80,11 @@ debug_nothing_tree_tree (tree t1 ATTRIBUTE_UNUSED, } void -debug_nothing_tree_tree_tree_bool (tree t1 ATTRIBUTE_UNUSED, - tree t2 ATTRIBUTE_UNUSED, - tree t3 ATTRIBUTE_UNUSED, - bool b1 ATTRIBUTE_UNUSED) +debug_nothing_tree_tree_tree_bool_bool (tree t1 ATTRIBUTE_UNUSED, + tree t2 ATTRIBUTE_UNUSED, + tree t3 ATTRIBUTE_UNUSED, + bool b1 ATTRIBUTE_UNUSED, + bool b2 ATTRIBUTE_UNUSED) { } diff --git a/gcc/debug.h b/gcc/debug.h index 3953658..bfb7221 100644 --- a/gcc/debug.h +++ b/gcc/debug.h @@ -145,7 +145,8 @@ struct gcc_debug_hooks /* Debug information for imported modules and declarations. */ void (* imported_module_or_decl) (tree decl, tree name, - tree context, bool child); + tree context, bool child, + bool implicit); /* DECL is an inline function, whose body is present, but which is not being output at this point. */ @@ -206,7 +207,8 @@ extern void debug_nothing_int_int (unsigned int, unsigned int); extern void debug_nothing_tree (tree); extern void debug_nothing_tree_tree (tree, tree); extern void debug_nothing_tree_int (tree, int); -extern void debug_nothing_tree_tree_tree_bool (tree, tree, tree, bool); +extern void debug_nothing_tree_tree_tree_bool_bool (tree, tree, tree, + bool, bool); extern bool debug_true_const_tree (const_tree); extern void debug_nothing_rtx_insn (rtx_insn *); extern void debug_nothing_rtx_code_label (rtx_code_label *); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 5231683..4a3b3c1 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -2680,7 +2680,7 @@ static bool dwarf2out_ignore_block (const_tree); static void dwarf2out_early_global_decl (tree); static void dwarf2out_late_global_decl (tree); static void dwarf2out_type_decl (tree, int); -static void dwarf2out_imported_module_or_decl (tree, tree, tree, bool); +static void dwarf2out_imported_module_or_decl (tree, tree, tree, bool, bool); static void dwarf2out_imported_module_or_decl_1 (tree, tree, tree, dw_die_ref); static void dwarf2out_abstract_function (tree); @@ -2764,7 +2764,7 @@ const struct gcc_debug_hooks dwarf2_lineno_debug_hooks = debug_nothing_tree, /* early_global_decl */ debug_nothing_tree, /* late_global_decl */ debug_nothing_tree_int, /* type_decl */ - debug_nothing_tree_tree_tree_bool, /* imported_module_or_decl */ + debug_nothing_tree_tree_tree_bool_bool,/* imported_module_or_decl */ debug_nothing_tree, /* deferred_inline_function */ debug_nothing_tree, /* outlining_inline_function */ debug_nothing_rtx_code_label, /* label */ @@ -25166,6 +25166,11 @@ gen_namespace_die (tree decl, dw_die_ref context_die) add_AT_die_ref (namespace_die, DW_AT_import, origin_die); equate_decl_number_to_die (decl, namespace_die); } + if ((dwarf_version >= 5 || !dwarf_strict) + && lang_hooks.decls.decl_dwarf_attribute (decl, + DW_AT_export_symbols) == 1) + add_AT_flag (namespace_die, DW_AT_export_symbols, 1); + /* Bypass dwarf2_name's check for DECL_NAMELESS. */ if (want_pubnames ()) add_pubname_string (lang_hooks.dwarf_name (decl, 1), namespace_die); @@ -25579,11 +25584,13 @@ dwarf2out_imported_module_or_decl_1 (tree decl, /* Output debug information for imported module or decl DECL. NAME is non-NULL name in context if the decl has been renamed. CHILD is true if decl is one of the renamed decls as part of - importing whole module. */ + importing whole module. + IMPLICIT is set if this hook is called for an implicit import + such as inline namespace. */ static void dwarf2out_imported_module_or_decl (tree decl, tree name, tree context, - bool child) + bool child, bool implicit) { /* dw_die_ref at_import_die; */ dw_die_ref scope_die; @@ -25593,6 +25600,16 @@ dwarf2out_imported_module_or_decl (tree decl, tree name, tree context, gcc_assert (decl); + /* For DWARF5, just DW_AT_export_symbols on the DW_TAG_namespace + should be enough, for DWARF4 and older even if we emit as extension + DW_AT_export_symbols add the implicit DW_TAG_imported_module anyway + for the benefit of consumers unaware of DW_AT_export_symbols. */ + if (implicit + && dwarf_version >= 5 + && lang_hooks.decls.decl_dwarf_attribute (decl, + DW_AT_export_symbols) == 1) + return; + set_early_dwarf s; /* To emit DW_TAG_imported_module or DW_TAG_imported_decl, we need two DIEs. diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2b9aba6..81b220a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2017-07-29 Jakub Jelinek <jakub@redhat.com> + + * trans-decl.c (gfc_trans_use_stmts): Pass false as new argument to + the imported_module_or_decl debug hook. + 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * resolve.c (find_reachable_labels): Adjust. diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index b2f73b7..74d8606 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -4875,7 +4875,7 @@ gfc_trans_use_stmts (gfc_namespace * ns) (*debug_hooks->imported_module_or_decl) (entry->namespace_decl, NULL_TREE, ns->proc_name->backend_decl, - false); + false, false); for (rent = use_stmt->rename; rent; rent = rent->next) { tree decl, local_name; @@ -4952,7 +4952,8 @@ gfc_trans_use_stmts (gfc_namespace * ns) gfc_set_backend_locus (&rent->where); (*debug_hooks->imported_module_or_decl) (decl, local_name, ns->proc_name->backend_decl, - !use_stmt->only_flag); + !use_stmt->only_flag, + false); } } } diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 84798ac..a67f9d6 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -301,7 +301,7 @@ const struct gcc_debug_hooks sdb_debug_hooks = sdbout_early_global_decl, /* early_global_decl */ sdbout_late_global_decl, /* late_global_decl */ sdbout_symbol, /* type_decl */ - debug_nothing_tree_tree_tree_bool, /* imported_module_or_decl */ + debug_nothing_tree_tree_tree_bool_bool,/* imported_module_or_decl */ debug_nothing_tree, /* deferred_inline_function */ debug_nothing_tree, /* outlining_inline_function */ sdbout_label, /* label */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d2682dc..8e83a73 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-29 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/debug/dwarf2/inline-ns-1.C: New test. + * g++.dg/debug/dwarf2/inline-ns-2.C: New test. + 2017-07-28 Peter Bergner <bergner@vnet.ibm.com> * gcc.target/powerpc/cpu-builtin-1.c (darn, scv): Add tests. diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-1.C new file mode 100644 index 0000000..cae380a --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-1.C @@ -0,0 +1,23 @@ +// { dg-options "-O2 -gdwarf-4 -dA -gno-strict-dwarf" } +// { dg-final { scan-assembler-times " DW_AT_export_symbols" 1 } } +// { dg-final { scan-assembler-times "DIE \\(\[^\n\r\]*\\) DW_TAG_imported_module" 2 } } + +namespace A +{ + int i = 5; + inline namespace B + { + int j = 6; + namespace C + { + int k = 7; + }; + }; +}; +int l = A::i + A::j + A::C::k; +int m = A::i + A::B::j + A::B::C::k; +namespace +{ + int n = 8; +}; +int o = n; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-2.C new file mode 100644 index 0000000..4d9aed7 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-2.C @@ -0,0 +1,23 @@ +// { dg-options "-O2 -gdwarf-5 -dA" } +// { dg-final { scan-assembler-times " DW_AT_export_symbols" 2 } } +// { dg-final { scan-assembler-not "DIE \\(\[^\n\r\]*\\) DW_TAG_imported_module" } } + +namespace A +{ + int i = 5; + inline namespace B + { + int j = 6; + namespace C + { + int k = 7; + }; + }; +}; +int l = A::i + A::j + A::C::k; +int m = A::i + A::B::j + A::B::C::k; +namespace +{ + int n = 8; +}; +int o = n; diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c index 41928a4..42300e2 100644 --- a/gcc/vmsdbgout.c +++ b/gcc/vmsdbgout.c @@ -197,7 +197,7 @@ const struct gcc_debug_hooks vmsdbg_debug_hooks vmsdbgout_early_global_decl, vmsdbgout_late_global_decl, vmsdbgout_type_decl, /* type_decl */ - debug_nothing_tree_tree_tree_bool, /* imported_module_or_decl */ + debug_nothing_tree_tree_tree_bool_bool, /* imported_module_or_decl */ debug_nothing_tree, /* deferred_inline_function */ vmsdbgout_abstract_function, debug_nothing_rtx_code_label, /* label */ |