Skip to content

Commit d2a9592

Browse files
committed
[clangd] Drop ~destructor completions - rarely helpful and work inconsistently
llvm-svn: 323149
1 parent 63c5972 commit d2a9592

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

clang-tools-extra/clangd/CodeComplete.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ struct CompletionRecorder : public CodeCompleteConsumer {
361361
(Result.Availability == CXAvailability_NotAvailable ||
362362
Result.Availability == CXAvailability_NotAccessible))
363363
continue;
364+
// Destructor completion is rarely useful, and works inconsistently.
365+
// (s.^ completes ~string, but s.~st^ is an error).
366+
if (dyn_cast_or_null<CXXDestructorDecl>(Result.Declaration))
367+
continue;
364368
Results.push_back(Result);
365369
}
366370
}

clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ TEST(CompletionTest, NoDuplicates) {
461461
{cls("Adapter")});
462462

463463
// Make sure there are no duplicate entries of 'Adapter'.
464-
EXPECT_THAT(Results.items, ElementsAre(Named("Adapter"), Named("~Adapter")));
464+
EXPECT_THAT(Results.items, ElementsAre(Named("Adapter")));
465465
}
466466

467467
TEST(CompletionTest, ScopedNoIndex) {

0 commit comments

Comments
 (0)