[PATCH] D154068: [clangd] Don't show header for namespace decl in Hover
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 29 08:11:42 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG21b6da35f1d5: [clangd] Don't show header for namespace decl in Hover (authored by hokein).
Changed prior to commit:
https://reviews.llvm.org/D154068?vs=535732&id=535809#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154068/new/
https://reviews.llvm.org/D154068
Files:
clang-tools-extra/clangd/Hover.cpp
clang-tools-extra/clangd/unittests/HoverTests.cpp
Index: clang-tools-extra/clangd/unittests/HoverTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ 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};
Index: clang-tools-extra/clangd/Hover.cpp
===================================================================
--- clang-tools-extra/clangd/Hover.cpp
+++ 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<NamespaceDecl>(DeclToUse))
+ maybeAddSymbolProviders(AST, *HI,
+ include_cleaner::Symbol{*DeclToUse});
} else if (const Expr *E = N->ASTNode.get<Expr>()) {
HoverCountMetric.record(1, "expr");
HI = getHoverContents(N, E, AST, PP, Index);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154068.535809.patch
Type: text/x-patch
Size: 1508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230629/205c1dff/attachment.bin>
More information about the cfe-commits
mailing list