]> granicus.if.org Git - clang/commitdiff
Objective-C methods can be variadic, too. Who knew.
authorDouglas Gregor <dgregor@apple.com>
Wed, 23 Dec 2009 00:21:46 +0000 (00:21 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 23 Dec 2009 00:21:46 +0000 (00:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91951 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaCodeComplete.cpp
test/Index/complete-objc-message.m

index 1391adfd48df8707286127459d73e804c5d740d6..d9531fc4d690cc883a55ad21488c5ec9c8e666a1 100644 (file)
@@ -1205,6 +1205,13 @@ CodeCompleteConsumer::Result::CreateCodeCompletionString(Sema &S) {
         Result->AddPlaceholderChunk(Arg);
     }
 
+    if (Method->isVariadic()) {
+      if (AllParametersAreInformative)
+        Result->AddInformativeChunk(", ...");
+      else
+        Result->AddPlaceholderChunk(", ...");
+    }
+    
     return Result;
   }
 
index 740b498126c45cc0c5d9906fbc1e8044d79b6de8..a7b37fd2442cb13c01393bc4cc0243524d40a98b 100644 (file)
@@ -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 , ...}