[PATCH] D94785: [clangd] Index local classes, virtual and overriding methods.

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 17 15:10:38 PST 2021


nridge added a comment.

In D94785#2501806 <https://reviews.llvm.org/D94785#2501806>, @usaxena95 wrote:

> Although now that I enabled this in all SymbolCollectorTests, this causes a regression in RefContainers.
>
>   void f2() {
>         (void) $ref1a[[f1]](1);
>         auto fptr = &$ref1b[[f1]];
>       }
>
> `&f1` is contained in `fptr` instead of `f2`. No immediate ideas why would this happen.

I have a theory as to why.

If you look at the next test case in `RefContainers`:

  int $toplevel2[[v1]] = $ref2[[f1]](2);

here, `v1` is a global variable, and it is the containing symbol for the reference in the initializer.

So, I think libIndex considers references in initializers to be contained in the declaration of the variable. The reason this didn't happen for local variables until now, is that `IndexFunctionLocals` was false, and libIndex probably avoids returning non-indexed symbols in `ASTNode::Parent`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94785/new/

https://reviews.llvm.org/D94785



More information about the cfe-commits mailing list