xref: /aosp_15_r20/external/clang/test/SemaObjC/property-and-class-extension.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify %s
2*67e74705SXin Li
3*67e74705SXin Li/**
4*67e74705SXin LiWhen processing @synthesize, treat ivars in a class extension the same as ivars in the class @interface,
5*67e74705SXin Liand treat ivars in a superclass extension the same as ivars in the superclass @interface.
6*67e74705SXin LiIn particular, when searching for an ivar to back an @synthesize, do look at ivars in the class's own class
7*67e74705SXin Liextension but ignore any ivars in superclass class extensions.
8*67e74705SXin Li*/
9*67e74705SXin Li
10*67e74705SXin Li@interface Super {
11*67e74705SXin Li  	int ISA;
12*67e74705SXin Li}
13*67e74705SXin Li@end
14*67e74705SXin Li
15*67e74705SXin Li@interface Super() {
16*67e74705SXin Li  int Property;		// expected-note {{previously declared 'Property' here}}
17*67e74705SXin Li}
18*67e74705SXin Li@end
19*67e74705SXin Li
20*67e74705SXin Li@interface SomeClass : Super {
21*67e74705SXin Li        int interfaceIvar1;
22*67e74705SXin Li        int interfaceIvar2;
23*67e74705SXin Li}
24*67e74705SXin Li@property int Property;
25*67e74705SXin Li@property int Property1;
26*67e74705SXin Li@end
27*67e74705SXin Li
28*67e74705SXin Li@interface SomeClass () {
29*67e74705SXin Li  int Property1;
30*67e74705SXin Li}
31*67e74705SXin Li@end
32*67e74705SXin Li
33*67e74705SXin Li@implementation SomeClass
34*67e74705SXin Li@synthesize Property;	// expected-error {{property 'Property' attempting to use instance variable 'Property' declared in super class 'Super'}}
35*67e74705SXin Li@synthesize Property1;	// OK
36*67e74705SXin Li@end
37