aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorRafael Espindola <espindola@google.com>2009-04-20 14:09:46 +0000
committerRafael Espindola <espindola@google.com>2009-04-20 14:09:46 +0000
commitee7d4fba3eb1fe0ef18f4badf1fd71100c99309c (patch)
tree9c8d314cc606457ab4eb9ddec739f1c5d2c92008 /gcc/dwarf2out.c
parent20ccb780d272cc40cbb95191d5adf63bd7aa4842 (diff)
2009-04-20 Rafael Avila de Espindola <espindola@google.com>plugins
Merge with mainline @146369. * configure.ac (ACX_PKGVERSION): Update. * configure: Regenerate. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/plugins@146426 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c57
1 files changed, 47 insertions, 10 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7d82c47679a..d4799b163b5 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;
@@ -10889,21 +10900,22 @@ field_byte_offset (const_tree decl)
unsigned HOST_WIDE_INT type_size_in_bits;
type = field_type (decl);
+ type_size_in_bits = simple_type_size_in_bits (type);
+ type_align_in_bits = simple_type_align_in_bits (type);
+
field_size_tree = DECL_SIZE (decl);
/* The size could be unspecified if there was an error, or for
a flexible array member. */
- if (! field_size_tree)
+ if (!field_size_tree)
field_size_tree = bitsize_zero_node;
- /* If we don't know the size of the field, pretend it's a full word. */
+ /* If the size of the field is not constant, use the type size. */
if (host_integerp (field_size_tree, 1))
field_size_in_bits = tree_low_cst (field_size_tree, 1);
else
- field_size_in_bits = BITS_PER_WORD;
+ field_size_in_bits = type_size_in_bits;
- type_size_in_bits = simple_type_size_in_bits (type);
- type_align_in_bits = simple_type_align_in_bits (type);
decl_align_in_bits = simple_decl_align_in_bits (decl);
/* The GCC front-end doesn't make any attempt to keep track of the
@@ -15763,6 +15775,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. */