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