Commit 9765e357 by Jason Merrill Committed by Jason Merrill

dwarf2out.c (class_scope_p): New fn.

        * dwarf2out.c (class_scope_p): New fn.
        (gen_subprogram_die): Use it.
        (gen_variable_die): Use it.  Tweak logic.
        (gen_struct_or_union_type_die): Check context_die to determine
        if we're function-local.
        (dwarf2out_decl): Check DECL_BUILT_IN, not DECL_FUNCTION_CODE.

From-SVN: r30931
parent cf69bfbf
1999-12-14 Jason Merrill <jason@casey.cygnus.com>
* dwarf2out.c (class_scope_p): New fn.
(gen_subprogram_die): Use it.
(gen_variable_die): Use it. Tweak logic.
(gen_struct_or_union_type_die): Check context_die to determine
if we're function-local.
(dwarf2out_decl): Check DECL_BUILT_IN, not DECL_FUNCTION_CODE.
1999-12-14 Bernd Schmidt <bernds@cygnus.co.uk> 1999-12-14 Bernd Schmidt <bernds@cygnus.co.uk>
* loop.c (check_dbra_loop): Can't reverse a biv that has * loop.c (check_dbra_loop): Can't reverse a biv that has
......
...@@ -7677,6 +7677,17 @@ local_scope_p (context_die) ...@@ -7677,6 +7677,17 @@ local_scope_p (context_die)
return 0; return 0;
} }
/* Returns nonzero iff CONTEXT_DIE is a class. */
static inline int
class_scope_p (context_die)
dw_die_ref context_die;
{
return (context_die
&& (context_die->die_tag == DW_TAG_structure_type
|| context_die->die_tag == DW_TAG_union_type));
}
/* Many forms of DIEs require a "type description" attribute. This /* Many forms of DIEs require a "type description" attribute. This
routine locates the proper "type descriptor" die for the type given routine locates the proper "type descriptor" die for the type given
by 'type', and adds an DW_AT_type attribute below the given die. */ by 'type', and adds an DW_AT_type attribute below the given die. */
...@@ -8221,11 +8232,8 @@ gen_subprogram_die (decl, context_die) ...@@ -8221,11 +8232,8 @@ gen_subprogram_die (decl, context_die)
register tree fn_arg_types; register tree fn_arg_types;
register tree outer_scope; register tree outer_scope;
register dw_die_ref old_die = lookup_decl_die (decl); register dw_die_ref old_die = lookup_decl_die (decl);
register int declaration register int declaration = (current_function_decl != decl
= (current_function_decl != decl || class_scope_p (context_die));
|| (context_die
&& (context_die->die_tag == DW_TAG_structure_type
|| context_die->die_tag == DW_TAG_union_type)));
/* Note that it is possible to have both DECL_ABSTRACT and `declaration' /* Note that it is possible to have both DECL_ABSTRACT and `declaration'
be true, if we started to generate the abstract instance of an inline, be true, if we started to generate the abstract instance of an inline,
...@@ -8495,11 +8503,8 @@ gen_variable_die (decl, context_die) ...@@ -8495,11 +8503,8 @@ gen_variable_die (decl, context_die)
register dw_die_ref var_die = new_die (DW_TAG_variable, context_die); register dw_die_ref var_die = new_die (DW_TAG_variable, context_die);
dw_die_ref old_die = lookup_decl_die (decl); dw_die_ref old_die = lookup_decl_die (decl);
int declaration int declaration = (DECL_EXTERNAL (decl)
= (DECL_EXTERNAL (decl) || class_scope_p (context_die));
|| current_function_decl != decl_function_context (decl)
|| context_die->die_tag == DW_TAG_structure_type
|| context_die->die_tag == DW_TAG_union_type);
if (origin != NULL) if (origin != NULL)
add_abstract_origin_attribute (var_die, origin); add_abstract_origin_attribute (var_die, origin);
...@@ -8551,12 +8556,11 @@ gen_variable_die (decl, context_die) ...@@ -8551,12 +8556,11 @@ gen_variable_die (decl, context_die)
if (declaration) if (declaration)
add_AT_flag (var_die, DW_AT_declaration, 1); add_AT_flag (var_die, DW_AT_declaration, 1);
if ((declaration && decl_class_context (decl)) || DECL_ABSTRACT (decl)) if (class_scope_p (context_die) || DECL_ABSTRACT (decl))
equate_decl_number_to_die (decl, var_die); equate_decl_number_to_die (decl, var_die);
if (! declaration && ! DECL_ABSTRACT (decl)) if (! declaration && ! DECL_ABSTRACT (decl))
{ {
equate_decl_number_to_die (decl, var_die);
add_location_or_const_value_attribute (var_die, decl); add_location_or_const_value_attribute (var_die, decl);
add_pubname (decl, var_die); add_pubname (decl, var_die);
} }
...@@ -8970,8 +8974,8 @@ gen_struct_or_union_type_die (type, context_die) ...@@ -8970,8 +8974,8 @@ gen_struct_or_union_type_die (type, context_die)
{ {
add_AT_flag (type_die, DW_AT_declaration, 1); add_AT_flag (type_die, DW_AT_declaration, 1);
/* We can't do this for function-local types, and we don't need to. */ /* We don't need to do this for function-local types. */
if (! decl_function_context (TYPE_STUB_DECL (type))) if (context_die)
add_incomplete_type (type); add_incomplete_type (type);
} }
} }
...@@ -9576,7 +9580,7 @@ dwarf2out_decl (decl) ...@@ -9576,7 +9580,7 @@ dwarf2out_decl (decl)
/* Ignore this FUNCTION_DECL if it refers to a builtin declaration of a /* Ignore this FUNCTION_DECL if it refers to a builtin declaration of a
builtin function. Explicit programmer-supplied declarations of builtin function. Explicit programmer-supplied declarations of
these same functions should NOT be ignored however. */ these same functions should NOT be ignored however. */
if (DECL_EXTERNAL (decl) && DECL_FUNCTION_CODE (decl)) if (DECL_EXTERNAL (decl) && DECL_BUILT_IN (decl))
return; return;
/* What we would really like to do here is to filter out all mere /* What we would really like to do here is to filter out all mere
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment