Files
clang-p2996/clang/test/Rewriter/rewrite-block-pointer.mm
John McCall 5fb5df9c83 Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend:  break this
down into a single target runtime kind and version, and compute
all the relevant information from that.  This makes it
relatively painless to add support for new runtimes to the
compiler.  Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z,
available at the driver level as a better and more general
alternative to -fgnu-runtime and -fnext-runtime.  This new
concept of an Objective-C runtime also encompasses what we
were previously separating out as the "Objective-C ABI", so
fragile vs. non-fragile runtimes are now really modelled as
different kinds of runtime, paving the way for better overall
differentiation.

As a sort of special case, continue to accept the -cc1 flag
-fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak.

I won't go so far as to say "no functionality change", even
ignoring the new driver flag, but subtle changes in driver
semantics are almost certainly not intended.

llvm-svn: 158793
2012-06-20 06:18:46 +00:00

113 lines
3.1 KiB
Plaintext

// 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
// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
// radar 7638400
// rdar://11375908
typedef unsigned long size_t;
typedef void * id;
void *sel_registerName(const char *);
@interface X
@end
void foo(void (^block)(int));
@implementation X
static void enumerateIt(void (^block)(id, id, char *)) {
foo(^(int idx) { });
}
@end
// 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);
});
}
// radar 7659483
void *_Block_copy(const void *aBlock);
void x(void (^block)(void)) {
block = ((__typeof(block))_Block_copy((const void *)(block)));
}
// radar 7682763
@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
// 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);
@interface I @end
@interface INTF @end
void (^BLINT)(I<CoreDAVAccountInfoProvider>* ARG, INTF<CodeProvider, CoreDAVAccountInfoProvider>* ARG1);
void test8608902() {
BDVDiscoveryCompletionHandler ppp;
ppp(1, 0);
}
void test9204669() {
__attribute__((__blocks__(byref))) char (^addChangeToData)();
addChangeToData = ^() {
return 'b';
};
addChangeToData();
}
void test9204669_1() {
__attribute__((__blocks__(byref))) void (^addChangeToData)();
addChangeToData = ^() {
addChangeToData();
};
}