[cfe-dev] Is it possible to tell if function CallExpr/DeclRefExpr is resolved with ADL?

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Wed Jul 11 10:54:14 PDT 2018


On Wed, Jul 11, 2018 at 6:35 AM Eric Liu <ioeric at google.com> wrote:

> Example:
> ```
> namespace nx {
> class X {};
> void ff(X &x) {}
> }  // namespace nx
>
> int main() {
>   nx::X x;
>   ff(x);   // ADL
> }
> ```
>
> I am wondering if this is possible given the reference expression and the
> ASTContext.
>

You could redo the unqualified lookup from the context of the call
expression, filter out any lookup results that are first declared after the
expression, and see if the callee is in the resultant lookup set. Other
than that, no, we don't track that information on the AST.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180711/954e110f/attachment.html>


More information about the cfe-dev mailing list