[PATCH] D73177: [clang][CodeComplete] Make completion work after initializer lists
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 23 06:39:34 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG24364cd12bbf: [clang][CodeComplete] Make completion work after initializer lists (authored by kadircet).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73177/new/
https://reviews.llvm.org/D73177
Files:
clang/lib/Parse/ParseExpr.cpp
clang/test/CodeCompletion/call.cpp
Index: clang/test/CodeCompletion/call.cpp
===================================================================
--- clang/test/CodeCompletion/call.cpp
+++ clang/test/CodeCompletion/call.cpp
@@ -25,4 +25,10 @@
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:13 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2-NOT: f(Y y, int ZZ)
// CHECK-CC2: f(int i, int j, <#int k#>)
+ f({}, 0, 0);
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:28:7 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+ // CHECK-CC3: OVERLOAD: [#void#]f()
+ // CHECK-CC3-NEXT: OVERLOAD: [#void#]f(<#X#>)
+ // CHECK-CC3-NEXT: OVERLOAD: [#void#]f(<#int i#>, int j, int k)
+ // CHECK-CC3-NEXT: OVERLOAD: [#void#]f(<#float x#>, float y)
}
Index: clang/lib/Parse/ParseExpr.cpp
===================================================================
--- clang/lib/Parse/ParseExpr.cpp
+++ clang/lib/Parse/ParseExpr.cpp
@@ -3128,6 +3128,16 @@
if (Tok.is(tok::ellipsis))
Expr = Actions.ActOnPackExpansion(Expr.get(), ConsumeToken());
+ else if (Tok.is(tok::code_completion)) {
+ // There's nothing to suggest in here as we parsed a full expression.
+ // Instead fail and propogate the error since caller might have something
+ // the suggest, e.g. signature help in function call. Note that this is
+ // performed before pushing the \p Expr, so that signature help can report
+ // current argument correctly.
+ SawError = true;
+ cutOffParsing();
+ break;
+ }
if (Expr.isInvalid()) {
SkipUntil(tok::comma, tok::r_paren, StopBeforeMatch);
SawError = true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73177.239882.patch
Type: text/x-patch
Size: 1660 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200123/840c5238/attachment.bin>
More information about the cfe-commits
mailing list