xref: /aosp_15_r20/external/clang/test/ARCMT/objcmt-protocol-conformance.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: rm -rf %t
2*67e74705SXin Li// RUN: %clang_cc1 -objcmt-migrate-protocol-conformance -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
3*67e74705SXin Li// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
4*67e74705SXin Li// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
5*67e74705SXin Li
6*67e74705SXin Li@interface NSObject @end
7*67e74705SXin Li
8*67e74705SXin Li@protocol P
9*67e74705SXin Li- (id) Meth1: (double) arg;
10*67e74705SXin Li@end
11*67e74705SXin Li
12*67e74705SXin Li@interface Test1  // Test for no super class and no protocol list
13*67e74705SXin Li@end
14*67e74705SXin Li
15*67e74705SXin Li@implementation Test1
16*67e74705SXin Li- (id) Meth1: (double) arg { return 0; }
17*67e74705SXin Li@end
18*67e74705SXin Li
19*67e74705SXin Li@protocol P1 @end
20*67e74705SXin Li@protocol P2 @end
21*67e74705SXin Li
22*67e74705SXin Li@interface Test2 <P1, P2>  // Test for no super class and with protocol list
23*67e74705SXin Li{
24*67e74705SXin Li  id IVAR1;
25*67e74705SXin Li  id IVAR2;
26*67e74705SXin Li}
27*67e74705SXin Li@end
28*67e74705SXin Li
29*67e74705SXin Li@implementation Test2
30*67e74705SXin Li- (id) Meth1: (double) arg { return 0; }
31*67e74705SXin Li@end
32*67e74705SXin Li
33*67e74705SXin Li@interface Test3 : NSObject  { // Test for Super class and no  protocol list
34*67e74705SXin Li  id IV1;
35*67e74705SXin Li}
36*67e74705SXin Li@end
37*67e74705SXin Li
38*67e74705SXin Li@implementation Test3
39*67e74705SXin Li- (id) Meth1: (double) arg { return 0; }
40*67e74705SXin Li@end
41*67e74705SXin Li
42*67e74705SXin Li@interface Test4 : NSObject <P1, P2> // Test for Super class and protocol list
43*67e74705SXin Li@end
44*67e74705SXin Li
45*67e74705SXin Li@implementation Test4
46*67e74705SXin Li- (id) Meth1: (double) arg { return 0; }
47*67e74705SXin Li@end
48*67e74705SXin Li
49*67e74705SXin Li// Test5 - conforms to P3 because it implement's P3's property.
50*67e74705SXin Li@protocol P3
51*67e74705SXin Li@property (copy) id Prop;
52*67e74705SXin Li@end
53*67e74705SXin Li
54*67e74705SXin Li@protocol P4
55*67e74705SXin Li@property (copy) id Prop;
56*67e74705SXin Li@end
57*67e74705SXin Li
58*67e74705SXin Li@interface Test5 : NSObject<P3>
59*67e74705SXin Li@end
60*67e74705SXin Li
61*67e74705SXin Li@implementation Test5
62*67e74705SXin Li@synthesize Prop=_XXX;
63*67e74705SXin Li@end
64*67e74705SXin Li
65*67e74705SXin Li@protocol P5 <P3, P4>
66*67e74705SXin Li@property (copy) id Prop;
67*67e74705SXin Li@end
68*67e74705SXin Li
69*67e74705SXin Li@protocol P6 <P3, P4, P5>
70*67e74705SXin Li@property (copy) id Prop;
71*67e74705SXin Li@end
72*67e74705SXin Li
73*67e74705SXin Li@interface Test6 : NSObject // Test for minimal listing of conforming protocols
74*67e74705SXin Li@property (copy) id Prop;
75*67e74705SXin Li@end
76*67e74705SXin Li
77*67e74705SXin Li@implementation Test6
78*67e74705SXin Li@end
79*67e74705SXin Li
80*67e74705SXin Li@class UIDynamicAnimator, UIWindow;
81*67e74705SXin Li@interface UIResponder : NSObject
82*67e74705SXin Li@end
83*67e74705SXin Li
84*67e74705SXin Li@protocol EmptyProtocol
85*67e74705SXin Li@end
86*67e74705SXin Li
87*67e74705SXin Li@protocol OptionalMethodsOnly
88*67e74705SXin Li@optional
89*67e74705SXin Li- (void)dynamicAnimatorWillResume:(UIDynamicAnimator*)animator;
90*67e74705SXin Li- (void)dynamicAnimatorDidPause:(UIDynamicAnimator*)animator;
91*67e74705SXin Li@end
92*67e74705SXin Li
93*67e74705SXin Li@protocol OptionalPropertiesOnly
94*67e74705SXin Li@optional
95*67e74705SXin Li@property (strong, nonatomic) id OptionalProperty;
96*67e74705SXin Li@end
97*67e74705SXin Li
98*67e74705SXin Li@protocol OptionalEvrything
99*67e74705SXin Li@optional
100*67e74705SXin Li- (void)dynamicAnimatorWillResume:(UIDynamicAnimator*)animator;
101*67e74705SXin Li@property (strong, nonatomic) id OptionalProperty;
102*67e74705SXin Li- (void)dynamicAnimatorDidPause:(UIDynamicAnimator*)animator;
103*67e74705SXin Li@end
104*67e74705SXin Li
105*67e74705SXin Li@protocol UIApplicationDelegate
106*67e74705SXin Li@end
107*67e74705SXin Li
108*67e74705SXin Li@interface Test7 : UIResponder <UIApplicationDelegate>
109*67e74705SXin Li@property (strong, nonatomic) UIWindow *window;
110*67e74705SXin Li@end
111*67e74705SXin Li
112*67e74705SXin Li@implementation Test7
113*67e74705SXin Li@end
114*67e74705SXin Li
115*67e74705SXin Li// rdar://15515206
116*67e74705SXin Li@interface BTLEBrowser
117*67e74705SXin Li@end
118*67e74705SXin Li
119*67e74705SXin Li@protocol CBCentralManagerDelegate;
120*67e74705SXin Li
121*67e74705SXin Li@protocol CBCentralManagerDelegate
122*67e74705SXin Li- (id) Meth1: (double) arg;
123*67e74705SXin Li@end
124*67e74705SXin Li
125*67e74705SXin Li@interface BTLEBrowser() <CBCentralManagerDelegate>
126*67e74705SXin Li@end
127*67e74705SXin Li
128*67e74705SXin Li@implementation BTLEBrowser
129*67e74705SXin Li- (id) Meth15515206: (double) arg { return 0; }
130*67e74705SXin Li@end
131