Perform code-completion within ParseCastExpression, which handles,

e.g., the right-hand side of binary expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100526 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2010-04-06 15:09:27 +00:00
Родитель 7969f936a1
Коммит 64538cfd34
2 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -897,11 +897,16 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
}
case tok::caret:
return ParsePostfixExpressionSuffix(ParseBlockLiteralExpression());
case tok::code_completion:
Actions.CodeCompleteOrdinaryName(CurScope, Action::CCC_Expression);
ConsumeToken();
return ParseCastExpression(isUnaryExpression, isAddressOfOperand,
NotCastExpr, TypeOfCast);
case tok::l_square:
// These can be followed by postfix-expr pieces.
if (getLang().ObjC1)
return ParsePostfixExpressionSuffix(ParseObjCMessageExpression());
// FALL THROUGH.
// FALL THROUGH.
default:
NotCastExpr = true;
return ExprError();

Просмотреть файл

@ -0,0 +1,15 @@
// Note: the run lines follow their respective tests, since line/column
// matter in this test.
int f(int);
int test(int i, int j, int k, int l) {
return i | j | k & l;
}
// RUN: c-index-test -code-completion-at=%s:7:9 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )}
// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
// RUN: c-index-test -code-completion-at=%s:7:14 %s | FileCheck -check-prefix=CHECK-CC1 %s
// RUN: c-index-test -code-completion-at=%s:7:18 %s | FileCheck -check-prefix=CHECK-CC1 %s
// RUN: c-index-test -code-completion-at=%s:7:22 %s | FileCheck -check-prefix=CHECK-CC1 %s