[PATCH] D54300: [clangd] Respect shouldIndexFile when collecting symbols.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 9 04:46:34 PST 2018

ioeric added inline comments.

Comment at: clangd/index/SymbolCollector.cpp:555
+  auto Loc = findNameLoc(&ND);
+  if (!shouldIndexFile(SM, SM.getFileID(Loc), Opts, &FilesToIndexCache))
+    return nullptr;
Should we use `getTokenLocation` like what we do below?

Comment at: clangd/index/SymbolCollector.cpp:614
-void SymbolCollector::addDefinition(const NamedDecl &ND,
-                                    const Symbol &DeclSym) {
-  if (DeclSym.Definition)
+void SymbolCollector::addDefinition(const NamedDecl &ND, SymbolID ID,
+                                    const Symbol *DeclSym) {
IIUC, if `D` is declared in d.h that is filtered out and defined in d.cc that is not filtered, this would only create a basic symbol with definition? 

I think what we want is a full symbol with declaration, definition, includes etc. This is one assumption we make in order for the merging in auto-index to work.

  rCTE Clang Tools Extra


More information about the cfe-commits mailing list