forked from OSchip/llvm-project
When Parser::ParseExpressionList isn't given a completer, fall back to
normal "expression" completion. Fixes the most annoying code-completion bug I've found. llvm-svn: 125715
This commit is contained in:
parent
956fc1cb81
commit
9c1f1bfedc
|
@ -1801,6 +1801,8 @@ bool Parser::ParseExpressionList(llvm::SmallVectorImpl<Expr*> &Exprs,
|
|||
if (Tok.is(tok::code_completion)) {
|
||||
if (Completer)
|
||||
(Actions.*Completer)(getCurScope(), Data, Exprs.data(), Exprs.size());
|
||||
else
|
||||
Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Expression);
|
||||
ConsumeCodeCompletionToken();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,12 @@ void f() {
|
|||
|
||||
}
|
||||
|
||||
int foo();
|
||||
|
||||
void g() {
|
||||
vector<int>(foo(), foo());
|
||||
}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// CHECK-CC1: NotImplemented:{TypedText operator} (40)
|
||||
|
@ -37,3 +43,11 @@ void f() {
|
|||
// CHECK-CC2: ClassDecl:{TypedText string} (50)
|
||||
// CHECK-CC2-NOT: CXXConstructor
|
||||
// CHECK-CC2: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:26:15 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// CHECK-CC3: NotImplemented:{TypedText float} (50)
|
||||
// CHECK-CC3: FunctionDecl:{ResultType int}{TypedText foo}{LeftParen (}{RightParen )} (50)
|
||||
// CHECK-CC3: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{RightParen )} (50)
|
||||
// CHECK-CC3: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
|
||||
// CHECK-CC3: CXXConstructor:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder T const &}{Comma , }{Placeholder unsigned int n}{RightParen )} (50)
|
||||
// CHECK-CC3: FunctionTemplate:{ResultType void}{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder InputIterator first}{Comma , }{Placeholder InputIterator last}{RightParen )} (50)
|
||||
|
|
Loading…
Reference in New Issue