]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeCompletion/objc-message.mm
Vendor import of clang trunk r351319 (just before the release_80 branch
[FreeBSD/FreeBSD.git] / test / CodeCompletion / objc-message.mm
1 // Note: the run lines follow their respective tests, since line/column
2 // matter in this test.
3
4 @protocol FooTestProtocol
5 + protocolClassMethod;
6 - protocolInstanceMethod;
7 @end
8 @interface Foo <FooTestProtocol> {
9   void *isa;
10 }
11 + (int)classMethod1:a withKeyword:b;
12 + (void)classMethod2;
13 + new;
14 - instanceMethod1;
15 @end
16
17 @interface Foo (FooTestCategory)
18 + categoryClassMethod;
19 - categoryInstanceMethod;
20 @end
21
22 template<typename T> struct RetainPtr {
23   template <typename U> struct RemovePointer { typedef U Type; };
24   template <typename U> struct RemovePointer<U*> { typedef U Type; };
25     
26   typedef typename RemovePointer<T>::Type* PtrType;
27
28   explicit operator PtrType() const;
29 };
30
31 void func(const RetainPtr<Foo>& ptr)
32 {
33   [ptr instanceMethod1];
34 }
35
36 void func(const RetainPtr<id <FooTestProtocol>>& ptr)
37 {
38   [ptr instanceMethod1];
39 }
40
41 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -code-completion-at=%s:33:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
42 // CHECK-CC1: categoryInstanceMethod : [#id#]categoryInstanceMethod
43 // CHECK-CC1: instanceMethod1 : [#id#]instanceMethod1
44 // CHECK-CC1: protocolInstanceMethod (InBase) : [#id#]protocolInstanceMethod
45 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -code-completion-at=%s:38:8 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
46 // CHECK-CC2: protocolInstanceMethod : [#id#]protocolInstanceMethod