Author: sammccall Date: Mon Jan 22 13:05:00 2018 New Revision: 323149 URL: http://llvm.org/viewvc/llvm-project?rev=323149&view=rev Log: [clangd] Drop ~destructor completions - rarely helpful and work inconsistently
Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=323149&r1=323148&r2=323149&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original) +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Mon Jan 22 13:05:00 2018 @@ -361,6 +361,10 @@ struct CompletionRecorder : public CodeC (Result.Availability == CXAvailability_NotAvailable || Result.Availability == CXAvailability_NotAccessible)) continue; + // Destructor completion is rarely useful, and works inconsistently. + // (s.^ completes ~string, but s.~st^ is an error). + if (dyn_cast_or_null<CXXDestructorDecl>(Result.Declaration)) + continue; Results.push_back(Result); } } Modified: clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp?rev=323149&r1=323148&r2=323149&view=diff ============================================================================== --- clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp (original) +++ clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp Mon Jan 22 13:05:00 2018 @@ -461,7 +461,7 @@ TEST(CompletionTest, NoDuplicates) { {cls("Adapter")}); // Make sure there are no duplicate entries of 'Adapter'. - EXPECT_THAT(Results.items, ElementsAre(Named("Adapter"), Named("~Adapter"))); + EXPECT_THAT(Results.items, ElementsAre(Named("Adapter"))); } TEST(CompletionTest, ScopedNoIndex) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits