[clang-tools-extra] r346947 - [clangd] Fix no results returned for global symbols in dexp

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 15 04:17:41 PST 2018


Author: hokein
Date: Thu Nov 15 04:17:41 2018
New Revision: 346947

URL: http://llvm.org/viewvc/llvm-project?rev=346947&view=rev
Log:
[clangd] Fix no results returned for global symbols in dexp

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

Reviewers: ioeric

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D54519

Modified:
    clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp

Modified: clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp?rev=346947&r1=346946&r2=346947&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp Thu Nov 15 04:17:41 2018
@@ -58,6 +58,10 @@ std::vector<SymbolID> getSymbolIDsFromIn
   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;




More information about the cfe-commits mailing list