diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-03-12 14:04:37 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-03-12 14:04:37 +0100 |
commit | 70235ab941c572a4efabd15fcf737c22fc999814 (patch) | |
tree | 0b29e6fc9123592f39dc916a03b18fd320d0c99f /gcc/dwarf2out.c | |
parent | d76f631a86565e06d58ee1dbf63a386fd5e9fdec (diff) | |
download | gcc-70235ab941c572a4efabd15fcf737c22fc999814.tar.gz |
re PR debug/43329 (Early inlining causes suboptimal debug info)
PR debug/43329
* tree-inline.c (remap_decls): Put old_var rather than origin_var
into *nonlocalized_list vector.
* dwarf2out.c (gen_formal_parameter_die): Call decl_ultimate_origin
even if origin is non-NULL.
(gen_variable_die): Likewise.
(process_scope_var): Don't change origin.
(gen_decl_die): Likewise.
* tree-cfgcleanup.c (remove_forwarder_block): Check single_pred_p
before adding new edges instead of after it, fix moving over
debug stmts.
* gcc.dg/guality/pr43329-1.c: New test.
From-SVN: r157402
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 460144477eb..c76d54f39c2 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -17382,14 +17382,16 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, dw_die_ref context_die) { tree node_or_origin = node ? node : origin; + tree ultimate_origin; dw_die_ref parm_die = new_die (DW_TAG_formal_parameter, context_die, node); switch (TREE_CODE_CLASS (TREE_CODE (node_or_origin))) { case tcc_declaration: - if (!origin) - origin = decl_ultimate_origin (node); + ultimate_origin = decl_ultimate_origin (node_or_origin); + if (node || ultimate_origin) + origin = ultimate_origin; if (origin != NULL) add_abstract_origin_attribute (parm_die, origin); else @@ -18106,15 +18108,16 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) HOST_WIDE_INT off; tree com_decl; tree decl_or_origin = decl ? decl : origin; + tree ultimate_origin; dw_die_ref var_die; dw_die_ref old_die = decl ? lookup_decl_die (decl) : NULL; dw_die_ref origin_die; int declaration = (DECL_EXTERNAL (decl_or_origin) || class_or_namespace_scope_p (context_die)); - if (!origin) - origin = decl_ultimate_origin (decl); - + ultimate_origin = decl_ultimate_origin (decl_or_origin); + if (decl || ultimate_origin) + origin = ultimate_origin; com_decl = fortran_common (decl_or_origin, &off); /* Symbol in common gets emitted as a child of the common block, in the form @@ -19160,10 +19163,6 @@ process_scope_var (tree stmt, tree decl, tree origin, dw_die_ref context_die) { dw_die_ref die; tree decl_or_origin = decl ? decl : origin; - tree ultimate_origin = origin ? decl_ultimate_origin (origin) : NULL; - - if (ultimate_origin) - origin = ultimate_origin; if (TREE_CODE (decl_or_origin) == FUNCTION_DECL) die = lookup_decl_die (decl_or_origin); @@ -19435,7 +19434,7 @@ static void gen_decl_die (tree decl, tree origin, dw_die_ref context_die) { tree decl_or_origin = decl ? decl : origin; - tree class_origin = NULL; + tree class_origin = NULL, ultimate_origin; if (DECL_P (decl_or_origin) && DECL_IGNORED_P (decl_or_origin)) return; @@ -19481,7 +19480,9 @@ gen_decl_die (tree decl, tree origin, dw_die_ref context_die) /* If we're emitting a clone, emit info for the abstract instance. */ if (origin || DECL_ORIGIN (decl) != decl) - dwarf2out_abstract_function (origin ? origin : DECL_ABSTRACT_ORIGIN (decl)); + dwarf2out_abstract_function (origin + ? DECL_ORIGIN (origin) + : DECL_ABSTRACT_ORIGIN (decl)); /* If we're emitting an out-of-line copy of an inline function, emit info for the abstract instance and set up to refer to it. */ @@ -19580,9 +19581,9 @@ gen_decl_die (tree decl, tree origin, dw_die_ref context_die) complicated because of the possibility that the VAR_DECL really represents an inlined instance of a formal parameter for an inline function. */ - if (!origin) - origin = decl_ultimate_origin (decl); - if (origin != NULL_TREE && TREE_CODE (origin) == PARM_DECL) + ultimate_origin = decl_ultimate_origin (decl_or_origin); + if (ultimate_origin != NULL_TREE + && TREE_CODE (ultimate_origin) == PARM_DECL) gen_formal_parameter_die (decl, origin, true /* Emit name attribute. */, context_die); |