xref: /llvm-project/clang/test/Rewriter/rewrite-nested-property-in-blocks.mm (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1 -triple i686-pc-windows -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
2// RUN: %clang_cc1 -triple i686-pc-windows -fsyntax-only -fms-extensions -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
3// RUN: %clang_cc1 -triple i686-pc-windows -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
4// RUN: %clang_cc1 -triple i686-pc-windows -fsyntax-only -fms-extensions -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
5
6typedef unsigned long size_t;
7void *sel_registerName(const char *);
8
9extern "C" void nowarn(id);
10
11extern "C" void noblockwarn(void (^)());
12
13@interface INTFOFPROP
14@property (readwrite, retain) INTFOFPROP *outer;
15@property (readwrite, retain) id inner;
16@end
17
18@interface NSSet
19- (NSSet *)objectsPassingTest:(char (^)(id obj, char *stop))predicate ;
20@end
21
22@interface INTF
23- (NSSet *)Meth;
24@end
25
26@implementation INTF
27
28- (NSSet *)Meth
29{
30    NSSet *aces;
31
32    noblockwarn(^() {
33        INTFOFPROP *ace;
34        nowarn(ace.outer.inner);
35        noblockwarn(^() {
36          INTFOFPROP *ace;
37          nowarn(ace.outer.inner);
38        });
39    });
40
41    noblockwarn(^() {
42        INTFOFPROP *ace;
43        nowarn(ace.outer.inner);
44    });
45
46return [aces objectsPassingTest:^(id obj, char *stop)
47    {
48        INTFOFPROP *ace = (INTFOFPROP *)obj;
49        nowarn(ace.outer.inner);
50        return (char)0;
51    }];
52
53}
54@end
55