xref: /minix3/external/bsd/llvm/dist/clang/test/Rewriter/properties.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5  %s -o %t-rw.cpp
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -fms-extensions -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambucvoid *sel_registerName(const char *);
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc@interface Foo {
7*f4a2713aSLionel Sambuc    int i;
8*f4a2713aSLionel Sambuc    int rrrr;
9*f4a2713aSLionel Sambuc    Foo *o;
10*f4a2713aSLionel Sambuc}
11*f4a2713aSLionel Sambuc@property int i;
12*f4a2713aSLionel Sambuc@property(readonly) int rrrr;
13*f4a2713aSLionel Sambuc@property int d;
14*f4a2713aSLionel Sambuc@property(retain) Foo *o;
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc- (void)foo;
17*f4a2713aSLionel Sambuc@end
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc@implementation Foo
20*f4a2713aSLionel Sambuc@synthesize i;
21*f4a2713aSLionel Sambuc@synthesize rrrr;
22*f4a2713aSLionel Sambuc@synthesize o;
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc@dynamic d;
25*f4a2713aSLionel Sambuc
26*f4a2713aSLionel Sambuc- (void)foo {
27*f4a2713aSLionel Sambuc    i = 99;
28*f4a2713aSLionel Sambuc}
29*f4a2713aSLionel Sambuc
30*f4a2713aSLionel Sambuc- (int)bar {
31*f4a2713aSLionel Sambuc  return i;
32*f4a2713aSLionel Sambuc}
33*f4a2713aSLionel Sambuc@end
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambuc@interface Bar {
36*f4a2713aSLionel Sambuc}
37*f4a2713aSLionel Sambuc@end
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc@implementation Bar
40*f4a2713aSLionel Sambuc
41*f4a2713aSLionel Sambucstatic int func(int i) { return 0; }
42*f4a2713aSLionel Sambuc
43*f4a2713aSLionel Sambuc- (void)baz {
44*f4a2713aSLionel Sambuc    Foo *obj1, *obj2;
45*f4a2713aSLionel Sambuc    int i;
46*f4a2713aSLionel Sambuc    if (obj1.i == obj2.rrrr)
47*f4a2713aSLionel Sambuc      obj1.i = 33;
48*f4a2713aSLionel Sambuc    obj1.i = func(obj2.rrrr);
49*f4a2713aSLionel Sambuc    obj1.i = obj2.rrrr;
50*f4a2713aSLionel Sambuc    obj1.i = (obj2.rrrr);
51*f4a2713aSLionel Sambuc    [obj1 setI:[obj2 rrrr]];
52*f4a2713aSLionel Sambuc    obj1.i = [obj2 rrrr];
53*f4a2713aSLionel Sambuc    obj1.i = 3 + [obj2 rrrr];
54*f4a2713aSLionel Sambuc    i = obj1.o.i;
55*f4a2713aSLionel Sambuc    obj1.o.i = 77;
56*f4a2713aSLionel Sambuc}
57*f4a2713aSLionel Sambuc@end
58