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