aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatherine Moore <clm@codesourcery.com>2009-04-15 17:40:25 -0400
committerCatherine Moore <clm@gcc.gnu.org>2009-04-15 17:40:25 -0400
commita417cdd9635da7f784a48ec8cb49cca51833d970 (patch)
tree0402e3e8283f7c4c4e6a30872b20d24962d60c70
parent4268e5a55062bfa28f1527cda5c7c2f88317dbfb (diff)
downloadgcc-a417cdd9635da7f784a48ec8cb49cca51833d970.zip
gcc-a417cdd9635da7f784a48ec8cb49cca51833d970.tar.gz
gcc-a417cdd9635da7f784a48ec8cb49cca51833d970.tar.bz2
debug.h (set_name): Declare.
2009-04-15 Catherine Moore <clm@codesourcery.com> * debug.h (set_name): Declare. * dwarf2out.c (dwarf2out_set_name): Declare. (dwarf2_debug_hooks): Add set_name. (find_AT_string): New. (add_AT_string): Call find_AT_string. (dwarf2out_set_name): New. * cp/decl.c (grokdeclarator): Call set_name. * vmsdbgout.c (vmsdbg_debug_hooks): Add set_name_debug_nothing. * debug.c (do_nothing_debug_hooks): Likewise. * dbxout.c (dbx_debug_hooks): Likewise. * sdbout.c (sdb_debug_hooks): Likewise. From-SVN: r146137
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/cp/decl.c9
-rw-r--r--gcc/dbxout.c1
-rw-r--r--gcc/debug.c7
-rw-r--r--gcc/debug.h3
-rw-r--r--gcc/dwarf2out.c46
-rw-r--r--gcc/sdbout.c1
-rw-r--r--gcc/vmsdbgout.c1
8 files changed, 75 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 47f1ce6..fa122a9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2009-04-15 Catherine Moore <clm@codesourcery.com>
+
+ * debug.h (set_name): Declare.
+ * dwarf2out.c (dwarf2out_set_name): Declare.
+ (dwarf2_debug_hooks): Add set_name.
+ (find_AT_string): New.
+ (add_AT_string): Call find_AT_string.
+ (dwarf2out_set_name): New.
+ * cp/decl.c (grokdeclarator): Call set_name.
+ * vmsdbgout.c (vmsdbg_debug_hooks): Add set_name_debug_nothing.
+ * debug.c (do_nothing_debug_hooks): Likewise.
+ * dbxout.c (dbx_debug_hooks): Likewise.
+ * sdbout.c (sdb_debug_hooks): Likewise.
+
2009-04-15 Michael Eager <eager@eagercon.com>
* config/rs6000/rs6000.c: rs6000_function_value: set function return
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5ab9392..2c13e84 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -8828,8 +8828,13 @@ grokdeclarator (const cp_declarator *declarator,
/* Replace the anonymous name with the real name everywhere. */
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
- if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
- TYPE_NAME (t) = decl;
+ {
+ if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
+ {
+ debug_hooks->set_name (t, decl);
+ TYPE_NAME (t) = decl;
+ }
+ }
if (TYPE_LANG_SPECIFIC (type))
TYPE_WAS_ANONYMOUS (type) = 1;
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index babba15..dc63c7c 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -376,6 +376,7 @@ const struct gcc_debug_hooks dbx_debug_hooks =
dbxout_handle_pch, /* handle_pch */
debug_nothing_rtx, /* var_location */
debug_nothing_void, /* switch_text_section */
+ debug_nothing_tree_tree, /* set_name */
0 /* start_end_main_source_file */
};
#endif /* DBX_DEBUGGING_INFO */
diff --git a/gcc/debug.c b/gcc/debug.c
index e0beaa9..3946deb 100644
--- a/gcc/debug.c
+++ b/gcc/debug.c
@@ -50,6 +50,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
debug_nothing_int, /* handle_pch */
debug_nothing_rtx, /* var_location */
debug_nothing_void, /* switch_text_section */
+ debug_nothing_tree_tree, /* set_name */
0 /* start_end_main_source_file */
};
@@ -67,6 +68,12 @@ debug_nothing_tree (tree decl ATTRIBUTE_UNUSED)
}
void
+debug_nothing_tree_tree (tree t1 ATTRIBUTE_UNUSED,
+ tree t2 ATTRIBUTE_UNUSED)
+{
+}
+
+void
debug_nothing_tree_tree_tree_bool (tree t1 ATTRIBUTE_UNUSED,
tree t2 ATTRIBUTE_UNUSED,
tree t3 ATTRIBUTE_UNUSED,
diff --git a/gcc/debug.h b/gcc/debug.h
index e1ee12e..1169c51 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -126,6 +126,8 @@ struct gcc_debug_hooks
text sections. */
void (* switch_text_section) (void);
+ void (* set_name) (tree, tree);
+
/* This is 1 if the debug writer wants to see start and end commands for the
main source files, and 0 otherwise. */
int start_end_main_source_file;
@@ -140,6 +142,7 @@ extern void debug_nothing_int_charstar (unsigned int, const char *);
extern void debug_nothing_int (unsigned int);
extern void debug_nothing_int_int (unsigned int, unsigned int);
extern void debug_nothing_tree (tree);
+extern void debug_nothing_tree_tree (tree, tree);
extern void debug_nothing_tree_int (tree, int);
extern void debug_nothing_tree_tree_tree_bool (tree, tree, tree, bool);
extern bool debug_true_const_tree (const_tree);
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7d82c47..81a5062 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -4549,6 +4549,7 @@ static void dwarf2out_imported_module_or_decl_1 (tree, tree, tree,
static void dwarf2out_abstract_function (tree);
static void dwarf2out_var_location (rtx);
static void dwarf2out_begin_function (tree);
+static void dwarf2out_set_name (tree, tree);
/* The debug hooks structure. */
@@ -4582,6 +4583,7 @@ const struct gcc_debug_hooks dwarf2_debug_hooks =
debug_nothing_int, /* handle_pch */
dwarf2out_var_location,
dwarf2out_switch_text_section,
+ dwarf2out_set_name,
1 /* start_end_main_source_file */
};
#endif
@@ -5929,12 +5931,9 @@ debug_str_eq (const void *x1, const void *x2)
(const char *)x2) == 0;
}
-/* Add a string attribute value to a DIE. */
-
-static inline void
-add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
+static struct indirect_string_node *
+find_AT_string (const char *str)
{
- dw_attr_node attr;
struct indirect_string_node *node;
void **slot;
@@ -5955,6 +5954,18 @@ add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
node = (struct indirect_string_node *) *slot;
node->refcount++;
+ return node;
+}
+
+/* Add a string attribute value to a DIE. */
+
+static inline void
+add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
+{
+ dw_attr_node attr;
+ struct indirect_string_node *node;
+
+ node = find_AT_string (str);
attr.dw_attr = attr_kind;
attr.dw_attr_val.val_class = dw_val_class_str;
@@ -15763,6 +15774,31 @@ maybe_emit_file (struct dwarf_file_data * fd)
return fd->emitted_number;
}
+/* Replace DW_AT_name for the decl with name. */
+
+static void
+dwarf2out_set_name (tree decl, tree name)
+{
+ dw_die_ref die;
+ dw_attr_ref attr;
+
+ die = TYPE_SYMTAB_DIE (decl);
+ if (!die)
+ return;
+
+ attr = get_AT (die, DW_AT_name);
+ if (attr)
+ {
+ struct indirect_string_node *node;
+
+ node = find_AT_string (dwarf2_name (name, 0));
+ /* replace the string. */
+ attr->dw_attr_val.v.val_str = node;
+ }
+
+ else
+ add_name_attribute (die, dwarf2_name (name, 0));
+}
/* Called by the final INSN scan whenever we see a var location. We
use it to drop labels in the right places, and throw the location in
our lookup table. */
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index 1b64a50..9874db7 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -337,6 +337,7 @@ const struct gcc_debug_hooks sdb_debug_hooks =
debug_nothing_int, /* handle_pch */
debug_nothing_rtx, /* var_location */
debug_nothing_void, /* switch_text_section */
+ debug_nothing_tree_tree, /* set_name */
0 /* start_end_main_source_file */
};
diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c
index c655caa..134c7d9 100644
--- a/gcc/vmsdbgout.c
+++ b/gcc/vmsdbgout.c
@@ -211,6 +211,7 @@ const struct gcc_debug_hooks vmsdbg_debug_hooks
debug_nothing_int, /* handle_pch */
debug_nothing_rtx, /* var_location */
debug_nothing_void, /* switch_text_section */
+ debug_nothing_tree_tree, /* set_name */
0 /* start_end_main_source_file */
};