llvm-gcc-4.2-2.9/gcc/cp/parser.c
/* FN is a FUNCTION_DECL which may contains a parameter with an
   unparsed DEFAULT_ARG.  Parse the default args now.  This function
   assumes that the current scope is the scope in which the default
   argument should be processed.  */
FN is a FUNCTION_DECL which may contains a parameter with an
unparsed DEFAULT_ARG.  Parse the default args now.  This function
assumes that the current scope is the scope in which the default
argument should be processed.
FN is a FUNCTION_DECL which may contains a parameter with an unparsed DEFAULT_ARG . Parse the default args now . This function assumes that the current scope is the scope in which the default argument should be processed .
static void
cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
{
  bool saved_local_variables_forbidden_p;
  tree parm;
  parser->unparsed_functions_queues
    = tree_cons (NULL_TREE, NULL_TREE, parser->unparsed_functions_queues);
  saved_local_variables_forbidden_p = parser->local_variables_forbidden_p;
  parser->local_variables_forbidden_p = true;
  for (parm = TYPE_ARG_TYPES (TREE_TYPE (fn));
       parm;
       parm = TREE_CHAIN (parm))
    {
      cp_token_cache *tokens;
      tree default_arg = TREE_PURPOSE (parm);
      tree parsed_arg;
      VEC(tree,gc) *insts;
      tree copy;
      unsigned ix;
      if (!default_arg)
	continue;
      if (TREE_CODE (default_arg) != DEFAULT_ARG)
	continue;
      tokens = DEFARG_TOKENS (default_arg);
      cp_parser_push_lexer_for_tokens (parser, tokens);
      parsed_arg = cp_parser_assignment_expression (parser, false);
      if (!processing_template_decl)
	parsed_arg = check_default_argument (TREE_VALUE (parm), parsed_arg);
      TREE_PURPOSE (parm) = parsed_arg;
      for (insts = DEFARG_INSTANTIATIONS (default_arg), ix = 0;
	   VEC_iterate (tree, insts, ix, copy); ix++)
	TREE_PURPOSE (copy) = parsed_arg;
      if (!cp_lexer_next_token_is (parser->lexer, CPP_EOF))
	cp_parser_error (parser, "expected %<,%>");
      cp_parser_pop_lexer (parser);
    }
  check_default_args (fn);
  parser->local_variables_forbidden_p = saved_local_variables_forbidden_p;
  parser->unparsed_functions_queues
    = TREE_CHAIN (parser->unparsed_functions_queues);
}
static void cp_parser_late_parsing_default_args ( cp_parser * parser , tree fn ) { bool saved_local_variables_forbidden_p ; tree parm ; parser -> unparsed_functions_queues = tree_cons ( NULL_TREE , NULL_TREE , parser -> unparsed_functions_queues ) ; saved_local_variables_forbidden_p = parser -> local_variables_forbidden_p ; parser -> local_variables_forbidden_p = true ; for ( parm = TYPE_ARG_TYPES ( TREE_TYPE ( fn ) ) ; parm ; parm = TREE_CHAIN ( parm ) ) { cp_token_cache * tokens ; tree default_arg = TREE_PURPOSE ( parm ) ; tree parsed_arg ; VEC ( tree , gc ) * insts ; tree copy ; unsigned ix ; if ( ! default_arg ) continue ; if ( TREE_CODE ( default_arg ) != DEFAULT_ARG ) continue ; tokens = DEFARG_TOKENS ( default_arg ) ; cp_parser_push_lexer_for_tokens ( parser , tokens ) ; parsed_arg = cp_parser_assignment_expression ( parser , false ) ; if ( ! processing_template_decl ) parsed_arg = check_default_argument ( TREE_VALUE ( parm ) , parsed_arg ) ; TREE_PURPOSE ( parm ) = parsed_arg ; for ( insts = DEFARG_INSTANTIATIONS ( default_arg ) , ix = 0 ; VEC_iterate ( tree , insts , ix , copy ) ; ix ++ ) TREE_PURPOSE ( copy ) = parsed_arg ; if ( ! cp_lexer_next_token_is ( parser -> lexer , CPP_EOF ) ) cp_parser_error ( parser , " " ) ; cp_parser_pop_lexer ( parser ) ; } check_default_args ( fn ) ; parser -> local_variables_forbidden_p = saved_local_variables_forbidden_p ; parser -> unparsed_functions_queues = TREE_CHAIN ( parser -> unparsed_functions_queues ) ; }
FN is a FUNCTION_DECL which may contains a parameter with an
unparsed DEFAULT_ARG.
FN is a FUNCTION_DECL which may contains a parameter with an unparsed DEFAULT_ARG .
/* While we're parsing the default args, we might (due to the
     statement expression extension) encounter more classes.  We want
     to handle them right away, but we don't want them getting mixed
     up with default args that are currently in the queue.  */ /* Local variable names (and the `this' keyword) may not appear
     in a default argument.  */ /* This can happen for a friend declaration for a function
	   already declared with default arguments.  */ /* Push the saved tokens for the default argument onto the parser's
	  lexer stack.  */ /* Parse the assignment-expression.  */ /*cast_p=*/ /* Update any instantiations we've already created.  */ /* If the token stream has not been completely used up, then
	 there was extra junk after the end of the default
	 argument.  */ /* Revert to the main lexer.  */ /* Make sure no default arg is missing.  */ /* Restore the state of local_variables_forbidden_p.  */ /* Restore the queue.  */