[cfe-commits] r91951 - in /cfe/trunk: lib/Sema/SemaCodeComplete.cpp test/Index/complete-objc-message.m

Douglas Gregor dgregor at apple.com
Tue Dec 22 16:21:46 PST 2009


Author: dgregor
Date: Tue Dec 22 18:21:46 2009
New Revision: 91951

URL: http://llvm.org/viewvc/llvm-project?rev=91951&view=rev
Log:
Objective-C methods can be variadic, too. Who knew.

Modified:
    cfe/trunk/lib/Sema/SemaCodeComplete.cpp
    cfe/trunk/test/Index/complete-objc-message.m

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=91951&r1=91950&r2=91951&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Tue Dec 22 18:21:46 2009
@@ -1205,6 +1205,13 @@
         Result->AddPlaceholderChunk(Arg);
     }
 
+    if (Method->isVariadic()) {
+      if (AllParametersAreInformative)
+        Result->AddInformativeChunk(", ...");
+      else
+        Result->AddPlaceholderChunk(", ...");
+    }
+    
     return Result;
   }
 

Modified: cfe/trunk/test/Index/complete-objc-message.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-objc-message.m?rev=91951&r1=91950&r2=91951&view=diff

==============================================================================
--- cfe/trunk/test/Index/complete-objc-message.m (original)
+++ cfe/trunk/test/Index/complete-objc-message.m Tue Dec 22 18:21:46 2009
@@ -95,6 +95,14 @@
   [ovl Method:1 Arg1:1 OtherArg:ovl];
 }
 
+ at interface Ellipsis
+- (int)Method:(int)i, ...;
+ at 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 @@
 // 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 , ...}





More information about the cfe-commits mailing list