From: Douglas Gregor Date: Wed, 23 Dec 2009 00:21:46 +0000 (+0000) Subject: Objective-C methods can be variadic, too. Who knew. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2a17af0c7e05500e25d4cc71341f1f232085ebea;p=clang Objective-C methods can be variadic, too. Who knew. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91951 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 1391adfd48..d9531fc4d6 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -1205,6 +1205,13 @@ CodeCompleteConsumer::Result::CreateCodeCompletionString(Sema &S) { Result->AddPlaceholderChunk(Arg); } + if (Method->isVariadic()) { + if (AllParametersAreInformative) + Result->AddInformativeChunk(", ..."); + else + Result->AddPlaceholderChunk(", ..."); + } + return Result; } diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m index 740b498126..a7b37fd244 100644 --- a/test/Index/complete-objc-message.m +++ b/test/Index/complete-objc-message.m @@ -95,6 +95,14 @@ void test_overload(Overload *ovl) { [ovl Method:1 Arg1:1 OtherArg:ovl]; } +@interface Ellipsis +- (int)Method:(int)i, ...; +@end + +void f(Ellipsis *e) { + [e Method:1, 2, 3]; +} + // RUN: c-index-test -code-completion-at=%s:23:19 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: {TypedText categoryClassMethod} // CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)a}{Text withKeyword:}{Placeholder (int)b} @@ -143,3 +151,5 @@ void test_overload(Overload *ovl) { // CHECK-CCA: ObjCInterfaceDecl:{TypedText MySubClass} // CHECK-CCA: TypedefDecl:{TypedText SEL} // CHECK-CCA: {TypedText super} +// RUN: c-index-test -code-completion-at=%s:103:6 %s | FileCheck -check-prefix=CHECK-CCB %s +// CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)i}{Placeholder , ...}