[PATCH] D53926: [clangd] Only add global scope to completion query scopes for TU context.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 31 08:08:31 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: clangd/CodeComplete.cpp:563
     for (auto *Context : CCContext.getVisitedContexts()) {
-      if (isa<TranslationUnitDecl>(Context))
+      if (isa<TranslationUnitDecl>(Context)) {
         Info.AccessibleScopes.push_back(""); // global namespace
----------------
ioeric wrote:
> ilya-biryukov wrote:
> > Anonymous namespace inside other namespaces will also produce duplicate scopes.
> > Maybe simply remove the duplicates from the vector before we return it?
> `printNamespaceScope()` will return "" for all anonymous namespaces, which should be covered as well.
I don't think that's the case. 
My understanding is that `printNamespaceScope("foo::<anonymous>::bar::<anonymous>")` will return `"foo::bar::"`.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53926





More information about the cfe-commits mailing list