From aea9695ca5c18f6aba6d429b0a593411f37b5c0f Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Tue, 22 Jan 2002 11:33:52 +0000 Subject: [PATCH] dwarf2out.c (equate_decl_number_to_die): Add "int" to decls. * dwarf2out.c (equate_decl_number_to_die): Add "int" to decls. (loc_descriptor_from_tree, case CALL_EXPR, case ADDR_EXPR): New. (add_bound_info, default): If can't find a context, make a SAVE_EXPR. (dwarf2out_finish): Check for SAVE_EXPR in node->created_for. From-SVN: r49069 --- gcc/ChangeLog | 8 ++++++++ gcc/dwarf2out.c | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d026309..0f91fb5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +Tue Jan 22 06:26:33 2002 Richard Kenner + + * dwarf2out.c (equate_decl_number_to_die): Add "int" to decls. + (loc_descriptor_from_tree, case CALL_EXPR, case ADDR_EXPR): New. + (add_bound_info, default): If can't find a context, make a + SAVE_EXPR. + (dwarf2out_finish): Check for SAVE_EXPR in node->created_for. + 2002-01-22 Hans-Peter Nilsson * c-typeck.c (parser_build_binary_op): If result from diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index c0b9958..18fcfb0 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -5116,8 +5116,8 @@ equate_decl_number_to_die (decl, decl_die) tree decl; dw_die_ref decl_die; { - unsigned decl_id = DECL_UID (decl); - unsigned num_allocated; + unsigned int decl_id = DECL_UID (decl); + unsigned int num_allocated; if (decl_id >= decl_die_table_allocated) { @@ -7973,6 +7973,24 @@ loc_descriptor_from_tree (loc, addressp) the names of types. */ return 0; + case CALL_EXPR: + return 0; + + case ADDR_EXPR: + /* We can support this only if we can look through conversions and + find an INDIRECT_EXPR. */ + for (loc = TREE_OPERAND (loc, 0); + TREE_CODE (loc) == CONVERT_EXPR || TREE_CODE (loc) == NOP_EXPR + || TREE_CODE (loc) == NON_LVALUE_EXPR + || TREE_CODE (loc) == VIEW_CONVERT_EXPR + || TREE_CODE (loc) == SAVE_EXPR; + loc = TREE_OPERAND (loc, 0)) + ; + + return (TREE_CODE (loc) == INDIRECT_REF + ? loc_descriptor_from_tree (TREE_OPERAND (loc, 0), addressp) + : 0); + case VAR_DECL: case PARM_DECL: { @@ -9077,6 +9095,15 @@ add_bound_info (subrange_die, bound_attr, bound) else ctx = lookup_decl_die (current_function_decl); + /* If we weren't able to find a context, it's most likely the case + that we are processing the return type of the function. So + make a SAVE_EXPR to point to it and have the limbo DIE code + find the proper die. The save_expr function doesn't always + make a SAVE_EXPR, so do it ourselves. */ + if (ctx == 0) + bound = build (SAVE_EXPR, TREE_TYPE (bound), bound, + current_function_decl, NULL_TREE); + decl_die = new_die (DW_TAG_variable, ctx, bound); add_AT_flag (decl_die, DW_AT_artificial, 1); add_type_attribute (decl_die, TREE_TYPE (bound), 1, 0, ctx); @@ -12013,6 +12040,15 @@ dwarf2out_finish (input_filename) add_child_die (origin->die_parent, die); else if (die == comp_unit_die) ; + /* If this was an expression for a bound involved in a function + return type, it may be a SAVE_EXPR for which we weren't able + to find a DIE previously. So try now. */ + else if (node->created_for + && TREE_CODE (node->created_for) == SAVE_EXPR + && 0 != (origin = (lookup_decl_die + (SAVE_EXPR_CONTEXT + (node->created_for))))) + add_child_die (origin, die); else if (node->created_for && ((DECL_P (node->created_for) && (context = DECL_CONTEXT (node->created_for))) -- 2.7.4