xref: /aosp_15_r20/external/clang/test/SemaObjC/incomplete-implementation.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -verify -Wno-objc-root-class %s
2*67e74705SXin Li
3*67e74705SXin Li@interface I
4*67e74705SXin Li- Meth; // expected-note 2 {{method 'Meth' declared here}}
5*67e74705SXin Li- unavailableMeth __attribute__((availability(macosx,unavailable)));
6*67e74705SXin Li- unavailableMeth2 __attribute__((unavailable));
7*67e74705SXin Li@end
8*67e74705SXin Li
9*67e74705SXin Li@implementation  I  // expected-warning {{method definition for 'Meth' not found}}
10*67e74705SXin Li@end
11*67e74705SXin Li
12*67e74705SXin Li@implementation I(CAT)
13*67e74705SXin Li- Meth {return 0;} // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
14*67e74705SXin Li@end
15*67e74705SXin Li
16*67e74705SXin Li#pragma GCC diagnostic ignored "-Wincomplete-implementation"
17*67e74705SXin Li@interface I2
18*67e74705SXin Li- Meth; // expected-note{{method 'Meth' declared here}}
19*67e74705SXin Li@end
20*67e74705SXin Li
21*67e74705SXin Li@implementation  I2
22*67e74705SXin Li@end
23*67e74705SXin Li
24*67e74705SXin Li@implementation I2(CAT)
25*67e74705SXin Li- Meth {return 0;} // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
26*67e74705SXin Li@end
27*67e74705SXin Li
28*67e74705SXin Li@interface Q
29*67e74705SXin Li@end
30*67e74705SXin Li
31*67e74705SXin Li// rdar://10336158
32*67e74705SXin Li@implementation Q
33*67e74705SXin Li
34*67e74705SXin Li__attribute__((visibility("default")))
35*67e74705SXin Li@interface QN // expected-error {{Objective-C declarations may only appear in global scope}}
36*67e74705SXin Li{
37*67e74705SXin Li}
38*67e74705SXin Li@end
39*67e74705SXin Li
40*67e74705SXin Li@end
41*67e74705SXin Li
42*67e74705SXin Li// rdar://15580969
43*67e74705SXin Litypedef char BOOL;
44*67e74705SXin Li
45*67e74705SXin Li@protocol NSObject
46*67e74705SXin Li- (BOOL)isEqual:(id)object;
47*67e74705SXin Li@end
48*67e74705SXin Li
49*67e74705SXin Li@interface NSObject <NSObject>
50*67e74705SXin Li@end
51*67e74705SXin Li
52*67e74705SXin Li@protocol NSApplicationDelegate <NSObject>
53*67e74705SXin Li- (void)ImpleThisMethod; // expected-note {{method 'ImpleThisMethod' declared here}}
54*67e74705SXin Li@end
55*67e74705SXin Li
56*67e74705SXin Li@interface AppDelegate : NSObject <NSApplicationDelegate>
57*67e74705SXin Li@end
58*67e74705SXin Li
59*67e74705SXin Li@implementation AppDelegate (MRRCategory)
60*67e74705SXin Li
61*67e74705SXin Li- (BOOL)isEqual:(id)object
62*67e74705SXin Li{
63*67e74705SXin Li    return __objc_no;
64*67e74705SXin Li}
65*67e74705SXin Li
66*67e74705SXin Li- (void)ImpleThisMethod {} // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
67*67e74705SXin Li@end
68