diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-07-29 07:52:16 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-07-29 07:52:16 +0000 |
commit | 41d01e673c65fca49580dfd4101642abf4eb9843 (patch) | |
tree | 5d2a520e61da9c40f3bbcda6527ff9005b07e520 /gcc/dwarf2out.c | |
parent | 35da66527c8894de7f798cabc4edf002f329e75e (diff) | |
download | gcc-41d01e673c65fca49580dfd4101642abf4eb9843.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250713 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 5231683ee9e..4a3b3c1d0f4 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. |