c++: Yet more name-lookup api simplification
authorNathan Sidwell <nathan@acm.org>
Fri, 14 Aug 2020 16:55:33 +0000 (09:55 -0700)
committerNathan Sidwell <nathan@acm.org>
Fri, 14 Aug 2020 17:54:53 +0000 (10:54 -0700)
commitdb1c2a89db09c8fe140ed3e65a707a08737e3b41
treee439889780d093caf396a363abc171c2ec293bc4
parent320054784250e572cb75d6f69ab44b2330d61d8b
c++: Yet more name-lookup api simplification

This patch deals with LOOKUP_HIDDEN, which originally meant 'find
hidden friends', but it's being pressed into service for not ignoring
lambda-relevant internals.  However these two functions are different.
(a) hidden friends can occur in block scope (very uncommon) and (b) it
had the semantics of stopping after the innermost enclosing
namepspace.  That's really suspect for the lambda case, but not
relevant there because we never get to namespace scope (I think).
Anyway, I've split the flag into two and adjusted the lambda callers
to just search block scope.  These two flags are added to the
LOOK_want enum class, which allows dropping another parameter from the
name lookup routines.

The remaining LOOKUP_$FOO flags in cp-tree.h are, I think, now all
related to features of overload resolution, conversion operators and
reference binding.  Nothing to do with /name/ lookup.

gcc/cp/
* cp-tree.h (LOOKUP_HIDDEN): Delete.
(LOOKUP_PREFER_RVALUE): Adjust initializer.
* name-lookup.h (enum class LOOK_want): Add HIDDEN_FRIEND and
HIDDEN_LAMBDA flags.
(lookup_name_real): Drop flags parm.
(lookup_qualified_name): Drop find_hidden parm.
* name-lookup.c (class name_lookup): Drop hidden field, adjust
ctors.
(name_lookup::add_overload): Check want for hiddenness.
(name_lookup::process_binding): Likewise.
(name_lookup::search_unqualified): Likewise.
(identifier_type_value_1): Adjust lookup_name_real call.
(set_decl_namespace): Adjust name_lookup ctor.
(qualify_lookup): Drop flags parm, use want for hiddenness.
(lookup_qualified_name): Drop find_hidden parm.
(lookup_name_real_1): Drop flags parm, adjust qualify_lookup
calls.
(lookup_name_real): Drop flags parm.
(lookup_name_nonclass, lookup_name): Adjust lookup_name_real
calls.
(lookup_type_scope_1): Adjust qualify_lookup calls.
* call.c (build_operator_new_call): Adjust lookup_name_real call.
(add_operator_candidates): Likewise.
* coroutines.cc (morph_fn_to_coro): Adjust lookup_qualified_name
call.
* parser.c (cp_parser_lookup_name): Adjust lookup_name_real calls.
* pt.c (check_explicit_specialization): Adjust
lookup_qualified_name call.
(deduction_guides_for): Likewise.
(tsubst_friend_class): Adjust lookup_name_real call.
(lookup_init_capture_pack): Likewise.
(tsubst_expr): Likewise, don't look in namespaces.
* semantics.c (capture_decltype): Adjust lookup_name_real.  Don't
look in namespaces.
libcc1/
* libcp1plugin.cc (plugin_build_dependent_exp): Adjust
lookup_name_real call.
gcc/cp/call.c
gcc/cp/coroutines.cc
gcc/cp/cp-tree.h
gcc/cp/name-lookup.c
gcc/cp/name-lookup.h
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/semantics.c
libcc1/libcp1plugin.cc