diff options
author | rms <rms@138bc75d-0d04-0410-961f-82ee72b054a4> | 1992-07-24 03:30:02 +0000 |
---|---|---|
committer | rms <rms@138bc75d-0d04-0410-961f-82ee72b054a4> | 1992-07-24 03:30:02 +0000 |
commit | bc581b7213dc279f5a2e17aa8e37609dc9da61a8 (patch) | |
tree | 69b3d007fbf1753aeb9d7774a578fc32722c2ea7 /gcc/dwarfout.c | |
parent | e8a2f012514e2e4d27e49aeb84b1dc6f172ffac5 (diff) | |
download | gcc-bc581b7213dc279f5a2e17aa8e37609dc9da61a8.tar.gz |
(is_body_block): Rewritten for greater saftey.
(output_block): Fixed to deal correctly with non-inlined blocks.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@1678 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarfout.c')
-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 a6d80f058db..b1f48f5e92a 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. */ |