133 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2 3@interface MySuperClass4{5 int unmarked;6 7@private8 int private;9 10@protected11 int protected;12 13@public14 int public;15}16@end17 18@implementation MySuperClass19- (void) test {20 int access;21 MySuperClass *s = 0;22 access = s->unmarked;23 access = s->private; 24 access = s->protected;25}26@end27 28 29@interface MyClass : MySuperClass 30@end31 32@implementation MyClass33- (void) test {34 int access;35 MySuperClass *s = 0;36 access = s->unmarked;37 access = s->private; // expected-error {{instance variable 'private' is private}}38 access = s->protected;39 MyClass *m=0;40 access = m->unmarked;41 access = m->private; // expected-error {{instance variable 'private' is private}}42 access = m->protected;43}44@end45 46 47@interface Deeper : MyClass48@end49 50@implementation Deeper 51- (void) test {52 int access;53 MySuperClass *s = 0;54 access = s->unmarked;55 access = s->private; // expected-error {{instance variable 'private' is private}}56 access = s->protected;57 MyClass *m=0;58 access = m->unmarked;59 access = m->private; // expected-error {{instance variable 'private' is private}}60 access = m->protected;61}62@end63 64@interface Unrelated65@end66 67@implementation Unrelated 68- (void) test {69 int access;70 MySuperClass *s = 0;71 access = s->unmarked; // expected-error {{instance variable 'unmarked' is protected}}72 access = s->private; // expected-error {{instance variable 'private' is private}}73 access = s->protected; // expected-error {{instance variable 'protected' is protected}}74 MyClass *m=0;75 access = m->unmarked; // expected-error {{instance variable 'unmarked' is protected}}76 access = m->private; // expected-error {{instance variable 'private' is private}}77 access = m->protected; // expected-error {{instance variable 'protected' is protected}}78}79@end80 81int main (void)82{83 MySuperClass *s = 0;84 int access;85 access = s->unmarked; // expected-error {{instance variable 'unmarked' is protected}}86 access = s->private; // expected-error {{instance variable 'private' is private}}87 access = s->protected; // expected-error {{instance variable 'protected' is protected}}88 return 0;89}90 91typedef signed char BOOL;92typedef unsigned int NSUInteger;93typedef struct _NSZone NSZone;94@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;95@protocol NSObject - (BOOL)isEqual:(id)object;96@end97@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder;98@end 99@interface NSObject <NSObject> {}100@end101extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);102@interface NSResponder : NSObject <NSCoding> {}103@end 104@protocol NSAnimatablePropertyContainer105- (id)animator;106@end107extern NSString *NSAnimationTriggerOrderIn ;108@interface NSView : NSResponder <NSAnimatablePropertyContainer> {109 struct __VFlags2 {110 }111 _vFlags2;112}113@end114@class NSFontDescriptor, NSAffineTransform, NSGraphicsContext;115@interface NSScrollView : NSView {}116@end117 118@class CasperMixerView;119@interface CasperDiffScrollView : NSScrollView {120@private121 CasperMixerView *_comparatorView;122 NSView *someField;123}124@end125 126@implementation CasperDiffScrollView127+ (void)initialize {}128static void _CasperDiffScrollViewInstallMixerView(CasperDiffScrollView *scrollView) {129 if (scrollView->someField != ((void *)0)) {130 }131}132@end133