OSDN Git Service

2009-08-04 Dodji Seketeli <dodji@redhat.com>
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Aug 2009 12:26:01 +0000 (12:26 +0000)
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Aug 2009 12:26:01 +0000 (12:26 +0000)
gcc/cp/ChangeLog:
PR debug/39706
* error.c (lang_decl_name): Print qualified names for decls
in  namespace scope.

gcc/testsuite/ChangeLog:
PR debug/39706
* g++.dg/debug/dwarf2/pubnames-1.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150452 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C [new file with mode: 0644]

index 4856136..506d83c 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-04  Dodji Seketeli  <dodji@redhat.com>
+
+       PR debug/39706
+       * error.c (lang_decl_name): Print qualified names for decls
+       in  namespace scope.
+
 2009-08-03  Jason Merrill  <jason@redhat.com>
            Jakub Jelinek  <jakub@redhat.com>
 
index 25a0580..239ff9a 100644 (file)
@@ -2331,7 +2331,10 @@ lang_decl_name (tree decl, int v, bool translate)
 
   reinit_cxx_pp ();
   pp_translate_identifiers (cxx_pp) = translate;
-  if (v == 1 && DECL_CLASS_SCOPE_P (decl))
+  if (v == 1
+      && (DECL_CLASS_SCOPE_P (decl)
+         || (DECL_NAMESPACE_SCOPE_P (decl)
+             && CP_DECL_CONTEXT (decl) != global_namespace)))
     {
       dump_type (CP_DECL_CONTEXT (decl), TFF_PLAIN_IDENTIFIER);
       pp_cxx_colon_colon (cxx_pp);
index 26a37b1..bd4ede1 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-04  Dodji Seketeli  <dodji@redhat.com>
+
+       PR debug/39706
+       * g++.dg/debug/dwarf2/pubnames-1.C: New test.
+
 2009-08-03  Jason Merrill  <jason@redhat.com>
            Jakub Jelinek  <jakub@redhat.com>
 
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C
new file mode 100644 (file)
index 0000000..b2f6703
--- /dev/null
@@ -0,0 +1,13 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin PR debug/39706
+// { dg-options "-g -dA" }
+// { dg-do compile }
+// { dg-final { scan-assembler-times ".debug_pubnames" 1 } }
+// { dg-final { scan-assembler-times "\"main\".*external name" 1 } }
+// { dg-final { scan-assembler-times "\"ns::ns_x.*external name" 1 } }
+// { dg-final { scan-assembler-times "\"y::y_x.*external name" 1 } }
+
+namespace ns { int ns_x; }
+class y { public: static int y_x; };
+int y::y_x;
+int main() { return ns::ns_x; }