aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2010-05-27 19:29:53 +0000
committerDodji Seketeli <dodji@gcc.gnu.org>2010-05-27 21:29:53 +0200
commitfe08ec120475d4da4837d0cb5b13d2e6d38fa56f (patch)
tree85cd9f4c3157b4e1df56ba7dba909e3e7b46435f /gcc/tree.c
parentb042534cd86b042e1d4e4d5588f5c90f0370a0aa (diff)
downloadgcc-fe08ec120475d4da4837d0cb5b13d2e6d38fa56f.zip
gcc-fe08ec120475d4da4837d0cb5b13d2e6d38fa56f.tar.gz
gcc-fe08ec120475d4da4837d0cb5b13d2e6d38fa56f.tar.bz2
re PR c++/44188 (Fails to produce DW_AT_typedef for typedef of anonymous struct)
Fix PR c++/44188 gcc/ChangeLog: PR c++/44188 * c-common.c (is_typedef_decl): Move this definition ... * tree.c (is_typedef_decl): ... here. (typdef_variant_p): Move definition here from gcc/cp/tree.c. * c-common.h (is_typedef_decl): Move this declaration ... * tree.h (is_typedef_decl): ... here. (typedef_variant_p): Move declaration here from gcc/cp/cp-tree.h * dwarf2out.c (is_naming_typedef_decl): New function. (gen_tagged_type_die): Split out of ... (gen_type_die_with_usage): ... this function. When an anonymous tagged type is named by a typedef, make sure a DW_TAG_typedef DIE is emitted for the typedef. (gen_typedef_die): Emit DW_TAG_typedef also for typedefs naming anonymous tagged types. gcc/cp/ChangeLog: PR c++/44188 * cp-tree.h (typedef_variant_p): Move this declaration to gcc/tree.h. * tree.c (typedef_variant_p): Move this definition to gcc/tree.c. * decl.c (grokdeclarator): Do not rename debug info of an anonymous tagged type named by a typedef. gcc/testsuite/ChangeLog: PR c++/44188 * g++.dg/debug/dwarf2/typedef3.C: New test. From-SVN: r159943
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 743293e..8b04c37 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -10825,4 +10825,21 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
return binfo;
}
+/* Returns true if X is a typedef decl. */
+
+bool
+is_typedef_decl (tree x)
+{
+ return (x && TREE_CODE (x) == TYPE_DECL
+ && DECL_ORIGINAL_TYPE (x) != NULL_TREE);
+}
+
+/* Returns true iff TYPE is a type variant created for a typedef. */
+
+bool
+typedef_variant_p (tree type)
+{
+ return is_typedef_decl (TYPE_NAME (type));
+}
+
#include "gt-tree.h"