aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-05-26 16:34:40 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-05-26 16:34:40 +0000
commite1cad93084f9cd5bcdb3f3b0b6214605c8043871 (patch)
tree143dc4fbc11d439ac1a7854bee45cf8542e9b7a6
parent32196b873a1ba319e9b3fc4cccb910d8cc4d6b31 (diff)
downloadgcc-e1cad93084f9cd5bcdb3f3b0b6214605c8043871.zip
gcc-e1cad93084f9cd5bcdb3f3b0b6214605c8043871.tar.gz
gcc-e1cad93084f9cd5bcdb3f3b0b6214605c8043871.tar.bz2
call.c (build_operator_new_call): Do namelookup and ADL here.
gcc/cp/ * call.c (build_operator_new_call): Do namelookup and ADL here. (build_new_op_1): Likewise. * name-lookup.h (lookup_function_nonclass): Delete declaration. (do_using_directive): Likewise. * name-lookup.c (set_namespace_binding, push_local_binding): Don't declare early. (struct scope_binding): Delete. (EMPTY_SCOPE_BINDING): Delete. (set_decl_namespace): Use OVL_P. (finish_local_using_decl): Lose unnecesary checks. (lookup_function_nonclass): Delete. (cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P. libcc1/ * libcp1plugin.cc (plugin_add_using_namespace): Call finish_namespace_using_directive. From-SVN: r248518
-rw-r--r--gcc/cp/ChangeLog13
-rw-r--r--gcc/cp/call.c15
-rw-r--r--gcc/cp/name-lookup.c32
-rw-r--r--gcc/cp/name-lookup.h2
-rw-r--r--libcc1/ChangeLog5
-rw-r--r--libcc1/libcp1plugin.cc2
6 files changed, 33 insertions, 36 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b1a72ee..88ab214 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,18 @@
2017-05-26 Nathan Sidwell <nathan@acm.org>
+ * call.c (build_operator_new_call): Do namelookup and ADL here.
+ (build_new_op_1): Likewise.
+ * name-lookup.h (lookup_function_nonclass): Delete declaration.
+ (do_using_directive): Likewise.
+ * name-lookup.c (set_namespace_binding, push_local_binding): Don't
+ declare early.
+ (struct scope_binding): Delete.
+ (EMPTY_SCOPE_BINDING): Delete.
+ (set_decl_namespace): Use OVL_P.
+ (finish_local_using_decl): Lose unnecesary checks.
+ (lookup_function_nonclass): Delete.
+ (cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P.
+
* cp-tree.h (OVL_CHAIN): Check looking at OVERLOAD.
(ovl_iterator): Add allow_inner field. Adjust ctor. Make
unduplicatable.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 6b13d6e..c1fcd19 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4318,7 +4318,8 @@ build_operator_new_call (tree fnname, vec<tree, va_gc> **args,
up in the global scope.
we disregard block-scope declarations of "operator new". */
- fns = lookup_function_nonclass (fnname, *args, /*block_p=*/false);
+ fns = lookup_name_real (fnname, 0, 1, /*block_p=*/false, 0, 0);
+ fns = lookup_arg_dependent (fnname, fns, *args);
if (align_arg)
{
@@ -5628,11 +5629,13 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
/* Add namespace-scope operators to the list of functions to
consider. */
if (!memonly)
- add_candidates (lookup_function_nonclass (fnname, arglist,
- /*block_p=*/true),
- NULL_TREE, arglist, NULL_TREE,
- NULL_TREE, false, NULL_TREE, NULL_TREE,
- flags, &candidates, complain);
+ {
+ tree fns = lookup_name_real (fnname, 0, 1, /*block_p=*/true, 0, 0);
+ fns = lookup_arg_dependent (fnname, fns, arglist);
+ add_candidates (fns, NULL_TREE, arglist, NULL_TREE,
+ NULL_TREE, false, NULL_TREE, NULL_TREE,
+ flags, &candidates, complain);
+ }
args[0] = arg1;
args[1] = arg2;
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index b85061f..c167cd2 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -37,16 +37,6 @@ static cxx_binding *cxx_binding_make (tree value, tree type);
static cp_binding_level *innermost_nonclass_level (void);
static void set_identifier_type_value_with_scope (tree id, tree decl,
cp_binding_level *b);
-static void set_namespace_binding (tree scope, tree name, tree val);
-static void push_local_binding (tree, tree, bool);
-
-/* The bindings for a particular name in a particular scope. */
-
-struct scope_binding {
- tree value;
- tree type;
-};
-#define EMPTY_SCOPE_BINDING { NULL_TREE, NULL_TREE }
/* Create a local binding level for NAME. */
@@ -4243,7 +4233,7 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
print_candidates (old);
return;
}
- if (!is_overloaded_fn (decl))
+ if (!OVL_P (decl))
{
/* We might have found OLD in an inline namespace inside SCOPE. */
if (TREE_CODE (decl) == TREE_CODE (old))
@@ -4254,7 +4244,7 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
return;
}
/* Since decl is a function, old should contain a function decl. */
- if (!is_overloaded_fn (old))
+ if (!OVL_P (old))
goto complain;
/* We handle these in check_explicit_instantiation_namespace. */
if (processing_explicit_instantiation)
@@ -4411,6 +4401,7 @@ handle_namespace_attrs (tree ns, tree attributes)
return saw_vis;
}
+
/* Temporarily set the namespace for the current declaration. */
void
@@ -4544,10 +4535,7 @@ finish_local_using_decl (tree decl, tree scope, tree name)
if (decl == NULL_TREE)
return;
- gcc_assert (building_stmt_list_p ());
- if (building_stmt_list_p ()
- && at_function_scope_p ())
- add_decl_expr (decl);
+ add_decl_expr (decl);
cxx_binding *binding = find_local_binding (current_binding_level, name);
tree value = binding ? binding->value : NULL_TREE;
@@ -5308,15 +5296,6 @@ lookup_name_nonclass (tree name)
}
tree
-lookup_function_nonclass (tree name, vec<tree, va_gc> *args, bool block_p)
-{
- return
- lookup_arg_dependent (name,
- lookup_name_real (name, 0, 1, block_p, 0, 0),
- args);
-}
-
-tree
lookup_name (tree name)
{
return lookup_name_real (name, 0, 0, /*block_p=*/true, 0, 0);
@@ -6277,8 +6256,7 @@ cp_emit_debug_info_for_using (tree t, tree context)
if (context == global_namespace)
context = NULL_TREE;
- if (BASELINK_P (t))
- t = BASELINK_FUNCTIONS (t);
+ t = MAYBE_BASELINK_FUNCTIONS (t);
/* FIXME: Handle TEMPLATE_DECLs. */
for (lkp_iterator iter (t); iter; ++iter)
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index ff77517..d41ffd7 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -311,7 +311,6 @@ extern void set_global_binding (tree id, tree val);
extern tree lookup_qualified_name (tree, tree, int, bool, /*hidden*/bool = false);
extern tree lookup_name_nonclass (tree);
extern bool is_local_extern (tree);
-extern tree lookup_function_nonclass (tree, vec<tree, va_gc> *, bool);
extern bool pushdecl_class_level (tree);
extern tree pushdecl_namespace_level (tree, bool);
extern bool push_class_level_binding (tree, tree);
@@ -323,7 +322,6 @@ extern void push_decl_namespace (tree);
extern void pop_decl_namespace (void);
extern void do_namespace_alias (tree, tree);
extern tree do_class_using_decl (tree, tree);
-extern void do_using_directive (tree);
extern tree lookup_arg_dependent (tree, tree, vec<tree, va_gc> *);
extern tree innermost_non_namespace_value (tree);
extern cxx_binding *outer_binding (tree, cxx_binding *, bool);
diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog
index f22ea27..76b6388 100644
--- a/libcc1/ChangeLog
+++ b/libcc1/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-26 Nathan Sidwell <nathan@acm.org>
+
+ * libcp1plugin.cc (plugin_add_using_namespace): Call
+ finish_namespace_using_directive.
+
2017-05-25 Nathan Sidwell <nathan@acm.org>
* libcp1plugin.cc (plugin_make_namespace_inline): Check and set
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 43781ad..877c264 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -946,7 +946,7 @@ plugin_add_using_namespace (cc1_plugin::connection *,
gcc_assert (TREE_CODE (used_ns) == NAMESPACE_DECL);
- do_using_directive (used_ns);
+ finish_namespace_using_directive (used_ns, NULL_TREE);
return 1;
}