diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp --- a/clang/lib/Parse/ParseExpr.cpp +++ b/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; diff --git a/clang/test/CodeCompletion/call.cpp b/clang/test/CodeCompletion/call.cpp --- a/clang/test/CodeCompletion/call.cpp +++ b/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) }