diff options
author | Richard Stallman <rms@gnu.org> | 1992-07-24 03:30:02 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-07-24 03:30:02 +0000 |
commit | 3abacf028923030c3cf63634f4717e0e1e4b8369 (patch) | |
tree | 69b3d007fbf1753aeb9d7774a578fc32722c2ea7 /gcc | |
parent | 85f5e2b68d38861a759736546ce55cff62538193 (diff) | |
download | gcc-3abacf028923030c3cf63634f4717e0e1e4b8369.zip gcc-3abacf028923030c3cf63634f4717e0e1e4b8369.tar.gz gcc-3abacf028923030c3cf63634f4717e0e1e4b8369.tar.bz2 |
(is_body_block): Rewritten for greater saftey.
(output_block): Fixed to deal correctly with non-inlined blocks.
From-SVN: r1678
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/dwarfout.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index a6d80f0..b1f48f5 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -1091,23 +1091,34 @@ output_signed_leb128 (value) /**************** utility functions for attribute functions ******************/ /* Given a pointer to a BLOCK node return non-zero if (and only if) the - node in question represents the outermost block (i.e. the "body block") - of a function or method. - - For any BLOCK node representing a "body block", the BLOCK_SUPERCONTEXT - of the node will point to another BLOCK node which represents the outer- - most (function) scope for the function or method. The BLOCK_SUPERCONTEXT - of that node in turn will point to the relevant FUNCTION_DECL node. + node in question represents the outermost pair of curly braces (i.e. + the "body block") of a function or method. + + For any BLOCK node representing a "body block" of a function or method, + the BLOCK_SUPERCONTEXT of the node will point to another BLOCK node + which represents the outermost (function) scope for the function or + method (i.e. the one which includes the formal parameters). The + BLOCK_SUPERCONTEXT of *that* node in turn will point to the relevant + FUNCTION_DECL node. */ inline int is_body_block (stmt) register tree stmt; { - register enum tree_code code - = TREE_CODE (BLOCK_SUPERCONTEXT (BLOCK_SUPERCONTEXT (stmt))); + if (TREE_CODE (stmt) == BLOCK) + { + register tree parent = BLOCK_SUPERCONTEXT (stmt); + + if (TREE_CODE (parent) == BLOCK) + { + register tree grandparent = BLOCK_SUPERCONTEXT (parent); - return (code == FUNCTION_DECL); + if (TREE_CODE (grandparent) == FUNCTION_DECL) + return 1; + } + } + return 0; } /* Given a pointer to a tree node for some type, return a Dwarf fundamental @@ -4047,9 +4058,7 @@ output_block (stmt) not represent a "body block inlining" before trying to set the `must_output_die' flag. */ - if (origin != NULL - && origin_code == BLOCK - && ! is_body_block (origin)) + if (origin == NULL || ! is_body_block (origin)) { /* Determine if this block directly contains any "significant" local declarations which we will need to output DIEs for. */ |