[PATCH] D53571: [clangd] Don't show base class versions of members as completions.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 24 06:50:27 PDT 2018
sammccall updated this revision to Diff 170875.
sammccall added a comment.
Rebase
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D53571
Files:
clangd/CodeComplete.cpp
unittests/clangd/CodeCompleteTests.cpp
Index: unittests/clangd/CodeCompleteTests.cpp
===================================================================
--- unittests/clangd/CodeCompleteTests.cpp
+++ unittests/clangd/CodeCompleteTests.cpp
@@ -381,10 +381,13 @@
void test() { Bar().^ }
)cpp");
EXPECT_THAT(Results.Completions,
- HasSubsequence(AllOf(Qualifier(""), Named("bar")),
- AllOf(Qualifier("Foo::"), Named("foo"))));
+ Contains(AllOf(Qualifier(""), Named("bar"))));
+ // Hidden members are not shown.
EXPECT_THAT(Results.Completions,
- Not(Contains(AllOf(Qualifier(""), Named("foo"))))); // private
+ Not(Contains(AllOf(Qualifier("Foo::"), Named("foo")))));
+ // Private members are not shown.
+ EXPECT_THAT(Results.Completions,
+ Not(Contains(AllOf(Qualifier(""), Named("foo")))));
}
TEST(CompletionTest, InjectedTypename) {
Index: clangd/CodeComplete.cpp
===================================================================
--- clangd/CodeComplete.cpp
+++ clangd/CodeComplete.cpp
@@ -728,9 +728,9 @@
// Retain the results we might want.
for (unsigned I = 0; I < NumResults; ++I) {
auto &Result = InResults[I];
- // Drop hidden items which cannot be found by lookup after completion.
- // Exception: some items can be named by using a qualifier.
- if (Result.Hidden && (!Result.Qualifier || Result.QualifierIsInformative))
+ // Class members that are shadowed by subclasses are usually noise.
+ if (Result.Hidden && Result.Declaration &&
+ Result.Declaration->isCXXClassMember())
continue;
if (!Opts.IncludeIneligibleResults &&
(Result.Availability == CXAvailability_NotAvailable ||
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53571.170875.patch
Type: text/x-patch
Size: 1745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181024/74e06906/attachment.bin>
More information about the cfe-commits
mailing list