Commit b3a44a4c by Mark Mitchell Committed by Mark Mitchell

tree.c (walk_tree): Don't recurse into DECL_INITIAL or DECL_SIZE unless...

	* tree.c (walk_tree): Don't recurse into DECL_INITIAL or DECL_SIZE
	unless we're declaring the variable in question.

From-SVN: r30816
parent 2fb9811e
1999-12-06 Mark Mitchell <mark@codesourcery.com> 1999-12-06 Mark Mitchell <mark@codesourcery.com>
* tree.c (walk_tree): Don't recurse into DECL_INITIAL or DECL_SIZE
unless we're declaring the variable in question.
1999-12-06 Mark Mitchell <mark@codesourcery.com>
* decl.c (init_decl_processing): #if 0 last patch. * decl.c (init_decl_processing): #if 0 last patch.
(finish_function): Likewise. (finish_function): Likewise.
......
...@@ -1618,7 +1618,7 @@ walk_tree (tp, func, data) ...@@ -1618,7 +1618,7 @@ walk_tree (tp, func, data)
code = TREE_CODE (*tp); code = TREE_CODE (*tp);
/* Handle commmon cases up front. */ /* Handle common cases up front. */
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)) if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
|| TREE_CODE_CLASS (code) == 'r' || TREE_CODE_CLASS (code) == 'r'
|| TREE_CODE_CLASS (code) == 's') || TREE_CODE_CLASS (code) == 's')
...@@ -1632,7 +1632,22 @@ walk_tree (tp, func, data) ...@@ -1632,7 +1632,22 @@ walk_tree (tp, func, data)
/* For statements, we also walk the chain so that we cover the /* For statements, we also walk the chain so that we cover the
entire statement tree. */ entire statement tree. */
if (statement_code_p (code)) if (statement_code_p (code))
{
if (code == DECL_STMT
&& DECL_STMT_DECL (*tp)
&& TREE_CODE_CLASS (TREE_CODE (DECL_STMT_DECL (*tp))) == 'd')
{
/* Walk the DECL_INITIAL and DECL_SIZE. We don't want to walk
into declarations that are just mentioned, rather than
declared; they don't really belong to this part of the tree.
And, we can see cycles: the initializer for a declaration can
refer to the declaration itself. */
WALK_SUBTREE (DECL_INITIAL (DECL_STMT_DECL (*tp)));
WALK_SUBTREE (DECL_SIZE (DECL_STMT_DECL (*tp)));
}
WALK_SUBTREE (TREE_CHAIN (*tp)); WALK_SUBTREE (TREE_CHAIN (*tp));
}
/* We didn't find what we were looking for. */ /* We didn't find what we were looking for. */
return NULL_TREE; return NULL_TREE;
...@@ -1640,8 +1655,6 @@ walk_tree (tp, func, data) ...@@ -1640,8 +1655,6 @@ walk_tree (tp, func, data)
else if (TREE_CODE_CLASS (code) == 'd') else if (TREE_CODE_CLASS (code) == 'd')
{ {
WALK_SUBTREE (TREE_TYPE (*tp)); WALK_SUBTREE (TREE_TYPE (*tp));
WALK_SUBTREE (DECL_INITIAL (*tp));
WALK_SUBTREE (DECL_SIZE (*tp));
/* We didn't find what we were looking for. */ /* We didn't find what we were looking for. */
return NULL_TREE; return NULL_TREE;
......
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