This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Reimplement ADL
- From: Jason Merrill <jason at redhat dot com>
- To: Nathan Sidwell <nathan at acm dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 25 May 2017 15:07:58 -0400
- Subject: Re: [C++ PATCH] Reimplement ADL
- Authentication-results: sourceware.org; auth=none
- References: <4f2b3ce9-7f06-6a10-f1c9-4542b3651bd0@acm.org>
On Thu, May 25, 2017 at 9:03 AM, Nathan Sidwell <nathan@acm.org> wrote:
> Anyway, this implementation introduces LOOKUP_SEEN_P and LOOKUP_FOUND_P to
> directly mark the DECL node. Hence determination is now O(1) rather than
> O(N^2). We still have a vector to recall which decls we need to unmark at
> the end of the lookup. We need two markers on a class, because depending on
> how we found it we may need to search additional things about it. (These two
> maker bits will be used in later changes too.)
>
> One quirk is that ADL can be recursive. ADL can cause template
> instantiation, which can in turn cause a different ADL to happen. The new
> testcase is an example of this. So, we need to detect this and undo/redo
> the outer DECL marking during the inner ADL. Thus implementing a simple
> chain of ADLs and using their record of which decls got marked to undo/redo.
> The fiddly bit there is recording whether LOOKUP_FOUND_P was set or not
> (LOOKUP_SEEN_P will be). To record that I simply push those DECLS with
> lookup_found_p set onto the stack. They'll thus appear twice, and we can
> infer from the second sighting that it had FOUND_P set (and pop the stack).
> The recursion is a rare event, so we optimize the non-recursive case.
Sounds like it would make sense to use a hash_set rather than flags on
the decls.
Jason