c++: ADL refactor
authorNathan Sidwell <nathan@acm.org>
Mon, 9 Nov 2020 12:59:59 +0000 (04:59 -0800)
committerNathan Sidwell <nathan@acm.org>
Mon, 9 Nov 2020 13:09:50 +0000 (05:09 -0800)
commite38cd64ac6cb4da740d643589c857d2f910b6bba
tree5c093d0bbd7c14c6a8b90eae000dc6ced7380833
parent4081596e852a3a1c2baaa5aa5bb539a8de1a78a3
c++: ADL refactor

This refactors the ADL lookup.  It just so happens the refactoring
makes dropping modules in simpler :) We break apart the namespace and
class fn processing, and move scope iteration to an outer function.
It'll also become possible to find the same enum in multiple place, so
we need to handle that idempotently.

gcc/cp/
* cp-tree.h (LOOKUP_FOUND_P): Add ENUMERAL_TYPE.
* name-lookup.c (class name_lookup): Add comments.
(name_lookup::adl_namespace_only): Replace with ...
(name_lookup::adl_class_fns): ... this and ...
(name_lookup::adl_namespace_fns): ... this.
(name_lookup::adl_namespace): Deal with inline nests here.
(name_lookup::adl_class): Complete the type here.
(name_lookup::adl_type): Call broken-out enum ..
(name_lookup::adl_enum): New.  No need to call the namespace adl
if it is class-scope.
(name_lookup::search_adl): Iterate over collected scopes here.
gcc/cp/cp-tree.h
gcc/cp/name-lookup.c