diff options
author | Paul Koning <ni1d@arrl.net> | 2012-10-23 14:44:27 -0400 |
---|---|---|
committer | Paul Koning <pkoning@gcc.gnu.org> | 2012-10-23 14:44:27 -0400 |
commit | a17d5a98417753708f385f0aab3a9cbcd2f1952a (patch) | |
tree | c683ea50ebea1be10dfc5c7e2eee5a1f7bfb42fc /gcc/dwarf2out.c | |
parent | 22531fb1957ca61debd68c6d3bbc16899b907ba8 (diff) | |
download | gcc-a17d5a98417753708f385f0aab3a9cbcd2f1952a.zip gcc-a17d5a98417753708f385f0aab3a9cbcd2f1952a.tar.gz gcc-a17d5a98417753708f385f0aab3a9cbcd2f1952a.tar.bz2 |
re PR debug/54508 (Wrong debug information emitted if data members not referenced)
PR debug/54508
* dwarf2out.c (prune_unused_types_prune): If pruning a class and
not all its children were marked, add DW_AT_declaration flag.
* g++.dg/debug/dwarf2/pr54508.C: New.
From-SVN: r192739
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index bc5868b..bed3d67 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -21220,6 +21220,7 @@ static void prune_unused_types_prune (dw_die_ref die) { dw_die_ref c; + int pruned = 0; gcc_assert (die->die_mark); prune_unused_types_update_strings (die); @@ -21242,13 +21243,24 @@ prune_unused_types_prune (dw_die_ref die) prev->die_sib = c->die_sib; die->die_child = prev; } - return; + pruned = 1; + goto finished; } if (c != prev->die_sib) - prev->die_sib = c; + { + prev->die_sib = c; + pruned = 1; + } prune_unused_types_prune (c); } while (c != die->die_child); + + finished: + /* If we pruned children, and this is a class, mark it as a + declaration to inform debuggers that this is not a complete + class definition. */ + if (pruned && die->die_mark == 1 && class_scope_p (die)) + add_AT_flag (die, DW_AT_declaration, 1); } /* Remove dies representing declarations that we never use. */ |