summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeCompletion/lambdas.cpp
diff options
context:
space:
mode:
authorKirill Bobyrev <kbobyrev@google.com>2019-11-22 12:48:06 +0100
committerKirill Bobyrev <kbobyrev@google.com>2019-11-22 12:48:06 +0100
commit7f0dcf665dd22be296805bc7a1c71a36243c4e09 (patch)
treee7587448ef2ab88b426493594a12b50051d8097a /clang/test/CodeCompletion/lambdas.cpp
parent0b0dca9f6fe34333abdb437bd1d3d92c8362a2e6 (diff)
downloadbcm5719-llvm-7f0dcf665dd22be296805bc7a1c71a36243c4e09.tar.gz
bcm5719-llvm-7f0dcf665dd22be296805bc7a1c71a36243c4e09.zip
[clangd] Show lambda signature for lambda autocompletions
The original bug report can be found [here](https://github.com/clangd/clangd/issues/85) Given the following code: ```c++ void function() { auto Lambda = [](int a, double &b) {return 1.f;}; La^ } ``` Triggering the completion at `^` would show `(lambda)` before this patch and would show signature `(int a, double &b) const`, build a snippet etc with this patch. Reviewers: sammccall Reviewed by: sammccall Differential revision: https://reviews.llvm.org/D70445
Diffstat (limited to 'clang/test/CodeCompletion/lambdas.cpp')
-rw-r--r--clang/test/CodeCompletion/lambdas.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/CodeCompletion/lambdas.cpp b/clang/test/CodeCompletion/lambdas.cpp
index 05c47b8c2a4..3e431a330f4 100644
--- a/clang/test/CodeCompletion/lambdas.cpp
+++ b/clang/test/CodeCompletion/lambdas.cpp
@@ -60,3 +60,15 @@ void test5() {
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:57:24 %s -o - | FileCheck -check-prefix=CHECK-8 %s
// CHECK-8-NOT: COMPLETION: Pattern : [<#=
}
+
+void test6() {
+ auto my_lambda = [&](int a, double &b) { return 1.f; };
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:65:58 %s -o - | FileCheck -check-prefix=CHECK-9 %s
+ // CHECK-9: [#float#]my_lambda(<#int a#>, <#double &b#>)[# const#]
+}
+
+void test7() {
+ auto generic_lambda = [&](auto a, const auto &b) { return a + b; };
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:71:70 %s -o - | FileCheck -check-prefix=CHECK-10 %s
+ // CHECK-10: [#auto#]generic_lambda(<#auto a#>, <#const auto &b#>)[# const#]
+}
OpenPOWER on IntegriCloud