[cfe-commits] r116754 - in /cfe/trunk: lib/Parse/ParseExpr.cpp test/Index/complete-blocks.m
Douglas Gregor
dgregor at apple.com
Mon Oct 18 14:34:55 PDT 2010
Author: dgregor
Date: Mon Oct 18 16:34:55 2010
New Revision: 116754
URL: http://llvm.org/viewvc/llvm-project?rev=116754&view=rev
Log:
Provide code completion for types after the '^' that starts a block
literal.
Modified:
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/test/Index/complete-blocks.m
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=116754&r1=116753&r2=116754&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Mon Oct 18 16:34:55 2010
@@ -1743,6 +1743,11 @@
/// [clang] specifier-qualifier-list block-declarator
///
void Parser::ParseBlockId() {
+ if (Tok.is(tok::code_completion)) {
+ Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Type);
+ ConsumeCodeCompletionToken();
+ }
+
// Parse the specifier-qualifier-list piece.
DeclSpec DS;
ParseSpecifierQualifierList(DS);
Modified: cfe/trunk/test/Index/complete-blocks.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-blocks.m?rev=116754&r1=116753&r2=116754&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-blocks.m (original)
+++ cfe/trunk/test/Index/complete-blocks.m Mon Oct 18 16:34:55 2010
@@ -43,3 +43,9 @@
// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType id}{TypedText method3:}{Placeholder ^int(void)b} (20)
// RUN: c-index-test -code-completion-at=%s:33:6 %s | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType id}{TypedText method4:}{Placeholder ^(void)arg} (20)
+// RUN: c-index-test -code-completion-at=%s:25:15 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// CHECK-CC5: TypedefDecl:{TypedText block_t} (50)
+// CHECK-CC5: TypedefDecl:{TypedText Class} (50)
+// CHECK-CC5-NOT: test_A
+// CHECK-CC5: {TypedText union} (50)
+
More information about the cfe-commits
mailing list