hokein added a comment.

With this patch, the index-based code completion will not provide any 
candidates for `ns1::MyClass::^` (as the index-based completion drops all  
results from clang's completion engine), we need a way to combine symbols from 
3 sources (static index, dynamic index and clang's completion engine).



================
Comment at: clangd/index/SymbolCollector.cpp:80
+                                    : decl(unless(isExpansionInMainFile())),
+                hasDeclContext(anyOf(namespaceDecl(), 
translationUnitDecl())))),
+            *D, *ASTCtx)
----------------
These ast matchers seems to be relatively simple, maybe we can use the `Decl` 
methods  to implement them at the moment. Or will we add more complex filters 
in the future?


================
Comment at: clangd/index/SymbolCollector.cpp:116
 
-  if (const NamedDecl *ND = llvm::dyn_cast<NamedDecl>(D)) {
-    // FIXME: Should we include the internal linkage symbols?
-    if (!ND->hasExternalFormalLinkage() || ND->isInAnonymousNamespace())
-      return true;
+  if (shouldFilterDecl(D, ASTCtx, Opts))
+    return true;
----------------
How about moving the this function inside the `if` below? so we don't duplicate 
the  `dyn_cast` twice. 


================
Comment at: clangd/index/SymbolCollector.h:28
+  struct Options {
+    bool IndexMainFiles = false;
+  };
----------------
We need documentation for the options.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D41823



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to