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