summaryrefslogtreecommitdiff
path: root/clang/test/SemaObjC/no-ivar-access-control.m
blob: 6f00b1a367c70749808ebdfa857d8d1f0b531b2a (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// RUN: %clang_cc1 -fsyntax-only -fdebugger-support -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -x objective-c++ -fdebugger-support -fsyntax-only -verify -Wno-objc-root-class %s
// rdar://10997647

@interface I
{
@private
int ivar;
}
@end

@implementation I
- (int) meth {
  return self->ivar;
}
int foo1(I* p) {
  return p->ivar;
}
@end

int foo(I* p) {
  return p->ivar;
}

@interface B 
@end

@implementation B 
- (int) meth : (I*) arg {
  return arg->ivar;
}
@end


@interface I1 {
 int protected_ivar;
}
@property int PROP_INMAIN;
@end

@interface I1() {
 int private_ivar;
}
@property int PROP_INCLASSEXT;
@end

@implementation I1
@synthesize PROP_INMAIN, PROP_INCLASSEXT;

- (int) Meth {
   PROP_INMAIN = 1;
   PROP_INCLASSEXT = 2;
   protected_ivar = 1;  // OK
   return private_ivar; // OK
}
@end


@interface DER : I1
@end

@implementation DER
- (int) Meth {
   protected_ivar = 1;  // OK
   PROP_INMAIN = 1;
   PROP_INCLASSEXT = 2; 
   return private_ivar;
}
@end