(C++) still more dwarf2out cleanup
Jason Merrill
jason@cygnus.com
Tue Dec 14 15:04:00 GMT 1999
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.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.132
diff -c -p -r1.132 dwarf2out.c
*** dwarf2out.c 1999/12/06 19:16:52 1.132
--- dwarf2out.c 1999/12/14 23:03:27
*************** local_scope_p (context_die)
*** 7677,7682 ****
--- 7677,7693 ----
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
routine locates the proper "type descriptor" die for the type given
by 'type', and adds an DW_AT_type attribute below the given die. */
*************** gen_subprogram_die (decl, context_die)
*** 8221,8231 ****
register tree fn_arg_types;
register tree outer_scope;
register dw_die_ref old_die = lookup_decl_die (decl);
! register int declaration
! = (current_function_decl != decl
! || (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'
be true, if we started to generate the abstract instance of an inline,
--- 8232,8239 ----
register tree fn_arg_types;
register tree outer_scope;
register dw_die_ref old_die = lookup_decl_die (decl);
! register int declaration = (current_function_decl != decl
! || class_scope_p (context_die));
/* 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,
*************** gen_variable_die (decl, context_die)
*** 8495,8505 ****
register dw_die_ref var_die = new_die (DW_TAG_variable, context_die);
dw_die_ref old_die = lookup_decl_die (decl);
! int declaration
! = (DECL_EXTERNAL (decl)
! || 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)
add_abstract_origin_attribute (var_die, origin);
--- 8503,8510 ----
register dw_die_ref var_die = new_die (DW_TAG_variable, context_die);
dw_die_ref old_die = lookup_decl_die (decl);
! int declaration = (DECL_EXTERNAL (decl)
! || class_scope_p (context_die));
if (origin != NULL)
add_abstract_origin_attribute (var_die, origin);
*************** gen_variable_die (decl, context_die)
*** 8551,8562 ****
if (declaration)
add_AT_flag (var_die, DW_AT_declaration, 1);
! if ((declaration && decl_class_context (decl)) || DECL_ABSTRACT (decl))
equate_decl_number_to_die (decl, var_die);
if (! declaration && ! DECL_ABSTRACT (decl))
{
- equate_decl_number_to_die (decl, var_die);
add_location_or_const_value_attribute (var_die, decl);
add_pubname (decl, var_die);
}
--- 8556,8566 ----
if (declaration)
add_AT_flag (var_die, DW_AT_declaration, 1);
! if (class_scope_p (context_die) || DECL_ABSTRACT (decl))
equate_decl_number_to_die (decl, var_die);
if (! declaration && ! DECL_ABSTRACT (decl))
{
add_location_or_const_value_attribute (var_die, decl);
add_pubname (decl, var_die);
}
*************** gen_struct_or_union_type_die (type, cont
*** 8970,8977 ****
{
add_AT_flag (type_die, DW_AT_declaration, 1);
! /* We can't do this for function-local types, and we don't need to. */
! if (! decl_function_context (TYPE_STUB_DECL (type)))
add_incomplete_type (type);
}
}
--- 8974,8981 ----
{
add_AT_flag (type_die, DW_AT_declaration, 1);
! /* We don't need to do this for function-local types. */
! if (context_die)
add_incomplete_type (type);
}
}
*************** dwarf2out_decl (decl)
*** 9576,9582 ****
/* Ignore this FUNCTION_DECL if it refers to a builtin declaration of a
builtin function. Explicit programmer-supplied declarations of
these same functions should NOT be ignored however. */
! if (DECL_EXTERNAL (decl) && DECL_FUNCTION_CODE (decl))
return;
/* What we would really like to do here is to filter out all mere
--- 9580,9586 ----
/* Ignore this FUNCTION_DECL if it refers to a builtin declaration of a
builtin function. Explicit programmer-supplied declarations of
these same functions should NOT be ignored however. */
! if (DECL_EXTERNAL (decl) && DECL_BUILT_IN (decl))
return;
/* What we would really like to do here is to filter out all mere
More information about the Gcc-patches
mailing list