[PATCH] D89670: [clangd] Store the containing symbol for refs

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 02:03:48 PDT 2020


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/index/SymbolCollector.cpp:349
+        SymbolRef{SM.getFileLoc(Loc), Roles,
+                  dyn_cast_or_null<NamedDecl>(ASTNode.Parent)});
   // Don't continue indexing if this is a mere reference.
----------------
What does `ASTNode.Parent` correspond to in here? I couldn't find any clarifications on libIndex side, are we sure that's always what we want? It would be nice to have some tests demonstrating what this corresponds to in a variety of cases.

Also why do we only store `NamedDecl`s as containers? It makes sense from CallHierarchy perspective as we are only interested in function-like containers, and they are nameddecls (?). But these might as well be `TranslationUnitDecl` (?) for top level declarations,


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89670



More information about the cfe-commits mailing list