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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 14:23:21 PST 2018


sammccall added inline comments.


================
Comment at: clangd/CodeComplete.cpp:350
+      std::string QueryScope =
+          (normalizeScope(VS) +
+           (UnresolvedQualifier
----------------
sammccall wrote:
> It seems like you have stored the scopes in an unknown format, and call "normalizeScope" defensively? Seems cleaner if you ensure both the scopes and unknown are in the form:
>   - global = ""
>   - top-level = "::foo"
>   - nested = "::foo::bar"
> 
> Then this code can produce similarly-formatted output with just:
> 
>   Results.push_back(VS);
>   if (UnresolvedQualifier)
>     Results.back() += *UnresolvedQualifier;
> 
> We need to trim leading `::` before sending to the index, but I think that's because we got the index API wrong. I'll send a patch to fix it.
(that patch landed as rL323000)


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D42073





More information about the cfe-commits mailing list