2009-07-14 Dodji Seketeli <dodji@redhat.com>
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Jul 2009 15:01:55 +0000 (15:01 +0000)
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Jul 2009 15:01:55 +0000 (15:01 +0000)
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

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/other/typedef3.C [new file with mode: 0644]

index 4e85655..8f78256 100644 (file)
@@ -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
index 97e5b3b..db1bc36 100644 (file)
@@ -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
index b3b567e..3a5d2fa 100644 (file)
@@ -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;
index f7afc17..2c5d056 100644 (file)
@@ -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)))
     {
index 7610a5a..4ccfdc1 100644 (file)
@@ -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 (file)
index 0000000..f325ac5
--- /dev/null
@@ -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 (file)
index 0000000..8ead5b8
--- /dev/null
@@ -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) {}
+