xref: /minix3/external/bsd/llvm/dist/clang/test/Rewriter/objc-modern-property-attributes.mm (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -E %s -o %t.mm
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %t.mm -o - | FileCheck %s
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc// rdar://11095151
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuctypedef void (^void_block_t)(void);
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambuc@interface PropertyClass {
9*f4a2713aSLionel Sambuc    int q;
10*f4a2713aSLionel Sambuc    void_block_t __completion;
11*f4a2713aSLionel Sambuc    PropertyClass* YVAR;
12*f4a2713aSLionel Sambuc    id ID;
13*f4a2713aSLionel Sambuc}
14*f4a2713aSLionel Sambuc@property int q;
15*f4a2713aSLionel Sambuc@property int r;
16*f4a2713aSLionel Sambuc
17*f4a2713aSLionel Sambuc@property (copy) void_block_t completionBlock;
18*f4a2713aSLionel Sambuc@property (retain) PropertyClass* Yblock;
19*f4a2713aSLionel Sambuc@property (readonly) PropertyClass* readonlyAttr;
20*f4a2713aSLionel Sambuc@property (readonly,copy) PropertyClass* readonlyCopyAttr;
21*f4a2713aSLionel Sambuc@property (readonly,retain) PropertyClass* readonlyRetainAttr;
22*f4a2713aSLionel Sambuc@property (readonly,retain,nonatomic) PropertyClass* readonlyNonatomicAttr;
23*f4a2713aSLionel Sambuc@property (copy) id ID;
24*f4a2713aSLionel Sambuc
25*f4a2713aSLionel Sambuc@end
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambuc@implementation PropertyClass
28*f4a2713aSLionel Sambuc@synthesize q;  // attributes should be "Ti,Vq"
29*f4a2713aSLionel Sambuc@dynamic r;     // attributes should be "Ti,D"
30*f4a2713aSLionel Sambuc@synthesize completionBlock=__completion; // "T@?,C,V__completion"
31*f4a2713aSLionel Sambuc@synthesize Yblock = YVAR; // "T@\"PropertyClass\",&,VYVAR"
32*f4a2713aSLionel Sambuc@synthesize readonlyAttr;
33*f4a2713aSLionel Sambuc@synthesize readonlyCopyAttr;
34*f4a2713aSLionel Sambuc@synthesize readonlyRetainAttr;
35*f4a2713aSLionel Sambuc@synthesize readonlyNonatomicAttr;
36*f4a2713aSLionel Sambuc@synthesize  ID; // "T@,C,VID"
37*f4a2713aSLionel Sambuc@end
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc// CHECK: Ti,Vq
40*f4a2713aSLionel Sambuc// CHECK: Ti,D
41*f4a2713aSLionel Sambuc// CHECK: T@?,C,V__completion
42*f4a2713aSLionel Sambuc// CHECK: T@\"PropertyClass\",&,VYVAR
43*f4a2713aSLionel Sambuc// CHECK: T@\"PropertyClass\",R,VreadonlyAttr
44*f4a2713aSLionel Sambuc// CHECK: T@\"PropertyClass\",R,C,VreadonlyCopyAttr
45*f4a2713aSLionel Sambuc// CHECK: T@\"PropertyClass\",R,&,VreadonlyRetainAttr
46*f4a2713aSLionel Sambuc// CHECK: T@\"PropertyClass\",R,&,N,VreadonlyNonatomicAttr
47*f4a2713aSLionel Sambuc
48*f4a2713aSLionel Sambuc@interface Test @end
49*f4a2713aSLionel Sambuc@interface Test (Category)
50*f4a2713aSLionel Sambuc@property int q;
51*f4a2713aSLionel Sambuc@end
52*f4a2713aSLionel Sambuc
53*f4a2713aSLionel Sambuc@implementation Test (Category)
54*f4a2713aSLionel Sambuc@dynamic q;
55*f4a2713aSLionel Sambuc@end
56*f4a2713aSLionel Sambuc
57*f4a2713aSLionel Sambuc// CHECK: {{"q","Ti,D"}}
58