xref: /aosp_15_r20/external/clang/test/SemaObjC/class-def-test-1.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2*67e74705SXin Li
3*67e74705SXin Li@protocol SUPER; // expected-note {{protocol 'SUPER' has no definition}}
4*67e74705SXin Li
5*67e74705SXin Li@interface SUPER <SUPER> @end // expected-warning {{cannot find protocol definition for 'SUPER'}}
6*67e74705SXin Li
7*67e74705SXin Litypedef int INTF; //  expected-note {{previous definition is here}}
8*67e74705SXin Li
9*67e74705SXin Li@interface INTF @end // expected-error {{redefinition of 'INTF' as different kind of symbol}}
10*67e74705SXin Li
11*67e74705SXin Li@interface OBJECT @end	// expected-note {{previous definition is here}}
12*67e74705SXin Li
13*67e74705SXin Li@interface INTF1 : OBJECT @end // expected-note {{previous definition is here}}
14*67e74705SXin Li
15*67e74705SXin Li@interface INTF1 : OBJECT @end // expected-error {{duplicate interface definition for class 'INTF1'}}
16*67e74705SXin Li
17*67e74705SXin Litypedef int OBJECT; // expected-error {{redefinition of 'OBJECT' as different kind of symbol}}
18*67e74705SXin Li
19*67e74705SXin Litypedef int OBJECT2; // expected-note 2 {{previous definition is here}}
20*67e74705SXin Li@interface INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
21*67e74705SXin Li
22*67e74705SXin Li@implementation INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
23*67e74705SXin Li
24*67e74705SXin Li@protocol PROTO;
25*67e74705SXin Li
26*67e74705SXin Li@interface INTF3 : PROTO @end // expected-error {{cannot find interface declaration for 'PROTO', superclass of 'INTF3'}}
27*67e74705SXin Li
28*67e74705SXin Li// Make sure we allow the following (for GCC compatibility).
29*67e74705SXin Li@interface NSObject @end
30*67e74705SXin Litypedef NSObject TD_NSObject;
31*67e74705SXin Li@interface XCElementUnit : TD_NSObject {}
32*67e74705SXin Li@end
33*67e74705SXin Li
34*67e74705SXin Li// Make sure we don't typo-correct to ourselves.
35*67e74705SXin Li@interface SomeClassSub : SomeClassSup // expected-error{{cannot find interface declaration for 'SomeClassSup', superclass of 'SomeClassSub'}}
36*67e74705SXin Li@end
37