summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-14 15:01:55 +0000
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-14 15:01:55 +0000
commit75c0b6e7e2f368f002b3e6e931682da297c4e23d (patch)
tree3d532c6c5fe4fdf982f382093c35a0367eb115fe
parentb6da67dcd41f4901f95fdd8995e836af8e35e89d (diff)
downloadgcc-75c0b6e7e2f368f002b3e6e931682da297c4e23d.tar.gz
2009-07-14 Dodji Seketeli <dodji@redhat.com>
gcc/ChangeLog: PR debug/40705 PR c++/403057 * dwarf2.out.c (gen_type_die_with_usage): Added comment. gcc/cp/ChangeLog: PR debug/40705 PR c++/403057 * decl2.c (grokfield): Don't call set_underlying_type on typedef decls that are type names. gcc/testsuite/ChangeLog: PR debug/40705 PR c++/403057 * g++.dg/debug/dwarf2/typedef1.C: New test. * g++.dg/other/typedef3.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149628 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl2.c4
-rw-r--r--gcc/dwarf2out.c2
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C33
-rw-r--r--gcc/testsuite/g++.dg/other/typedef3.C12
7 files changed, 71 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4e856550485..8f78256d4b7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-14 Dodji Seketeli <dodji@redhat.com>
+
+ PR debug/40705
+ PR c++/403057
+ * dwarf2.out.c (gen_type_die_with_usage): Added comment.
+
2009-07-14 Richard Guenther <rguenther@suse.de>
PR middle-end/40745
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 97e5b3b0171..db1bc36cde0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-14 Dodji Seketeli <dodji@redhat.com>
+
+ PR debug/40705
+ PR c++/403057
+ * decl2.c (grokfield): Don't call set_underlying_type on typedef
+ decls that are type names.
+
2009-07-13 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/22154
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index b3b567e0f6c..3a5d2fa929b 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -821,7 +821,9 @@ grokfield (const cp_declarator *declarator,
cplus_decl_attributes (&value, attrlist, attrflags);
}
- if (declspecs->specs[(int)ds_typedef])
+ if (declspecs->specs[(int)ds_typedef]
+ && TREE_TYPE (value) != error_mark_node
+ && TYPE_NAME (TYPE_MAIN_VARIANT (TREE_TYPE (value))) != value)
set_underlying_type (value);
return value;
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index f7afc17ef31..2c5d0562562 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -15135,6 +15135,8 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
if (type == NULL_TREE || type == error_mark_node)
return;
+ /* If TYPE is a typedef type variant, let's generate debug info
+ for the parent typedef which TYPE is a type of. */
if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7610a5a2f02..4ccfdc1c5e1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-14 Dodji Seketeli <dodji@redhat.com>
+
+ PR debug/40705
+ * g++.dg/debug/dwarf2/typedef1.C: New test.
+
+ PR c++/403057
+ * g++.dg/other/typedef3.C: New test.
+
2009-07-14 Maxim Kuvyrkov <maxim@codesourcery.com>
* gcc.dg/20090709-1.c: Move to a proper place ...
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C b/gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C
new file mode 100644
index 00000000000..f325ac54ad2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C
@@ -0,0 +1,33 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin: PR c++/40705
+// { dg-options "-g -dA" }
+// { dg-do compile }
+// { dg-final { scan-assembler-times "DW_TAG_structure_type" 2 } }
+// { dg-final { scan-assembler-times "DW_AT_name: \"foo<1u>\"" 1 } }
+// { dg-final { scan-assembler-times "DW_TAG_enumeration_type" 2 } }
+// { dg-final { scan-assembler-times "DW_AT_name: \"typedef foo<1u>::type type\"" 1 } }
+// { dg-final { scan-assembler-times "DIE (.*) DW_TAG_enumeration_type" 2 } }
+// { dg-final { scan-assembler-times "\"e0..\".*DW_AT_name" 1 } }
+// { dg-final { scan-assembler-times "\"e1..\".*DW_AT_name" 1 } }
+
+template <unsigned int n>
+struct foo
+{
+public:
+ typedef
+ unsigned char type;
+};
+
+template<>
+struct foo<1>
+{
+ typedef enum { e0, e1 } type;
+};
+
+int
+main()
+{
+ foo<1> f;
+ foo<1>::type t = foo<1>::e1;
+ return t;
+}
diff --git a/gcc/testsuite/g++.dg/other/typedef3.C b/gcc/testsuite/g++.dg/other/typedef3.C
new file mode 100644
index 00000000000..8ead5b84520
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/typedef3.C
@@ -0,0 +1,12 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin: PR c++/40357
+// { dg-do compile }
+
+struct XalanCProcessor
+{
+ typedef enum {eInvalid, eXalanSourceTree, eXercesDOM} ParseOptionType;
+ ParseOptionType getParseOption(void);
+};
+typedef XalanCProcessor::ParseOptionType ParseOptionType;
+ParseOptionType XalanCProcessor::getParseOption(void) {}
+