sourcegraph / scip-clang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing references to size() method in SmallVector code

varungandhi-src opened this issue · comments

The problem is coming up due to this pattern:

template <typename T>
struct Q0 {
  void f() {}
};

template <typename T>
struct Q1: Q0<T> {
  using Base = Q0<T>;
  using Base::f;

  void g() { f(); }
};

We run into an UnresolvedMemberExpr when we see f. The call to lookupDependentName returns an UnresolvedUsingValueDecl, whereas we're expecting a fully resolved declaration. SymbolFormatter doesn't yet support emitting a symbol name for such declarations.

I don't fully understand the name lookup rules/clang API surface to tell if it's possible to get a fully resolved declaration at this point consistently and easily. Need to dig into this more.

It looks like this can be handled properly using Clangd's HeuristicResolver code. Unfortunately, there is no Bazel target exposing that header, and the API perhaps needs a bit of tweaking (we should maybe use one of the private methods on that type, because when we have an UnresolvedMemberExpr, we don't have access toan UnresolvedUsingValueDecl right away, and doing two calls to lookupDependentName seems like the wrong thing to do...).

Maybe we can port a subset of the code as-needed.