[cfe-commits] r100526 - in /cfe/trunk: lib/Parse/ParseExpr.cpp test/Index/complete-exprs.c
Douglas Gregor
dgregor at apple.com
Tue Apr 6 08:09:28 PDT 2010
Author: dgregor
Date: Tue Apr 6 10:09:27 2010
New Revision: 100526
URL: http://llvm.org/viewvc/llvm-project?rev=100526&view=rev
Log:
Perform code-completion within ParseCastExpression, which handles,
e.g., the right-hand side of binary expressions.
Added:
cfe/trunk/test/Index/complete-exprs.c (with props)
Modified:
cfe/trunk/lib/Parse/ParseExpr.cpp
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=100526&r1=100525&r2=100526&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Tue Apr 6 10:09:27 2010
@@ -897,11 +897,16 @@
}
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();
Added: cfe/trunk/test/Index/complete-exprs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-exprs.c?rev=100526&view=auto
==============================================================================
--- cfe/trunk/test/Index/complete-exprs.c (added)
+++ cfe/trunk/test/Index/complete-exprs.c Tue Apr 6 10:09:27 2010
@@ -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
Propchange: cfe/trunk/test/Index/complete-exprs.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/Index/complete-exprs.c
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/Index/complete-exprs.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the cfe-commits
mailing list