From 5e7486f518fe796227ebdac12c558f34c41aef32 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 15 Nov 2018 12:17:41 +0000 Subject: [PATCH] [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 llvm-svn: 346947 --- clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp index 2a245837b479..1e6a67855069 100644 --- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp +++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp @@ -58,6 +58,10 @@ std::vector getSymbolIDsFromIndex(StringRef QualifiedName, 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 SymIDs;