summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/cp-lang.c3
-rw-r--r--gcc/dwarf2out.c34
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/anonname1.C18
6 files changed, 66 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ea4e772bfb2..5cb7752ea58 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2009-10-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/41828
+ * dwarf2out.c (add_pubname, add_pubtype, generic_parameter_die,
+ add_name_and_src_coords_attributes, gen_namespace_die,
+ dwarf2out_set_name): Handle dwarf2_name returning NULL.
+
2009-10-26 Nick Clifton <nickc@redhat.com>
* config.gcc: Add support for RX target.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 50212a9357f..e7229587878 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/41828
+ * cp-lang.c (cxx_dwarf_name): Return NULL instead of
+ <anonymous ...> for anonymous aggregate names.
+
2009-10-26 Jason Merrill <jason@redhat.com>
PR c++/38796, Core issue 906
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index d84325d291b..8aa01e24d39 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -137,6 +137,9 @@ cxx_dwarf_name (tree t, int verbosity)
{
gcc_assert (DECL_P (t));
+ if (DECL_NAME (t)
+ && (ANON_AGGRNAME_P (DECL_NAME (t)) || LAMBDANAME_P (DECL_NAME (t))))
+ return NULL;
if (verbosity >= 2)
return decl_as_string (t,
TFF_DECL_SPECIFIERS | TFF_UNQUALIFIED_NAME
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ba59251d66b..cdf19311b38 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -10781,7 +10781,11 @@ static void
add_pubname (tree decl, dw_die_ref die)
{
if (TREE_PUBLIC (decl))
- add_pubname_string (dwarf2_name (decl, 1), die);
+ {
+ const char *name = dwarf2_name (decl, 1);
+ if (name)
+ add_pubname_string (name, die);
+ }
}
/* Add a new entry to .debug_pubtypes if appropriate. */
@@ -10811,7 +10815,11 @@ add_pubtype (tree decl, dw_die_ref die)
}
}
else
- e.name = xstrdup (dwarf2_name (decl, 1));
+ {
+ e.name = dwarf2_name (decl, 1);
+ if (e.name)
+ e.name = xstrdup (e.name);
+ }
/* If we don't have a name for the type, there's no point in adding
it to the table. */
@@ -12359,7 +12367,8 @@ generic_parameter_die (tree parm, tree arg,
/* The DW_AT_GNU_template_name attribute of the DIE must be set
to the name of the argument. */
name = dwarf2_name (TYPE_P (arg) ? TYPE_NAME (arg) : arg, 1);
- add_AT_string (tmpl_die, DW_AT_GNU_template_name, name);
+ if (name)
+ add_AT_string (tmpl_die, DW_AT_GNU_template_name, name);
}
if (TREE_CODE (parm) == PARM_DECL)
@@ -16464,7 +16473,9 @@ add_name_and_src_coords_attributes (dw_die_ref die, tree decl)
decl_name = DECL_NAME (decl);
if (decl_name != NULL && IDENTIFIER_POINTER (decl_name) != NULL)
{
- add_name_attribute (die, dwarf2_name (decl, 0));
+ const char *name = dwarf2_name (decl, 0);
+ if (name)
+ add_name_attribute (die, name);
if (! DECL_ARTIFICIAL (decl))
add_src_coords_attributes (die, decl);
@@ -19222,7 +19233,11 @@ gen_namespace_die (tree decl, dw_die_ref context_die)
context_die, decl);
/* For Fortran modules defined in different CU don't add src coords. */
if (namespace_die->die_tag == DW_TAG_module && DECL_EXTERNAL (decl))
- add_name_attribute (namespace_die, dwarf2_name (decl, 0));
+ {
+ const char *name = dwarf2_name (decl, 0);
+ if (name)
+ add_name_attribute (namespace_die, name);
+ }
else
add_name_and_src_coords_attributes (namespace_die, decl);
if (DECL_EXTERNAL (decl))
@@ -19910,23 +19925,28 @@ dwarf2out_set_name (tree decl, tree name)
{
dw_die_ref die;
dw_attr_ref attr;
+ const char *dname;
die = TYPE_SYMTAB_DIE (decl);
if (!die)
return;
+ dname = dwarf2_name (name, 0);
+ if (!dname)
+ return;
+
attr = get_AT (die, DW_AT_name);
if (attr)
{
struct indirect_string_node *node;
- node = find_AT_string (dwarf2_name (name, 0));
+ node = find_AT_string (dname);
/* replace the string. */
attr->dw_attr_val.v.val_str = node;
}
else
- add_name_attribute (die, dwarf2_name (name, 0));
+ add_name_attribute (die, dname);
}
/* Called by the final INSN scan whenever we see a direct function call.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0556d765f70..314d953752a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/41828
+ * g++.dg/debug/dwarf2/anonname1.C: New test.
+
2009-10-26 Jason Merrill <jason@redhat.com>
PR c++/38796
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/anonname1.C b/gcc/testsuite/g++.dg/debug/dwarf2/anonname1.C
new file mode 100644
index 00000000000..dcd2d8d5660
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/anonname1.C
@@ -0,0 +1,18 @@
+// PR debug/41828
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA" }
+// { dg-final { scan-assembler-not "<anonymous" } }
+// { dg-final { scan-assembler-not "\._\[0-9\]" } }
+// { dg-final { scan-assembler-not "\$_\[0-9\]" } }
+// { dg-final { scan-assembler-not "__anon_" } }
+
+struct
+{
+ union
+ {
+ struct
+ {
+ enum { a, b, c } x;
+ } s;
+ };
+} x;