jkorous updated this revision to Diff 172951. jkorous marked 4 inline comments as done. jkorous added a comment.
Rewritten tests to shared implementation different cases. https://reviews.llvm.org/D52554 Files: unittests/clangd/CodeCompleteTests.cpp
Index: unittests/clangd/CodeCompleteTests.cpp =================================================================== --- unittests/clangd/CodeCompleteTests.cpp +++ unittests/clangd/CodeCompleteTests.cpp @@ -2204,6 +2204,115 @@ {cls("naber"), cls("nx::naber")}, Opts); EXPECT_THAT(Results.Completions, UnorderedElementsAre()); } + +TEST(CompletionTest, NoCompletionForSpecialMembers) { + clangd::CodeCompleteOptions Opts; + for( auto& testcase : { + R"cpp( + struct foo {}; + void bar() { + foo a; + a.^ + )cpp", + R"cpp( + template<class T> struct foo {}; + void bar() { + foo<int> a; + a.^ + )cpp", + R"cpp( + template<class T> struct foo {}; template<> struct foo<bool> {}; + void bar() { + foo<bool> a; + a.^ + )cpp", + R"cpp( + struct foo {}; + void bar() { + foo* b; + b->^ + )cpp", + R"cpp( + template<class T> struct foo {}; + void bar() { + foo<int>* b; + b->^ + )cpp", + R"cpp( + template<class T> struct foo {}; template<> struct foo<bool> {}; + void bar() { + foo<bool>* b; + b->^ + )cpp", + R"cpp( + struct foo {}; + foo::^ + )cpp", + R"cpp( + template<class T> struct foo {}; + foo<int>::^ + )cpp", + R"cpp( + template<class T> struct foo {}; template<> struct foo<bool> {}; + foo<bool>::^ + )cpp", + R"cpp( + struct foo { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + void bar() { + foo a; + a.^ + )cpp", + R"cpp( + struct foo { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + void bar() { + foo* b; + b->^ + )cpp", + R"cpp( + struct foo { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + foo::^ + )cpp", + R"cpp( + template<class T> struct foo { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + void bar() { + foo<int> a; + a.^ + )cpp", + R"cpp( + template<class T> struct foo { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + void bar() { + foo<int>* b; + b->^ + )cpp", + R"cpp( + template<class T> struct foo { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + foo<int>::^ + )cpp", + R"cpp( + template<class T> struct foo { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + template<> struct foo<bool> { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + void bar() { + foo<bool> a; + a.^ + )cpp", + R"cpp( + template<class T> struct foo { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + template<> struct foo<bool> { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + void bar() { + foo<bool>* b; + b->^ + )cpp", + R"cpp( + template<class T> struct foo { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + template<> struct foo<bool> { foo(); ~foo(); foo& operator=(const foo&); foo& operator=(foo&&); }; + foo<bool>::^ + )cpp" + }) { + auto Results = completions(testcase, /*IndexSymbols=*/{}, Opts); + EXPECT_THAT(Results.Completions, IsEmpty()) << testcase; + } +} + } // namespace } // namespace clangd } // namespace clang
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits