Commit d7248bff by Jason Merrill

*** empty log message ***

From-SVN: r12903
parent af6d53df
...@@ -6282,37 +6282,22 @@ gen_subprogram_die (decl, context_die) ...@@ -6282,37 +6282,22 @@ gen_subprogram_die (decl, context_die)
(if it has one - it may be just a declaration). */ (if it has one - it may be just a declaration). */
outer_scope = DECL_INITIAL (decl); outer_scope = DECL_INITIAL (decl);
if (outer_scope && TREE_CODE (outer_scope) != ERROR_MARK)
{
/* Note that here, `outer_scope' is a pointer to the outermost BLOCK /* Note that here, `outer_scope' is a pointer to the outermost BLOCK
node created to represent a function. This outermost BLOCK actually node created to represent a function. This outermost BLOCK actually
represents the outermost binding contour for the function, i.e. the represents the outermost binding contour for the function, i.e. the
contour in which the function's formal parameters and labels get contour in which the function's formal parameters and labels get
declared. Curiously, it appears that the front end doesn't actually declared. Curiously, it appears that the front end doesn't actually
put the PARM_DECL nodes for the current function onto the BLOCK_VARS put the PARM_DECL nodes for the current function onto the BLOCK_VARS
list for this outer scope. (They are strung off of the list for this outer scope. (They are strung off of the DECL_ARGUMENTS
DECL_ARGUMENTS list for the function instead.) The BLOCK_VARS list list for the function instead.) The BLOCK_VARS list for the
for the `outer_scope' does provide us with a list of the LABEL_DECL `outer_scope' does provide us with a list of the LABEL_DECL nodes for
nodes for the function however, and we output DWARF info for those the function however, and we output DWARF info for those in
here. Just within the `outer_scope' there will be another BLOCK node decls_for_scope. Just within the `outer_scope' there will be a BLOCK
representing the function's outermost pair of curly braces. We node representing the function's outermost pair of curly braces, and
musn't generate a lexical_block DIE for this outermost pair of curly any blocks used for the base and member initializers of a C++
braces because that is not really an independent scope according to constructor function. */
ANSI C rules. Rather, it is the same scope in which the parameters if (outer_scope && TREE_CODE (outer_scope) != ERROR_MARK)
were declared. */ decls_for_scope (outer_scope, subr_die, 0);
for (label = BLOCK_VARS (outer_scope);
label;
label = TREE_CHAIN (label))
{
gen_decl_die (label, subr_die);
}
/* Note here that `BLOCK_SUBBLOCKS (outer_scope)' points to a list of
BLOCK nodes which is always only one element long. That one element
represents the outermost pair of curley braces for the function
body. */
decls_for_scope (BLOCK_SUBBLOCKS (outer_scope), subr_die);
}
} }
/* Generate a DIE to represent a declared data object. */ /* Generate a DIE to represent a declared data object. */
...@@ -6418,9 +6403,10 @@ gen_label_die (decl, context_die) ...@@ -6418,9 +6403,10 @@ gen_label_die (decl, context_die)
/* Generate a DIE for a lexical block. */ /* Generate a DIE for a lexical block. */
static void static void
gen_lexical_block_die (stmt, context_die) gen_lexical_block_die (stmt, context_die, depth)
register tree stmt; register tree stmt;
register dw_die_ref context_die; register dw_die_ref context_die;
int depth;
{ {
register dw_die_ref stmt_die = new_die (DW_TAG_lexical_block, context_die); register dw_die_ref stmt_die = new_die (DW_TAG_lexical_block, context_die);
char label[MAX_ARTIFICIAL_LABEL_BYTES]; char label[MAX_ARTIFICIAL_LABEL_BYTES];
...@@ -6431,27 +6417,28 @@ gen_lexical_block_die (stmt, context_die) ...@@ -6431,27 +6417,28 @@ gen_lexical_block_die (stmt, context_die)
sprintf (label, BLOCK_END_LABEL_FMT, next_block_number); sprintf (label, BLOCK_END_LABEL_FMT, next_block_number);
add_AT_lbl_id (stmt_die, DW_AT_high_pc, label); add_AT_lbl_id (stmt_die, DW_AT_high_pc, label);
} }
decls_for_scope (stmt, stmt_die); decls_for_scope (stmt, stmt_die, depth);
} }
/* Generate a DIE for an inlined subprogram. */ /* Generate a DIE for an inlined subprogram. */
static void static void
gen_inlined_subroutine_die (stmt, context_die) gen_inlined_subroutine_die (stmt, context_die, depth)
register tree stmt; register tree stmt;
register dw_die_ref context_die; register dw_die_ref context_die;
int depth;
{ {
if (!BLOCK_ABSTRACT (stmt))
{
register dw_die_ref subr_die = new_die (DW_TAG_inlined_subroutine, register dw_die_ref subr_die = new_die (DW_TAG_inlined_subroutine,
context_die); context_die);
char label[MAX_ARTIFICIAL_LABEL_BYTES]; char label[MAX_ARTIFICIAL_LABEL_BYTES];
add_abstract_origin_attribute (subr_die, block_ultimate_origin (stmt)); add_abstract_origin_attribute (subr_die, block_ultimate_origin (stmt));
if (!BLOCK_ABSTRACT (stmt))
{
sprintf (label, BLOCK_BEGIN_LABEL_FMT, next_block_number); sprintf (label, BLOCK_BEGIN_LABEL_FMT, next_block_number);
add_AT_lbl_id (subr_die, DW_AT_low_pc, label); add_AT_lbl_id (subr_die, DW_AT_low_pc, label);
sprintf (label, BLOCK_END_LABEL_FMT, next_block_number); sprintf (label, BLOCK_END_LABEL_FMT, next_block_number);
add_AT_lbl_id (subr_die, DW_AT_high_pc, label); add_AT_lbl_id (subr_die, DW_AT_high_pc, label);
decls_for_scope (stmt, subr_die, depth);
} }
decls_for_scope (stmt, subr_die);
} }
/* Generate a DIE for a field in a record, or structure. */ /* Generate a DIE for a field in a record, or structure. */
...@@ -6921,9 +6908,10 @@ gen_tagged_type_instantiation_die (type, context_die) ...@@ -6921,9 +6908,10 @@ gen_tagged_type_instantiation_die (type, context_die)
/* Generate a DW_TAG_lexical_block DIE followed by DIEs to represent all of the /* Generate a DW_TAG_lexical_block DIE followed by DIEs to represent all of the
things which are local to the given block. */ things which are local to the given block. */
static void static void
gen_block_die (stmt, context_die) gen_block_die (stmt, context_die, depth)
register tree stmt; register tree stmt;
register dw_die_ref context_die; register dw_die_ref context_die;
int depth;
{ {
register int must_output_die = 0; register int must_output_die = 0;
register tree origin; register tree origin;
...@@ -6963,7 +6951,7 @@ gen_block_die (stmt, context_die) ...@@ -6963,7 +6951,7 @@ gen_block_die (stmt, context_die)
rules. So we check here to make sure that this block does not rules. So we check here to make sure that this block does not
represent a "body block inlining" before trying to set the represent a "body block inlining" before trying to set the
`must_output_die' flag. */ `must_output_die' flag. */
if (origin == NULL || !is_body_block (origin)) if (! is_body_block (origin ? origin : stmt))
{ {
/* Determine if this block directly contains any "significant" /* Determine if this block directly contains any "significant"
local declarations which we will need to output DIEs for. */ local declarations which we will need to output DIEs for. */
...@@ -7002,23 +6990,24 @@ gen_block_die (stmt, context_die) ...@@ -7002,23 +6990,24 @@ gen_block_die (stmt, context_die)
{ {
if (origin_code == FUNCTION_DECL) if (origin_code == FUNCTION_DECL)
{ {
gen_inlined_subroutine_die (stmt, context_die); gen_inlined_subroutine_die (stmt, context_die, depth);
} }
else else
{ {
gen_lexical_block_die (stmt, context_die); gen_lexical_block_die (stmt, context_die, depth);
} }
} }
else else
decls_for_scope (stmt, context_die); decls_for_scope (stmt, context_die, depth);
} }
/* Generate all of the decls declared within a given scope and (recursively) /* Generate all of the decls declared within a given scope and (recursively)
all of it's sub-blocks. */ all of it's sub-blocks. */
static void static void
decls_for_scope (stmt, context_die) decls_for_scope (stmt, context_die, depth)
register tree stmt; register tree stmt;
register dw_die_ref context_die; register dw_die_ref context_die;
int depth;
{ {
register tree decl; register tree decl;
register tree subblocks; register tree subblocks;
...@@ -7027,7 +7016,7 @@ decls_for_scope (stmt, context_die) ...@@ -7027,7 +7016,7 @@ decls_for_scope (stmt, context_die)
{ {
return; return;
} }
if (!BLOCK_ABSTRACT (stmt)) if (!BLOCK_ABSTRACT (stmt) && depth > 0)
{ {
next_block_number++; next_block_number++;
} }
...@@ -7047,7 +7036,7 @@ decls_for_scope (stmt, context_die) ...@@ -7047,7 +7036,7 @@ decls_for_scope (stmt, context_die)
subblocks != NULL; subblocks != NULL;
subblocks = BLOCK_CHAIN (subblocks)) subblocks = BLOCK_CHAIN (subblocks))
{ {
gen_block_die (subblocks, context_die); gen_block_die (subblocks, context_die, depth + 1);
} }
} }
......
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