+2009-04-08 Jakub Jelinek <jakub@redhat.com>
+
+ * dwarf2out.c (class_scope_p): New static inline.
+ (class_or_namespace_scope_p): Use it.
+ (gen_variable_die): Use DW_TAG_member tag for static data member
+ declarations instead of DW_TAG_variable.
+
2009-04-08 Richard Guenther <rguenther@suse.de>
* tree-ssa-sccvn.c (valueize_refs): Do not continue to
static void pop_decl_scope (void);
static dw_die_ref scope_die_for (tree, dw_die_ref);
static inline int local_scope_p (dw_die_ref);
+static inline int class_scope_p (dw_die_ref);
static inline int class_or_namespace_scope_p (dw_die_ref);
static void add_type_attribute (dw_die_ref, tree, int, int, dw_die_ref);
static void add_calling_convention_attribute (dw_die_ref, tree);
return 0;
}
-/* Returns nonzero if CONTEXT_DIE is a class or namespace, for deciding
- whether or not to treat a DIE in this context as a declaration. */
+/* Returns nonzero if CONTEXT_DIE is a class. */
static inline int
-class_or_namespace_scope_p (dw_die_ref context_die)
+class_scope_p (dw_die_ref context_die)
{
return (context_die
&& (context_die->die_tag == DW_TAG_structure_type
|| context_die->die_tag == DW_TAG_class_type
|| context_die->die_tag == DW_TAG_interface_type
- || context_die->die_tag == DW_TAG_union_type
- || context_die->die_tag == DW_TAG_namespace));
+ || context_die->die_tag == DW_TAG_union_type));
+}
+
+/* Returns nonzero if CONTEXT_DIE is a class or namespace, for deciding
+ whether or not to treat a DIE in this context as a declaration. */
+
+static inline int
+class_or_namespace_scope_p (dw_die_ref context_die)
+{
+ return (class_scope_p (context_die)
+ || (context_die && context_die->die_tag == DW_TAG_namespace));
}
/* Many forms of DIEs require a "type description" attribute. This
&& old_die->die_parent == context_die)
return;
- var_die = new_die (DW_TAG_variable, context_die, decl);
+ /* For static data members, the declaration in the class is supposed
+ to have DW_TAG_member tag; the specification should still be
+ DW_TAG_variable referencing the DW_TAG_member DIE. */
+ if (declaration && class_scope_p (context_die))
+ var_die = new_die (DW_TAG_member, context_die, decl);
+ else
+ var_die = new_die (DW_TAG_variable, context_die, decl);
origin_die = NULL;
if (origin != NULL)