+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.
+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
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);
}
/* ************************************************************************
+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.
}
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;
}
/* 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. */
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;
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);
}
}
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);
}
}
}
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 */
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 */
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 */
}
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)
{
}
/* 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. */
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 *);
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);
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 */
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);
/* 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;
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.
+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.
(*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;
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);
}
}
}
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 */
+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.
--- /dev/null
+// { 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;
--- /dev/null
+// { 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;
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 */