This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++ PATCH to walk_tree


I noticed this while working on the NRVO; things were breaking because one
_STMT had decided not to walk its subtrees, which meant that none of the
following _STMTs were walked, either.  Oops.

2001-08-07  Jason Merrill  <jason_merrill@redhat.com>

	* tree.c (walk_tree): Walk siblings even if !walk_subtrees.

*** tree.c.~1~	Tue Aug  7 00:49:37 2001
--- tree.c	Tue Aug  7 12:54:27 2001
*************** walk_tree (tp, func, data, htab)
*** 1198,1209 ****
    if (result)
      return result;
  
    /* Even if we didn't, FUNC may have decided that there was nothing
       interesting below this point in the tree.  */
    if (!walk_subtrees)
!     return NULL_TREE;
! 
!   code = TREE_CODE (*tp);
  
    /* Handle common cases up front.  */
    if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
--- 1198,1215 ----
    if (result)
      return result;
  
+   code = TREE_CODE (*tp);
+ 
    /* Even if we didn't, FUNC may have decided that there was nothing
       interesting below this point in the tree.  */
    if (!walk_subtrees)
!     {
!       if (statement_code_p (code) || code == TREE_LIST || code == OVERLOAD)
! 	/* But we still need to check our siblings.  */
! 	return walk_tree (&TREE_CHAIN (*tp), func, data, htab);
!       else
! 	return NULL_TREE;
!     }
  
    /* Handle common cases up front.  */
    if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]