FreeBSD/contrib/gcc/cp/tree.c
/* Apply FUNC to all language-specific sub-trees of TP in a pre-order
   traversal.  Called from walk_tree.  */
Apply FUNC to all language-specific sub-trees of TP in a pre-order
traversal.
Apply FUNC to all language - specific sub - trees of TP in a pre - order traversal .
tree
cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
		  void *data, struct pointer_set_t *pset)
{
  enum tree_code code = TREE_CODE (*tp);
  location_t save_locus;
  tree result;
#define WALK_SUBTREE(NODE)				\
  do							\
    {							\
      result = walk_tree (&(NODE), func, data, pset);	\
      if (result) goto out;				\
    }							\
  while (0)
  save_locus = input_location;
  if (EXPR_HAS_LOCATION (*tp))
    input_location = EXPR_LOCATION (*tp);
  result = NULL_TREE;
  switch (code)
    {
    case DEFAULT_ARG:
    case TEMPLATE_TEMPLATE_PARM:
    case BOUND_TEMPLATE_TEMPLATE_PARM:
    case UNBOUND_CLASS_TEMPLATE:
    case TEMPLATE_PARM_INDEX:
    case TEMPLATE_TYPE_PARM:
    case TYPENAME_TYPE:
    case TYPEOF_TYPE:
    case BASELINK:
      *walk_subtrees_p = 0;
      break;
    case TINST_LEVEL:
      WALK_SUBTREE (TINST_DECL (*tp));
      *walk_subtrees_p = 0;
      break;
    case PTRMEM_CST:
      WALK_SUBTREE (TREE_TYPE (*tp));
      *walk_subtrees_p = 0;
      break;
    case TREE_LIST:
      WALK_SUBTREE (TREE_PURPOSE (*tp));
      break;
    case OVERLOAD:
      WALK_SUBTREE (OVL_FUNCTION (*tp));
      WALK_SUBTREE (OVL_CHAIN (*tp));
      *walk_subtrees_p = 0;
      break;
    case RECORD_TYPE:
      if (TYPE_PTRMEMFUNC_P (*tp))
	WALK_SUBTREE (TYPE_PTRMEMFUNC_FN_TYPE (*tp));
      break;
    default:
      input_location = save_locus;
      return NULL_TREE;
    }
 out:
  input_location = save_locus;
  return result;
#undef WALK_SUBTREE
}
tree cp_walk_subtrees ( tree * tp , int * walk_subtrees_p , walk_tree_fn func , void * data , struct pointer_set_t * pset ) { enum tree_code code = TREE_CODE ( * tp ) ; location_t save_locus ; tree result ; #define WALK_SUBTREE ( NODE ) 				\
  do							\
    {							\
      result = walk_tree (&(NODE), func, data, pset);	\
      if (result) goto out;				\
    }							\
  while (0) save_locus = input_location ; if ( EXPR_HAS_LOCATION ( * tp ) ) input_location = EXPR_LOCATION ( * tp ) ; result = NULL_TREE ; switch ( code ) { case DEFAULT_ARG : case TEMPLATE_TEMPLATE_PARM : case BOUND_TEMPLATE_TEMPLATE_PARM : case UNBOUND_CLASS_TEMPLATE : case TEMPLATE_PARM_INDEX : case TEMPLATE_TYPE_PARM : case TYPENAME_TYPE : case TYPEOF_TYPE : case BASELINK : * walk_subtrees_p = 0 ; break ; case TINST_LEVEL : WALK_SUBTREE ( TINST_DECL ( * tp ) ) ; * walk_subtrees_p = 0 ; break ; case PTRMEM_CST : WALK_SUBTREE ( TREE_TYPE ( * tp ) ) ; * walk_subtrees_p = 0 ; break ; case TREE_LIST : WALK_SUBTREE ( TREE_PURPOSE ( * tp ) ) ; break ; case OVERLOAD : WALK_SUBTREE ( OVL_FUNCTION ( * tp ) ) ; WALK_SUBTREE ( OVL_CHAIN ( * tp ) ) ; * walk_subtrees_p = 0 ; break ; case RECORD_TYPE : if ( TYPE_PTRMEMFUNC_P ( * tp ) ) WALK_SUBTREE ( TYPE_PTRMEMFUNC_FN_TYPE ( * tp ) ) ; break ; default : input_location = save_locus ; return NULL_TREE ; } out : input_location = save_locus ; return result ; #undef  WALK_SUBTREE }
Apply FUNC to all language-specific sub-trees of TP in a pre-order
traversal.
Apply FUNC to all language - specific sub - trees of TP in a pre - order traversal .
/* Set input_location here so we get the right instantiation context
     if we call instantiate_decl from inlinable_function_p.  */ /* Not one of the easy cases.  We must explicitly go through the
     children.  */ /* None of these have subtrees other than those already walked
	 above.  */ /* We didn't find what we were looking for.  */