diff --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp --- a/clang-tools-extra/clangd/Hover.cpp +++ b/clang-tools-extra/clangd/Hover.cpp @@ -1374,7 +1374,10 @@ if (!HI->Value) HI->Value = printExprValue(N, AST.getASTContext()).PrintedValue; maybeAddCalleeArgInfo(N, *HI, PP); - maybeAddSymbolProviders(AST, *HI, include_cleaner::Symbol{*DeclToUse}); + + if (!isa(DeclToUse)) + maybeAddSymbolProviders(AST, *HI, + include_cleaner::Symbol{*DeclToUse}); } else if (const Expr *E = N->ASTNode.get()) { HoverCountMetric.record(1, "expr"); HI = getHoverContents(N, E, AST, PP, Index); diff --git a/clang-tools-extra/clangd/unittests/HoverTests.cpp b/clang-tools-extra/clangd/unittests/HoverTests.cpp --- a/clang-tools-extra/clangd/unittests/HoverTests.cpp +++ b/clang-tools-extra/clangd/unittests/HoverTests.cpp @@ -3059,7 +3059,13 @@ } ns::F^oo d; )cpp", - [](HoverInfo &HI) { HI.Provider = "\"foo.h\""; }}}; + [](HoverInfo &HI) { HI.Provider = "\"foo.h\""; }}, + {R"cpp( + namespace foo {}; + using namespace fo^o; + )cpp", + [](HoverInfo &HI) { HI.Provider = ""; }}, + }; for (const auto &Case : Cases) { Annotations Code{Case.Code};