[PATCH] D42796: [clangd] Skip inline namespace when collecting scopes for index symbols.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 00:36:08 PST 2018


ilya-biryukov added inline comments.


================
Comment at: clangd/index/SymbolCollector.cpp:74
+    if (llvm::isa<TranslationUnitDecl>(Context) ||
+        llvm::isa<LinkageSpecDecl>(Context))
+      break;
----------------
I may not know enough about the AST, sorry if the question is obvious.
`TranslationUnitDecl` is the root of the tree, but why should we stop at `LinkageSpecDecl`?

This code is probably going away per @hokein's comments.


================
Comment at: clangd/index/SymbolCollector.cpp:195
     llvm::SmallString<128> USR;
+    if (ND->getIdentifier() == nullptr)
+      return true;
----------------
sammccall wrote:
> hokein wrote:
> > Consider moving to `shouldFilterDecl`? We also have a check `if (ND->getDeclName().isEmpty())` there, which I assume does similar thing. 
> hmm, what case is this handling? should `shouldFilterDecl` catch it?
Why do we skip names without identifiers? AFAIK, they are perfectly reasonable C++ entities: overloaded operators, constructors, etc. 


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D42796





More information about the cfe-commits mailing list