This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix debuginfo for block local namespace aliases (PR debug/37890)


Hi!

For say
namespace A
{
  int x = 1;
}

namespace B = A;

void
foo ()
{
  namespace C = A;

  B::x++;
  C::x++;
  {
    namespace D = A;
    D::x++;
  }
}

template <int N>
void
bar ()
{
  namespace C = A;

  B::x++;
  C::x++;
  {
    namespace D = A;
    D::x++;
  }
}

int
main ()
{
  foo ();
  bar<0> ();
  bar<6> ();
}

we are outputing the namespace alias DIEs (DW_TAG_imported_declaration with
DW_AT_name) in the right places (for C and D as children of
DW_TAG_lexical_block), but in addition to that also as children of the
DW_TAG_compilation_unit (even duplicated there).  Only B should be emitted
there.  Fixed thusly, bootstrapped/regtested on x86_64-linux, ok for trunk?

2009-03-17  Jakub Jelinek  <jakub@redhat.com>

	PR debug/37890
	* name-lookup.c (do_namespace_alias): Don't call global_decl debug
	hook at function scope.

--- gcc/cp/name-lookup.c.jj	2009-03-17 09:23:22.000000000 +0100
+++ gcc/cp/name-lookup.c	2009-03-17 10:14:08.000000000 +0100
@@ -3337,7 +3337,8 @@ do_namespace_alias (tree alias, tree nam
   pushdecl (alias);
 
   /* Emit debug info for namespace alias.  */
-  (*debug_hooks->global_decl) (alias);
+  if (!building_stmt_tree ())
+    (*debug_hooks->global_decl) (alias);
 }
 
 /* Like pushdecl, only it places X in the current namespace,

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]