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