summaryrefslogtreecommitdiff
path: root/test/ARCMT/objcmt-protocol-conformance.m
blob: f4c8f5112a62dae08fe55d1c3b0413980bdd4591 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// RUN: rm -rf %t
// 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
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result

@interface NSObject @end

@protocol P
- (id) Meth1: (double) arg;
@end

@interface Test1  // Test for no super class and no protocol list
@end

@implementation Test1
- (id) Meth1: (double) arg { return 0; }
@end

@protocol P1 @end
@protocol P2 @end

@interface Test2 <P1, P2>  // Test for no super class and with protocol list
{
  id IVAR1;
  id IVAR2;
}
@end

@implementation Test2
- (id) Meth1: (double) arg { return 0; }
@end

@interface Test3 : NSObject  { // Test for Super class and no  protocol list
  id IV1;
}
@end

@implementation Test3
- (id) Meth1: (double) arg { return 0; }
@end

@interface Test4 : NSObject <P1, P2> // Test for Super class and protocol list
@end

@implementation Test4
- (id) Meth1: (double) arg { return 0; }
@end

// Test5 - conforms to P3 because it implement's P3's property.
@protocol P3
@property (copy) id Prop;
@end

@protocol P4
@property (copy) id Prop;
@end

@interface Test5 : NSObject<P3>
@end

@implementation Test5
@synthesize Prop=_XXX;
@end

@protocol P5 <P3, P4>
@property (copy) id Prop;
@end

@protocol P6 <P3, P4, P5>
@property (copy) id Prop;
@end

@interface Test6 : NSObject // Test for minimal listing of conforming protocols
@property (copy) id Prop;
@end

@implementation Test6 
@end

@class UIDynamicAnimator, UIWindow;
@interface UIResponder : NSObject
@end

@protocol EmptyProtocol
@end

@protocol OptionalMethodsOnly
@optional
- (void)dynamicAnimatorWillResume:(UIDynamicAnimator*)animator;
- (void)dynamicAnimatorDidPause:(UIDynamicAnimator*)animator;
@end

@protocol OptionalPropertiesOnly
@optional
@property (strong, nonatomic) id OptionalProperty;
@end

@protocol OptionalEvrything
@optional
- (void)dynamicAnimatorWillResume:(UIDynamicAnimator*)animator;
@property (strong, nonatomic) id OptionalProperty;
- (void)dynamicAnimatorDidPause:(UIDynamicAnimator*)animator;
@end

@protocol UIApplicationDelegate
@end

@interface Test7 : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

@implementation Test7
@end

// rdar://15515206
@interface BTLEBrowser
@end

@protocol CBCentralManagerDelegate; 

@protocol CBCentralManagerDelegate 
- (id) Meth1: (double) arg;
@end

@interface BTLEBrowser() <CBCentralManagerDelegate> 
@end

@implementation BTLEBrowser
- (id) Meth15515206: (double) arg { return 0; }
@end