aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2013-08-19 14:23:37 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2013-08-19 14:23:37 +0000
commit9485d254d16e4f64b5c853b8f16a6cd476cf333b (patch)
tree56a2ea14fd30ce50d4202acac83a48c945c4a6e4
parentd33d9e47d4392e7cb82d8cd585807cf72872e11d (diff)
downloadgcc-9485d254d16e4f64b5c853b8f16a6cd476cf333b.zip
gcc-9485d254d16e4f64b5c853b8f16a6cd476cf333b.tar.gz
gcc-9485d254d16e4f64b5c853b8f16a6cd476cf333b.tar.bz2
parser.c (cp_parser_lambda_introducer, [...]): Use cp_parser_lookup_name_simple.
2013-08-19 Paolo Carlini <paolo.carlini@oracle.com> * parser.c (cp_parser_lambda_introducer, cp_parser_decltype_expr): Use cp_parser_lookup_name_simple. 2013-08-19 Paolo Carlini <paolo.carlini@oracle.com> * name-lookup.h (pop_bindings_and_leave_scope): Declare. * name-lookup.c (pop_bindings_and_leave_scope): Define. * parser.c (cp_parser_lambda_declarator_opt, cp_parser_direct_declarator, cp_parser_cache_defarg): Use it. From-SVN: r201839
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/name-lookup.c11
-rw-r--r--gcc/cp/name-lookup.h1
-rw-r--r--gcc/cp/parser.c38
4 files changed, 32 insertions, 30 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 71dcfb8..e4bf669 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,15 @@
+2013-08-19 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * parser.c (cp_parser_lambda_introducer, cp_parser_decltype_expr):
+ Use cp_parser_lookup_name_simple.
+
+2013-08-19 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * name-lookup.h (pop_bindings_and_leave_scope): Declare.
+ * name-lookup.c (pop_bindings_and_leave_scope): Define.
+ * parser.c (cp_parser_lambda_declarator_opt,
+ cp_parser_direct_declarator, cp_parser_cache_defarg): Use it.
+
2013-08-17 Jason Merrill <jason@redhat.com>
PR c++/58083
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index cf6c757..b09e85b 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -392,6 +392,17 @@ pop_binding (tree id, tree decl)
}
}
+/* Remove the bindings for the decls of the current level and leave
+ the current scope. */
+
+void
+pop_bindings_and_leave_scope (void)
+{
+ for (tree t = getdecls (); t; t = DECL_CHAIN (t))
+ pop_binding (DECL_NAME (t), t);
+ leave_scope ();
+}
+
/* Strip non dependent using declarations. */
tree
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index 11cdd1f..57641a1 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -89,6 +89,7 @@ typedef struct GTY(()) cxx_saved_binding {
extern tree identifier_type_value (tree);
extern void set_identifier_type_value (tree, tree);
extern void pop_binding (tree, tree);
+extern void pop_bindings_and_leave_scope (void);
extern tree constructor_name (tree);
extern bool constructor_name_p (tree, tree);
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c5d398a..923277b 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -8710,15 +8710,8 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)
/* Turn the identifier into an id-expression. */
capture_init_expr
- = cp_parser_lookup_name
- (parser,
- capture_id,
- none_type,
- /*is_template=*/false,
- /*is_namespace=*/false,
- /*check_dependency=*/true,
- /*ambiguous_decls=*/NULL,
- capture_token->location);
+ = cp_parser_lookup_name_simple (parser, capture_id,
+ capture_token->location);
if (capture_init_expr == error_mark_node)
{
@@ -8809,7 +8802,6 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
tree param_list = void_list_node;
tree attributes = NULL_TREE;
tree exception_spec = NULL_TREE;
- tree t;
/* The lambda-declarator is optional, but must begin with an opening
parenthesis if present. */
@@ -8824,7 +8816,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
/* Default arguments shall not be specified in the
parameter-declaration-clause of a lambda-declarator. */
- for (t = param_list; t; t = TREE_CHAIN (t))
+ for (tree t = param_list; t; t = TREE_CHAIN (t))
if (TREE_PURPOSE (t))
pedwarn (DECL_SOURCE_LOCATION (TREE_VALUE (t)), OPT_Wpedantic,
"default argument specified for lambda parameter");
@@ -8853,10 +8845,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
/* The function parameters must be in scope all the way until after the
trailing-return-type in case of decltype. */
- for (t = current_binding_level->names; t; t = DECL_CHAIN (t))
- pop_binding (DECL_NAME (t), t);
-
- leave_scope ();
+ pop_bindings_and_leave_scope ();
}
/* Create the function call operator.
@@ -11583,13 +11572,8 @@ cp_parser_decltype_expr (cp_parser *parser,
if (identifier_p (expr))
/* Lookup the name we got back from the id-expression. */
- expr = cp_parser_lookup_name (parser, expr,
- none_type,
- /*is_template=*/false,
- /*is_namespace=*/false,
- /*check_dependency=*/true,
- /*ambiguous_decls=*/NULL,
- id_expr_start_token->location);
+ expr = cp_parser_lookup_name_simple (parser, expr,
+ id_expr_start_token->location);
if (expr
&& expr != error_mark_node
@@ -16741,7 +16725,6 @@ cp_parser_direct_declarator (cp_parser* parser,
tree params;
unsigned saved_num_template_parameter_lists;
bool is_declarator = false;
- tree t;
/* In a member-declarator, the only valid interpretation
of a parenthesis is the start of a
@@ -16830,9 +16813,7 @@ cp_parser_direct_declarator (cp_parser* parser,
}
/* Remove the function parms from scope. */
- for (t = current_binding_level->names; t; t = DECL_CHAIN (t))
- pop_binding (DECL_NAME (t), t);
- leave_scope();
+ pop_bindings_and_leave_scope ();
if (is_declarator)
/* Repeat the main loop. */
@@ -24101,7 +24082,6 @@ cp_parser_cache_defarg (cp_parser *parser, bool nsdmi)
the default argument; otherwise the default
argument continues. */
bool error = false;
- tree t;
/* Set ITALP so cp_parser_parameter_declaration_list
doesn't decide to commit to this parse. */
@@ -24123,9 +24103,7 @@ cp_parser_cache_defarg (cp_parser *parser, bool nsdmi)
{
begin_scope (sk_function_parms, NULL_TREE);
cp_parser_parameter_declaration_list (parser, &error);
- for (t = current_binding_level->names; t; t = DECL_CHAIN (t))
- pop_binding (DECL_NAME (t), t);
- leave_scope ();
+ pop_bindings_and_leave_scope ();
}
if (!cp_parser_error_occurred (parser) && !error)
done = true;