xref: /aosp_15_r20/external/clang/test/SemaObjC/method-undef-extension-warn-1.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2*67e74705SXin Li
3*67e74705SXin Li@interface MyClass
4*67e74705SXin Li@end
5*67e74705SXin Li
6*67e74705SXin Li@protocol P
7*67e74705SXin Li- (void)Pmeth;
8*67e74705SXin Li- (void)Pmeth1; // expected-note {{method 'Pmeth1' declared here}}
9*67e74705SXin Li@end
10*67e74705SXin Li
11*67e74705SXin Li// Class extension
12*67e74705SXin Li@interface MyClass () <P>
13*67e74705SXin Li- (void)meth2; // expected-note {{method 'meth2' declared here}}
14*67e74705SXin Li@end
15*67e74705SXin Li
16*67e74705SXin Li// Add a category to test that clang does not emit warning for this method.
17*67e74705SXin Li@interface MyClass (Category)
18*67e74705SXin Li- (void)categoryMethod;
19*67e74705SXin Li@end
20*67e74705SXin Li
21*67e74705SXin Li@implementation MyClass // expected-warning {{method 'Pmeth1' in protocol 'P' not implemented}} \
22*67e74705SXin Li                        // expected-warning {{method definition for 'meth2' not found}}
23*67e74705SXin Li- (void)Pmeth {}
24*67e74705SXin Li@end
25