[PATCH] D54519: [clangd] Fix no results returned for global symbols in dexp

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 14 02:54:30 PST 2018


hokein created this revision.
hokein added a reviewer: ioeric.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay, ilya-biryukov.

For symbols in global namespace (without any scope), we need to
add global scope "" to the fuzzy request.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54519

Files:
  clangd/index/dex/dexp/Dexp.cpp


Index: clangd/index/dex/dexp/Dexp.cpp
===================================================================
--- clangd/index/dex/dexp/Dexp.cpp
+++ clangd/index/dex/dexp/Dexp.cpp
@@ -58,6 +58,10 @@
   auto Names = splitQualifiedName(QualifiedName);
   if (IsGlobalScope || !Names.first.empty())
     Request.Scopes = {Names.first};
+  else
+    // QualifiedName refers to a symbol in global scope (e.g. "GlobalSymbol"),
+    // add the global scope to the request.
+    Request.Scopes = {""};
 
   Request.Query = Names.second;
   std::vector<SymbolID> SymIDs;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54519.174005.patch
Type: text/x-patch
Size: 558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181114/393642e2/attachment.bin>


More information about the cfe-commits mailing list