* 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
+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
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));
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);
}
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)))
{
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
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;
}
}
}
+/* 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"
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);