diff options
author | Dodji Seketeli <dodji@redhat.com> | 2010-12-17 10:39:21 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2010-12-17 11:39:21 +0100 |
commit | d997fbe8f13ec31efcb9f744913269d736054a8f (patch) | |
tree | 8598995a9270af7853b3d4b0110123f2918a1296 /gcc/dwarf2out.c | |
parent | a4ad1c7a089e4bbb21dc6e9f97d4beef52577d6a (diff) | |
download | gcc-d997fbe8f13ec31efcb9f744913269d736054a8f.zip gcc-d997fbe8f13ec31efcb9f744913269d736054a8f.tar.gz gcc-d997fbe8f13ec31efcb9f744913269d736054a8f.tar.bz2 |
re PR debug/45088 (pointer type information lost in debuginfo)
Fix for PR debug/45088
gcc/
* dwarf2out.c (gen_type_die_with_usage): Do not try to emit debug
info for a redundant typedef that has DECL_ORIGINAL_TYPE set. Use
that underlying type instead.
gcc/testsuite/
* g++.dg/debug/dwarf2/self-ref-1.C: New test.
* g++.dg/debug/dwarf2/self-ref-2.C: Likewise.
From-SVN: r167976
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index c985527..1fa3300 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -20251,13 +20251,23 @@ gen_tagged_type_die (tree type, static void gen_type_die_with_usage (tree type, dw_die_ref context_die, - enum debug_info_usage usage) + enum debug_info_usage usage) { struct array_descr_info info; if (type == NULL_TREE || type == error_mark_node) return; + if (TYPE_NAME (type) != NULL_TREE + && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL + && is_redundant_typedef (TYPE_NAME (type)) + && DECL_ORIGINAL_TYPE (TYPE_NAME (type))) + /* The DECL of this type is a typedef we don't want to emit debug + info for but we want debug info for its underlying typedef. + This can happen for e.g, the injected-class-name of a C++ + type. */ + type = DECL_ORIGINAL_TYPE (TYPE_NAME (type)); + /* If TYPE is a typedef type variant, let's generate debug info for the parent typedef which TYPE is a type of. */ if (typedef_variant_p (type)) |