r361510 - [CodeComplete] Only show lambda completions if patterns are requested
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Thu May 23 09:39:26 PDT 2019
Author: ibiryukov
Date: Thu May 23 09:39:26 2019
New Revision: 361510
URL: http://llvm.org/viewvc/llvm-project?rev=361510&view=rev
Log:
[CodeComplete] Only show lambda completions if patterns are requested
This is a trivial follow-up to r361461, so sending without review.
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/CodeCompletion/lambdas.cpp
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=361510&r1=361509&r2=361510&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Thu May 23 09:39:26 2019
@@ -4134,6 +4134,8 @@ static const FunctionProtoType *TryDecon
static void AddLambdaCompletion(ResultBuilder &Results,
llvm::ArrayRef<QualType> Parameters,
const LangOptions &LangOpts) {
+ if (!Results.includeCodePatterns())
+ return;
CodeCompletionBuilder Completion(Results.getAllocator(),
Results.getCodeCompletionTUInfo());
// [](<parameters>) {}
Modified: cfe/trunk/test/CodeCompletion/lambdas.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/lambdas.cpp?rev=361510&r1=361509&r2=361510&view=diff
==============================================================================
--- cfe/trunk/test/CodeCompletion/lambdas.cpp (original)
+++ cfe/trunk/test/CodeCompletion/lambdas.cpp Thu May 23 09:39:26 2019
@@ -51,3 +51,12 @@ void test4() {
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:50:35 %s -o - | FileCheck -check-prefix=CHECK-6 %s
// CHECK-6-NOT: COMPLETION: Pattern : [<#=
}
+
+void test5() {
+ // Completions are only added when -code-completion-patterns are enabled.
+ function<void()> b = {};
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:57:24 %s -o - | FileCheck -check-prefix=CHECK-7 %s
+ // CHECK-7: COMPLETION: Pattern : [<#=
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:57:24 %s -o - | FileCheck -check-prefix=CHECK-8 %s
+ // CHECK-8-NOT: COMPLETION: Pattern : [<#=
+}
More information about the cfe-commits
mailing list