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