// The argument for a block pointer parameter is a block literal with
// the appropriate type.
- FunctionProtoTypeLoc *Block = 0;
+ FunctionTypeLoc *Block = 0;
+ FunctionProtoTypeLoc *BlockProto = 0;
TypeLoc TL;
if (TypeSourceInfo *TSInfo = Param->getTypeSourceInfo()) {
TL = TSInfo->getTypeLoc().getUnqualifiedLoc();
if (BlockPointerTypeLoc *BlockPtr
= dyn_cast<BlockPointerTypeLoc>(&TL)) {
TL = BlockPtr->getPointeeLoc().IgnoreParens();
- Block = dyn_cast<FunctionProtoTypeLoc>(&TL);
+ Block = dyn_cast<FunctionTypeLoc>(&TL);
+ BlockProto = dyn_cast<FunctionProtoTypeLoc>(&TL);
}
break;
}
ResultType.getAsStringInternal(Result, Context.PrintingPolicy);
Result = '^' + Result;
- if (Block->getNumArgs() == 0) {
- if (Block->getTypePtr()->isVariadic())
+ if (!BlockProto || Block->getNumArgs() == 0) {
+ if (BlockProto && BlockProto->getTypePtr()->isVariadic())
Result += "(...)";
else
Result += "(void)";
Result += ", ";
Result += FormatFunctionParameter(Context, Block->getArg(I));
- if (I == N - 1 && Block->getTypePtr()->isVariadic())
+ if (I == N - 1 && BlockProto->getTypePtr()->isVariadic())
Result += ", ...";
}
Result += ")";
@interface C
- method4:(void(^)(void))arg { };
+- method5:(void(^)())arg5 { };
@end
void test_C(C *c) {
// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText method:}{Placeholder ^int(int x, int y)b} (35)
// RUN: c-index-test -code-completion-at=%s:25:6 %s | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType id}{TypedText method3:}{Placeholder ^int(void)b} (35)
-// RUN: c-index-test -code-completion-at=%s:33:6 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// RUN: c-index-test -code-completion-at=%s:34:6 %s | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType id}{TypedText method4:}{Placeholder ^(void)arg} (35)
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType id}{TypedText method5:}{Placeholder ^(void)arg5} (35)
// 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)