Add include needed for MSVC.
[clang/acc.git] / test / SemaObjC / ivar-access-tests.m
blobca3cc4cf1d46aecd06c1d1918c35467258ad2080
1 // RUN: clang-cc -fsyntax-only -verify %s
3 @interface MySuperClass
5 @private
6   int private;
8 @protected
9   int protected;
11 @public
12   int public;
14 @end
16 @implementation MySuperClass
17 - (void) test {
18     int access;
19     MySuperClass *s = 0;
20     access = s->private;   
21     access = s->protected;
23 @end
26 @interface MyClass : MySuperClass 
27 @end
29 @implementation MyClass
30 - (void) test {
31     int access;
32     MySuperClass *s = 0;
33     access = s->private; // expected-error {{instance variable 'private' is private}}
34     access = s->protected;
35     MyClass *m=0;
36     access = m->private; // expected-error {{instance variable 'private' is private}}
37     access = m->protected;
39 @end
42 @interface Deeper : MyClass
43 @end
45 @implementation Deeper 
46 - (void) test {
47     int access;
48     MySuperClass *s = 0;
49     access = s->private; // expected-error {{instance variable 'private' is private}}
50     access = s->protected;
51     MyClass *m=0;
52     access = m->private; // expected-error {{instance variable 'private' is private}}
53     access = m->protected;
55 @end
57 @interface Unrelated
58 @end
60 @implementation Unrelated 
61 - (void) test {
62     int access;
63     MySuperClass *s = 0;
64     access = s->private; // expected-error {{instance variable 'private' is private}}
65     access = s->protected; // expected-error {{instance variable 'protected' is protected}}
66     MyClass *m=0;
67     access = m->private; // expected-error {{instance variable 'private' is private}}
68     access = m->protected; // expected-error {{instance variable 'protected' is protected}}
70 @end
72 int main (void)
74   MySuperClass *s = 0;
75   int access;
76   access = s->private;   // expected-error {{instance variable 'private' is private}}
77   access = s->protected; // expected-error {{instance variable 'protected' is protected}}
78   return 0;
81 typedef signed char BOOL;
82 typedef unsigned int NSUInteger;
83 typedef struct _NSZone NSZone;
84 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
85 @protocol NSObject  - (BOOL)isEqual:(id)object;
86 @end
87 @protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder;
88 @end 
89 @interface NSObject <NSObject> {}
90 @end
91 extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
92 @interface NSResponder : NSObject <NSCoding> {}
93 @end 
94 @protocol NSAnimatablePropertyContainer
95 - (id)animator;
96 @end
97 extern NSString *NSAnimationTriggerOrderIn ;
98 @interface NSView : NSResponder  <NSAnimatablePropertyContainer>  {
99   struct __VFlags2 {
100   }
101   _vFlags2;
103 @end
104 @class NSFontDescriptor, NSAffineTransform, NSGraphicsContext;
105 @interface NSScrollView : NSView {}
106 @end
108 @class CasperMixerView;
109 @interface CasperDiffScrollView : NSScrollView {
110 @private
111   CasperMixerView *_comparatorView;
112   NSView *someField;
114 @end
116 @implementation CasperDiffScrollView
117 + (void)initialize {}
118 static void _CasperDiffScrollViewInstallMixerView(CasperDiffScrollView *scrollView) {
119   if (scrollView->someField != ((void *)0)) {
120   }
122 @end