2012-06-20 14:18:46 +08:00
|
|
|
// 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
|
2016-12-09 09:20:40 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
|
2012-04-17 06:14:01 +08:00
|
|
|
// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
|
2016-12-09 09:20:40 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
|
2010-02-13 01:52:31 +08:00
|
|
|
// radar 7638400
|
|
|
|
|
2012-05-04 05:44:12 +08:00
|
|
|
// rdar://11375908
|
|
|
|
typedef unsigned long size_t;
|
|
|
|
|
2010-02-17 06:13:48 +08:00
|
|
|
typedef void * id;
|
2010-02-24 09:25:40 +08:00
|
|
|
void *sel_registerName(const char *);
|
2010-02-17 06:13:48 +08:00
|
|
|
|
2010-02-13 01:52:31 +08:00
|
|
|
@interface X
|
|
|
|
@end
|
|
|
|
|
|
|
|
void foo(void (^block)(int));
|
|
|
|
|
|
|
|
@implementation X
|
|
|
|
static void enumerateIt(void (^block)(id, id, char *)) {
|
|
|
|
foo(^(int idx) { });
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
2010-02-17 01:26:03 +08:00
|
|
|
// radar 7651312
|
|
|
|
void apply(void (^block)(int));
|
|
|
|
|
|
|
|
static void x(int (^cmp)(int, int)) {
|
|
|
|
x(cmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void y(int (^cmp)(int, int)) {
|
|
|
|
apply(^(int sect) {
|
|
|
|
x(cmp);
|
|
|
|
});
|
|
|
|
}
|
2010-02-18 09:20:22 +08:00
|
|
|
|
|
|
|
// radar 7659483
|
|
|
|
void *_Block_copy(const void *aBlock);
|
|
|
|
void x(void (^block)(void)) {
|
|
|
|
block = ((__typeof(block))_Block_copy((const void *)(block)));
|
|
|
|
}
|
2010-02-24 09:25:40 +08:00
|
|
|
|
2010-02-24 09:37:04 +08:00
|
|
|
// radar 7682763
|
2010-02-24 09:25:40 +08:00
|
|
|
@interface Y {
|
|
|
|
@private
|
|
|
|
id _private;
|
|
|
|
}
|
|
|
|
- (void (^)(void))f;
|
|
|
|
@end
|
|
|
|
|
|
|
|
typedef void (^void_block_t)(void);
|
|
|
|
|
|
|
|
@interface YY {
|
|
|
|
void_block_t __completion;
|
|
|
|
}
|
|
|
|
@property (copy) void_block_t f;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation Y
|
|
|
|
- (void (^)(void))f {
|
|
|
|
return [_private f];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2010-11-04 07:29:24 +08:00
|
|
|
// rdar: //8608902
|
|
|
|
@protocol CoreDAVAccountInfoProvider;
|
|
|
|
@protocol CodeProvider;
|
|
|
|
typedef void (^BDVDiscoveryCompletionHandler)(int success, id<CoreDAVAccountInfoProvider> discoveredInfo);
|
|
|
|
typedef void (^BDVDiscoveryCompletion)(id<CodeProvider> codeInfo, int success, id<CoreDAVAccountInfoProvider> discoveredInfo);
|
|
|
|
typedef void (^BDVDiscovery)(int success);
|
|
|
|
typedef void (^BDVDisc)(id<CoreDAVAccountInfoProvider> discoveredInfo, id<CodeProvider> codeInfo,
|
|
|
|
int success, id<CoreDAVAccountInfoProvider, CodeProvider> Info);
|
|
|
|
typedef void (^BLOCK)(id, id<CoreDAVAccountInfoProvider>, id<CodeProvider> codeInfo);
|
|
|
|
typedef void (^EMPTY_BLOCK)();
|
|
|
|
typedef void (^ BDVDiscoveryCompletion1 )(id<CodeProvider> codeInfo, int success, id<CoreDAVAccountInfoProvider> discoveredInfo);
|
|
|
|
|
|
|
|
void (^BL)(void(^arg1)(), int i1, void(^arg)(int));
|
|
|
|
|
|
|
|
typedef void (^iscoveryCompletionHandler)(void(^arg1)(), id<CoreDAVAccountInfoProvider> discoveredInfo);
|
|
|
|
|
|
|
|
typedef void (^DVDisc)(id<CoreDAVAccountInfoProvider> discoveredInfo, id<CodeProvider> codeInfo,
|
|
|
|
void(^arg1)(), int i1, void(^arg)(id<CoreDAVAccountInfoProvider>),
|
|
|
|
int success, id<CoreDAVAccountInfoProvider, CodeProvider> Info);
|
|
|
|
|
2010-11-04 07:50:34 +08:00
|
|
|
|
|
|
|
@interface I @end
|
|
|
|
@interface INTF @end
|
|
|
|
void (^BLINT)(I<CoreDAVAccountInfoProvider>* ARG, INTF<CodeProvider, CoreDAVAccountInfoProvider>* ARG1);
|
2010-11-06 02:34:46 +08:00
|
|
|
|
|
|
|
void test8608902() {
|
|
|
|
BDVDiscoveryCompletionHandler ppp;
|
|
|
|
ppp(1, 0);
|
|
|
|
}
|
|
|
|
|
2011-04-01 06:49:32 +08:00
|
|
|
void test9204669() {
|
|
|
|
__attribute__((__blocks__(byref))) char (^addChangeToData)();
|
|
|
|
|
|
|
|
addChangeToData = ^() {
|
|
|
|
return 'b';
|
|
|
|
};
|
2011-04-02 03:19:28 +08:00
|
|
|
addChangeToData();
|
2011-04-01 06:49:32 +08:00
|
|
|
}
|
|
|
|
|
2011-04-02 07:08:13 +08:00
|
|
|
void test9204669_1() {
|
|
|
|
__attribute__((__blocks__(byref))) void (^addChangeToData)();
|
|
|
|
|
|
|
|
addChangeToData = ^() {
|
|
|
|
addChangeToData();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|