summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp')
-rw-r--r--clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
index 3e9b97dc3b3..8189f76ba51 100644
--- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -2681,6 +2681,17 @@ TEST(CompletionTest, DerivedMethodsAreAlwaysVisible) {
ElementsAre(AllOf(ReturnType("int"), Named("size"))));
}
+TEST(CompletionTest, NoCrashWithIncompleteLambda) {
+ auto Completions = completions("auto&& x = []{^").Completions;
+ // The completion of x itself can cause a problem: in the code completion
+ // callback, its type is not known, which affects the linkage calculation.
+ // A bad linkage value gets cached, and subsequently updated.
+ EXPECT_THAT(Completions, Contains(Named("x")));
+
+ auto Signatures = signatures("auto x() { x(^").signatures;
+ EXPECT_THAT(Signatures, Contains(Sig("x() -> auto")));
+}
+
TEST(NoCompileCompletionTest, Basic) {
auto Results = completionsNoCompile(R"cpp(
void func() {
OpenPOWER on IntegriCloud