[PATCH] D61077: [clangd] Query index in code completion no-compile mode.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 05:27:47 PDT 2019

kadircet added inline comments.

Comment at: clangd/SourceCode.cpp:503
+    case tok::l_brace:
+      if (State == NamespaceName) {
+        // Parsed: namespace <name> {
I believe it is safe to ignore(just mark the opening brace) anonymous namespaces here. Since there were no comments(and no test cases) just wanted to make sure you did not miss that case.

Comment at: clangd/SourceCode.cpp:595
+  });
+  Found.erase(std::unique(Found.begin(), Found.end()), Found.end());
+  return Found;
`scopesForIndexQuery` already de-duplicates. Do you plan to have any other users for the results of this function?

Comment at: clangd/SourceCode.h:169
+/// The returned vector is always non-empty.
+/// - The first element is the namespace that encloses the point: a declaration
+///   near the point would be within this namespace.
Does the code ever make use of it?

Comment at: unittests/clangd/SourceCodeTests.cpp:325
+TEST(SourceCodeTests, VisibleNamespaces) {
+  std::vector<std::pair<const char *, std::vector<std::string>>> Cases = {
NIT: maybe switch to TEST_P ?

  rCTE Clang Tools Extra



More information about the cfe-commits mailing list