xref: /aosp_15_r20/external/clang/test/SemaObjC/protocol-implementing-class-methods.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1  -fsyntax-only -verify %s
2*67e74705SXin Li// rdar://7020493
3*67e74705SXin Li
4*67e74705SXin Li@protocol P1
5*67e74705SXin Li@optional
6*67e74705SXin Li- (int) PMeth;
7*67e74705SXin Li@required
8*67e74705SXin Li- (void) : (double) arg; // expected-note {{method ':' declared here}}
9*67e74705SXin Li@end
10*67e74705SXin Li
11*67e74705SXin Li@interface NSImage <P1>
12*67e74705SXin Li- (void) initialize; // expected-note {{method 'initialize' declared here}}
13*67e74705SXin Li@end
14*67e74705SXin Li
15*67e74705SXin Li@interface NSImage (AirPortUI)
16*67e74705SXin Li- (void) initialize;
17*67e74705SXin Li@end
18*67e74705SXin Li
19*67e74705SXin Li@interface NSImage()
20*67e74705SXin Li- (void) CEMeth; // expected-note {{method 'CEMeth' declared here}}
21*67e74705SXin Li@end
22*67e74705SXin Li
23*67e74705SXin Li@implementation NSImage (AirPortUI)
24*67e74705SXin Li- (void) initialize {NSImage *p=0; [p initialize]; } // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
25*67e74705SXin Li- (int) PMeth{ return 0; }
26*67e74705SXin Li- (void) : (double) arg{}; // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
27*67e74705SXin Li- (void) CEMeth {}; // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
28*67e74705SXin Li@end
29*67e74705SXin Li
30*67e74705SXin Li// rdar://10014946
31*67e74705SXin Litypedef char BOOL;
32*67e74705SXin Li@interface I
33*67e74705SXin Li{
34*67e74705SXin Li  BOOL allowsDeleting;
35*67e74705SXin Li}
36*67e74705SXin Li@property (nonatomic, assign, readwrite) BOOL allowsDeleting;
37*67e74705SXin Li@end
38*67e74705SXin Li
39*67e74705SXin Li@implementation I(CAT)
40*67e74705SXin Li- (BOOL) allowsDeleting { return 1; }
41*67e74705SXin Li@end
42