parse.y (parse_scoped_id): New function.

* parse.y (parse_scoped_id): New function.
	(primary): Use it.
	* cp-tree.h (do_scoped_id): Adjust declaration.
	* lex.c (do_scoped_id): Remove call to yylex.
	* decl2.c (build_expr_from_tree): Adjust use of do_scoped_id.
	* typeck2.c (add_exception_specifier): Use tree_cons, rather than
	expanding it inline.

From-SVN: r54930
This commit is contained in:
Mark Mitchell 2002-06-23 20:10:09 +00:00 committed by Mark Mitchell
parent 08c7ae5a51
commit 80b1331c3e
6 changed files with 40 additions and 25 deletions

View File

@ -1,3 +1,13 @@
2002-06-23 Mark Mitchell <mark@codesourcery.com>
* parse.y (parse_scoped_id): New function.
(primary): Use it.
* cp-tree.h (do_scoped_id): Adjust declaration.
* lex.c (do_scoped_id): Remove call to yylex.
* decl2.c (build_expr_from_tree): Adjust use of do_scoped_id.
* typeck2.c (add_exception_specifier): Use tree_cons, rather than
expanding it inline.
2002-06-23 Matt Thomas <matt@3am-software.com>
* decl.c (finish_function): Change "#ifdef VMS_TARGET" to

View File

@ -4044,7 +4044,7 @@ extern void note_list_got_semicolon PARAMS ((tree));
extern void do_pending_lang_change PARAMS ((void));
extern void see_typename PARAMS ((void));
extern tree do_identifier PARAMS ((tree, int, tree));
extern tree do_scoped_id PARAMS ((tree, int));
extern tree do_scoped_id PARAMS ((tree, tree));
extern tree identifier_typedecl_value PARAMS ((tree));
extern tree build_lang_decl PARAMS ((enum tree_code, tree, tree));
extern void retrofit_lang_decl PARAMS ((tree));

View File

@ -3652,7 +3652,10 @@ build_expr_from_tree (t)
case LOOKUP_EXPR:
if (LOOKUP_EXPR_GLOBAL (t))
return do_scoped_id (TREE_OPERAND (t, 0), 0);
{
tree token = TREE_OPERAND (t, 0);
return do_scoped_id (token, IDENTIFIER_GLOBAL_VALUE (token));
}
else
return do_identifier (TREE_OPERAND (t, 0), 0, NULL_TREE);

View File

@ -1281,24 +1281,10 @@ do_identifier (token, parsing, args)
}
tree
do_scoped_id (token, parsing)
do_scoped_id (token, id)
tree token;
int parsing;
tree id;
{
tree id;
/* during parsing, this is ::name. Otherwise, it is black magic. */
if (parsing)
{
id = make_node (CPLUS_BINDING);
if (!qualified_lookup_using_namespace (token, global_namespace, id, 0))
id = NULL_TREE;
else
id = BINDING_VALUE (id);
}
else
id = IDENTIFIER_GLOBAL_VALUE (token);
if (parsing && yychar == YYEMPTY)
yychar = yylex ();
if (!id || (TREE_CODE (id) == FUNCTION_DECL
&& DECL_ANTICIPATED (id)))
{

View File

@ -130,6 +130,7 @@ static tree parse_bitfield PARAMS ((tree, tree, tree));
static tree parse_method PARAMS ((tree, tree, tree));
static void frob_specs PARAMS ((tree, tree));
static void check_class_key PARAMS ((tree, tree));
static tree parse_scoped_id PARAMS ((tree));
/* Cons up an empty parameter list. */
static inline tree
@ -1706,14 +1707,14 @@ primary:
check_for_new_type ("typeid", $3);
$$ = get_typeid (type); }
| global_scope IDENTIFIER
{ $$ = do_scoped_id ($2, 1); }
{ $$ = parse_scoped_id ($2); }
| global_scope template_id
{ $$ = $2; }
| global_scope operator_name
{
got_scope = NULL_TREE;
if (TREE_CODE ($2) == IDENTIFIER_NODE)
$$ = do_scoped_id ($2, 1);
$$ = parse_scoped_id ($2);
else
$$ = $2;
}
@ -4022,4 +4023,23 @@ free_parser_stacks ()
}
}
/* Return the value corresponding to TOKEN in the global scope. */
static tree
parse_scoped_id (token)
tree token;
{
tree id;
id = make_node (CPLUS_BINDING);
if (!qualified_lookup_using_namespace (token, global_namespace, id, 0))
id = NULL_TREE;
else
id = BINDING_VALUE (id);
if (yychar == YYEMPTY)
yychar = yylex();
return do_scoped_id (token, id);
}
#include "gt-cp-parse.h"

View File

@ -1372,11 +1372,7 @@ add_exception_specifier (list, spec, complain)
if (same_type_p (TREE_VALUE (probe), spec))
break;
if (!probe)
{
spec = build_tree_list (NULL_TREE, spec);
TREE_CHAIN (spec) = list;
list = spec;
}
list = tree_cons (NULL_TREE, spec, list);
}
else if (complain)
cxx_incomplete_type_error (NULL_TREE, core);