c++: Name lookup simplifications
authorNathan Sidwell <nathan@acm.org>
Tue, 29 Sep 2020 16:38:34 +0000 (09:38 -0700)
committerNathan Sidwell <nathan@acm.org>
Tue, 29 Sep 2020 16:41:50 +0000 (09:41 -0700)
commitadcf8a11c772e7a0c64d4ae3eb19a520566f32b9
treec94405c1757de5e0bc8f56f679b143bfb9f4b4f0
parent74b5b8dec467f922f6c40a320859054081c7bb09
c++: Name lookup simplifications

Here are a few cleanups, prior to landing the hidden decl changes.

1) Clear cxx_binding flags in the allocator, not at each user of the allocator.

2) Refactor update_binding.  The logic was getting too convoluted.

3) Set friendliness and anticipatedness before pushing a template decl (not after).

gcc/cp/
* name-lookup.c (create_local_binding): Do not clear
INHERITED_VALUE_BINDING_P here.
(name_lookup::process_binding): Move done hidden-decl triage to ...
(name_lookup::search_namespace_only): ... here, its only caller.
(cxx_binding_make): Clear flags here.
(push_binding): Not here.
(pop_local_binding): RAII.
(update_binding): Refactor.
(do_pushdecl): Assert we're never revealing a local binding.
(do_pushdecl_with_scope): Directly call do_pushdecl.
(get_class_binding): Do not clear LOCAL_BINDING_P here.
* pt.c (push_template_decl): Set friend & anticipated before
pushing.
gcc/cp/name-lookup.c
gcc/cp/pt.c