]> granicus.if.org Git - clang/commitdiff
Provide code completion for types after the '^' that starts a block
authorDouglas Gregor <dgregor@apple.com>
Mon, 18 Oct 2010 21:34:55 +0000 (21:34 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 18 Oct 2010 21:34:55 +0000 (21:34 +0000)
literal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116754 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExpr.cpp
test/Index/complete-blocks.m

index 2785f1b14da8389be29361348e43b2e3fdec56bf..c4d09f2816f4d581a09601a2c07334355243bdbd 100644 (file)
@@ -1743,6 +1743,11 @@ bool Parser::ParseExpressionList(llvm::SmallVectorImpl<Expr*> &Exprs,
 /// [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);
index 61e363e37529a7677e781dfd027b5eda5fdaa275..18369d2c5a44a692590c11d4768a4f5c4b3ea3c1 100644 (file)
@@ -43,3 +43,9 @@ void test_C(C *c) {
 // 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)
+