Is it possible to tell if function CallExpr/DeclRefExpr is resolved with ADL?

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.

Thanks,

Eric

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.