[PATCH] D42073: [clangd] Use accessible scopes to query indexes for global code completion.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 23 02:33:13 PST 2018


hokein added inline comments.


================
Comment at: clangd/CodeComplete.cpp:653
+// Get all scopes that will be queried in indexes.
+std::vector<std::string> getQueryScopes(Sema &S,
+                                        CodeCompletionContext &CCContext) {
----------------
sammccall wrote:
> as Ilya pointed out to me, passing Sema around is a big scary thing that we should try to avoid. Here it's only used to get the text if the CXXScopeSpec is invalid. Can we pass just the SourceManager, or better yet, the text as a StringPiece?
SG, we don't need the Sema to compute the `DeclContext` from scope specifier. SourceManager is the only thing we need from `Sema` now. 


================
Comment at: clangd/CodeComplete.cpp:695
+  Info.UnresolvedQualifier =
+      Lexer::getSourceText(CharSourceRange::getCharRange((*SS)->getRange()),
+                           S.getSourceManager(), clang::LangOptions());
----------------
sammccall wrote:
> do you need to remove any leading :: here?
Not needed, as Sema exclues the trailing "::". Added a comment.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D42073





More information about the cfe-commits mailing list