aboutsummaryrefslogtreecommitdiff
path: root/test/Rewriter
diff options
context:
space:
mode:
Diffstat (limited to 'test/Rewriter')
-rw-r--r--test/Rewriter/blockcast3.mm2
-rw-r--r--test/Rewriter/blockstruct.m2
-rw-r--r--test/Rewriter/crash.m2
-rw-r--r--test/Rewriter/finally.m2
-rw-r--r--test/Rewriter/func-in-impl.m2
-rw-r--r--test/Rewriter/id-test-3.m2
-rw-r--r--test/Rewriter/inner-block-helper-funcs.mm2
-rw-r--r--test/Rewriter/instancetype-test.mm2
-rw-r--r--test/Rewriter/ivar-encoding-1.m2
-rw-r--r--test/Rewriter/ivar-encoding-2.m2
-rw-r--r--test/Rewriter/metadata-test-1.m2
-rw-r--r--test/Rewriter/metadata-test-2.m2
-rw-r--r--test/Rewriter/method-encoding-1.m2
-rw-r--r--test/Rewriter/objc-bool-literal-modern-1.mm3
-rw-r--r--test/Rewriter/objc-encoding-bug-1.m2
-rw-r--r--test/Rewriter/objc-ivar-receiver-1.m4
-rw-r--r--test/Rewriter/objc-modern-StretAPI.mm45
-rw-r--r--test/Rewriter/objc-modern-boxing.mm72
-rw-r--r--test/Rewriter/objc-modern-container-subscript.mm3
-rw-r--r--test/Rewriter/objc-modern-getclass-proto.mm10
-rw-r--r--test/Rewriter/objc-modern-property-attributes.mm10
-rw-r--r--test/Rewriter/objc-string-concat-1.m2
-rw-r--r--test/Rewriter/objc-super-test.m2
-rw-r--r--test/Rewriter/objc-synchronized-1.m2
-rw-r--r--test/Rewriter/properties.m2
-rw-r--r--test/Rewriter/property-dot-syntax.mm2
-rw-r--r--test/Rewriter/protocol-rewrite-1.m2
-rw-r--r--test/Rewriter/protocol-rewrite-2.m2
-rw-r--r--test/Rewriter/rewrite-anonymous-union.m2
-rw-r--r--test/Rewriter/rewrite-api-bug.m2
-rw-r--r--test/Rewriter/rewrite-block-argument.m2
-rw-r--r--test/Rewriter/rewrite-block-consts.mm2
-rw-r--r--test/Rewriter/rewrite-block-ivar-call.mm2
-rw-r--r--test/Rewriter/rewrite-block-literal-1.mm5
-rw-r--r--test/Rewriter/rewrite-block-literal.mm5
-rw-r--r--test/Rewriter/rewrite-block-pointer.mm5
-rw-r--r--test/Rewriter/rewrite-block-property.m2
-rw-r--r--test/Rewriter/rewrite-byref-in-nested-blocks.mm9
-rw-r--r--test/Rewriter/rewrite-byref-vars.mm4
-rw-r--r--test/Rewriter/rewrite-cast-ivar-access.mm2
-rw-r--r--test/Rewriter/rewrite-cast-to-bool.mm2
-rw-r--r--test/Rewriter/rewrite-category-property.mm2
-rw-r--r--test/Rewriter/rewrite-constructor-init.mm2
-rw-r--r--test/Rewriter/rewrite-eh.m2
-rw-r--r--test/Rewriter/rewrite-elaborated-type.mm2
-rw-r--r--test/Rewriter/rewrite-extern-c.mm2
-rw-r--r--test/Rewriter/rewrite-foreach-1.m2
-rw-r--r--test/Rewriter/rewrite-foreach-2.m2
-rw-r--r--test/Rewriter/rewrite-foreach-3.m2
-rw-r--r--test/Rewriter/rewrite-foreach-4.m2
-rw-r--r--test/Rewriter/rewrite-foreach-5.m2
-rw-r--r--test/Rewriter/rewrite-foreach-6.m2
-rw-r--r--test/Rewriter/rewrite-foreach-7.m2
-rw-r--r--test/Rewriter/rewrite-foreach-in-block.mm4
-rw-r--r--test/Rewriter/rewrite-foreach-protocol-id.m2
-rw-r--r--test/Rewriter/rewrite-forward-class.m2
-rw-r--r--test/Rewriter/rewrite-forward-class.mm2
-rw-r--r--test/Rewriter/rewrite-function-decl.mm2
-rw-r--r--test/Rewriter/rewrite-implementation.mm2
-rw-r--r--test/Rewriter/rewrite-ivar-use.m2
-rw-r--r--test/Rewriter/rewrite-local-externs-in-block.mm2
-rw-r--r--test/Rewriter/rewrite-local-static-id.mm2
-rw-r--r--test/Rewriter/rewrite-message-expr.mm2
-rw-r--r--test/Rewriter/rewrite-modern-atautoreleasepool.mm32
-rw-r--r--test/Rewriter/rewrite-modern-block-consts.mm22
-rw-r--r--test/Rewriter/rewrite-modern-block.mm44
-rw-r--r--test/Rewriter/rewrite-modern-captured-nested-bvar.mm35
-rw-r--r--test/Rewriter/rewrite-modern-default-property-synthesis.mm80
-rw-r--r--test/Rewriter/rewrite-modern-extern-c-func-decl.mm49
-rw-r--r--test/Rewriter/rewrite-modern-ivar-access.mm98
-rw-r--r--test/Rewriter/rewrite-modern-ivars-1.mm37
-rw-r--r--test/Rewriter/rewrite-modern-private-ivars.mm53
-rw-r--r--test/Rewriter/rewrite-modern-struct-ivar-1.mm48
-rw-r--r--test/Rewriter/rewrite-modern-struct-ivar.mm32
-rw-r--r--test/Rewriter/rewrite-modern-typeof.mm1
-rw-r--r--test/Rewriter/rewrite-nest.m2
-rw-r--r--test/Rewriter/rewrite-nested-blocks-1.mm3
-rw-r--r--test/Rewriter/rewrite-nested-blocks-2.mm3
-rw-r--r--test/Rewriter/rewrite-nested-blocks.mm3
-rw-r--r--test/Rewriter/rewrite-nested-ivar.mm2
-rwxr-xr-xtest/Rewriter/rewrite-nested-property-in-blocks.mm3
-rw-r--r--test/Rewriter/rewrite-no-nextline.mm2
-rw-r--r--test/Rewriter/rewrite-property-attributes.mm2
-rw-r--r--test/Rewriter/rewrite-property-set-cfstring.mm2
-rw-r--r--test/Rewriter/rewrite-protocol-property.mm2
-rw-r--r--test/Rewriter/rewrite-protocol-qualified.mm2
-rw-r--r--test/Rewriter/rewrite-protocol-type-1.m2
-rw-r--r--test/Rewriter/rewrite-qualified-id.mm2
-rw-r--r--test/Rewriter/rewrite-rewritten-initializer.mm7
-rw-r--r--test/Rewriter/rewrite-static-block.mm2
-rw-r--r--test/Rewriter/rewrite-super-message.mm2
-rw-r--r--test/Rewriter/rewrite-trivial-constructor.mm2
-rw-r--r--test/Rewriter/rewrite-try-catch.m2
-rw-r--r--test/Rewriter/rewrite-typeof.mm2
-rw-r--r--test/Rewriter/rewrite-unique-block-api.mm3
-rw-r--r--test/Rewriter/rewrite-user-defined-accessors.mm2
-rw-r--r--test/Rewriter/rewrite-vararg.m2
-rw-r--r--test/Rewriter/rewrite-weak-attr.m2
-rw-r--r--test/Rewriter/static-type-protocol-1.m2
-rw-r--r--test/Rewriter/undecl-objc-h.m2
-rw-r--r--test/Rewriter/undeclared-method-1.m2
-rw-r--r--test/Rewriter/undef-field-reference-1.m2
-rw-r--r--test/Rewriter/va-method.m2
-rw-r--r--test/Rewriter/weak_byref_objects.m2
104 files changed, 782 insertions, 96 deletions
diff --git a/test/Rewriter/blockcast3.mm b/test/Rewriter/blockcast3.mm
index ceafcff3b091..697a465a9317 100644
--- a/test/Rewriter/blockcast3.mm
+++ b/test/Rewriter/blockcast3.mm
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -E %s -o %t.mm
-// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %t.mm -o %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %t.mm -o %t-rw.cpp
// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %t.mm -o %t-modern-rw.cpp
// RUN: FileCheck -check-prefix LP --input-file=%t-modern-rw.cpp %s
diff --git a/test/Rewriter/blockstruct.m b/test/Rewriter/blockstruct.m
index ef85c587b129..2c443616cf86 100644
--- a/test/Rewriter/blockstruct.m
+++ b/test/Rewriter/blockstruct.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar://8918702
diff --git a/test/Rewriter/crash.m b/test/Rewriter/crash.m
index c61100ed0f09..7908d9fea5e2 100644
--- a/test/Rewriter/crash.m
+++ b/test/Rewriter/crash.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi -o - %s
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -o - %s
// rdar://5950938
@interface NSArray {}
+ (id)arrayWithObjects:(id)firstObj, ...;
diff --git a/test/Rewriter/finally.m b/test/Rewriter/finally.m
index 8fd475cab6e2..f46b4b01a5ff 100644
--- a/test/Rewriter/finally.m
+++ b/test/Rewriter/finally.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi -fobjc-exceptions -verify %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -fobjc-exceptions -verify %s -o -
int main() {
@try {
diff --git a/test/Rewriter/func-in-impl.m b/test/Rewriter/func-in-impl.m
index 350a72671b66..9c4a159364f4 100644
--- a/test/Rewriter/func-in-impl.m
+++ b/test/Rewriter/func-in-impl.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -E %s -o %t.m
-// RUN: %clang_cc1 -fobjc-fragile-abi -rewrite-objc %t.m -o - | FileCheck %s
+// RUN: %clang_cc1 -fobjc-runtime=macosx-fragile-10.5 -rewrite-objc %t.m -o - | FileCheck %s
@interface I {
id _delegate;
diff --git a/test/Rewriter/id-test-3.m b/test/Rewriter/id-test-3.m
index d7a7bf3eb7a0..ec4cfe44b0c9 100644
--- a/test/Rewriter/id-test-3.m
+++ b/test/Rewriter/id-test-3.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@protocol P
- (id<P>) Meth: (id<P>) Arg;
diff --git a/test/Rewriter/inner-block-helper-funcs.mm b/test/Rewriter/inner-block-helper-funcs.mm
index d30e1dcadc87..fb565b6e30f3 100644
--- a/test/Rewriter/inner-block-helper-funcs.mm
+++ b/test/Rewriter/inner-block-helper-funcs.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
// rdar://9846759
diff --git a/test/Rewriter/instancetype-test.mm b/test/Rewriter/instancetype-test.mm
index 788505562c39..4a7f96103afd 100644
--- a/test/Rewriter/instancetype-test.mm
+++ b/test/Rewriter/instancetype-test.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -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"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
diff --git a/test/Rewriter/ivar-encoding-1.m b/test/Rewriter/ivar-encoding-1.m
index d2949439c733..3f5543e4cd15 100644
--- a/test/Rewriter/ivar-encoding-1.m
+++ b/test/Rewriter/ivar-encoding-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@interface Intf
{
diff --git a/test/Rewriter/ivar-encoding-2.m b/test/Rewriter/ivar-encoding-2.m
index da60c79e260a..422568bf479c 100644
--- a/test/Rewriter/ivar-encoding-2.m
+++ b/test/Rewriter/ivar-encoding-2.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@implementation Intf
{
diff --git a/test/Rewriter/metadata-test-1.m b/test/Rewriter/metadata-test-1.m
index b2d6e8daee23..caa7ca3b54e3 100644
--- a/test/Rewriter/metadata-test-1.m
+++ b/test/Rewriter/metadata-test-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@interface Intf
@end
diff --git a/test/Rewriter/metadata-test-2.m b/test/Rewriter/metadata-test-2.m
index 90399f7968ae..3ffda5809c53 100644
--- a/test/Rewriter/metadata-test-2.m
+++ b/test/Rewriter/metadata-test-2.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
typedef struct _NSPoint {
float x;
diff --git a/test/Rewriter/method-encoding-1.m b/test/Rewriter/method-encoding-1.m
index 27abea575e07..2cd309ee9b98 100644
--- a/test/Rewriter/method-encoding-1.m
+++ b/test/Rewriter/method-encoding-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@protocol P1
- (void) MyProtoMeth : (int **) arg1 : (void*) arg2;
diff --git a/test/Rewriter/objc-bool-literal-modern-1.mm b/test/Rewriter/objc-bool-literal-modern-1.mm
index 782517242e52..7aaa79b1e943 100644
--- a/test/Rewriter/objc-bool-literal-modern-1.mm
+++ b/test/Rewriter/objc-bool-literal-modern-1.mm
@@ -2,6 +2,9 @@
// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"__declspec(X)=" %t-rw.cpp
// rdar://11231426
+// rdar://11375908
+typedef unsigned long size_t;
+
typedef bool BOOL;
BOOL yes() {
diff --git a/test/Rewriter/objc-encoding-bug-1.m b/test/Rewriter/objc-encoding-bug-1.m
index 083b570e52d3..55e980493c29 100644
--- a/test/Rewriter/objc-encoding-bug-1.m
+++ b/test/Rewriter/objc-encoding-bug-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
typedef struct NSMethodFrameArgInfo {
struct NSMethodFrameArgInfo *subInfo;
diff --git a/test/Rewriter/objc-ivar-receiver-1.m b/test/Rewriter/objc-ivar-receiver-1.m
index 51950427ca87..6cccf88d104c 100644
--- a/test/Rewriter/objc-ivar-receiver-1.m
+++ b/test/Rewriter/objc-ivar-receiver-1.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o - | grep 'newInv->_container'
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o - | grep 'newInv->_container'
@interface NSMutableArray
- (void)addObject:(id)addObject;
diff --git a/test/Rewriter/objc-modern-StretAPI.mm b/test/Rewriter/objc-modern-StretAPI.mm
new file mode 100644
index 000000000000..129b56cbe92d
--- /dev/null
+++ b/test/Rewriter/objc-modern-StretAPI.mm
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// rdar://11359268
+
+extern "C" void *sel_registerName(const char *);
+typedef unsigned long size_t;
+
+union U {
+ double d1;
+ char filler[32];
+};
+
+struct S {
+ char filler[128];
+};
+
+@interface I
+- (struct S) Meth : (int) arg1 : (id) arg2;
+- (struct S) Meth1;
+- (union U) Meth2 : (double)d;
+- (struct S) VAMeth : (int)anchor, ...;
+@end
+
+I* PI();
+
+extern "C" {
+
+struct S foo () {
+ struct S s = [PI() Meth : 1 : (id)0];
+
+ U u = [PI() Meth2 : 3.14];
+
+ S s1 = [PI() VAMeth : 12, 13.4, 1000, "hello"];
+
+ S s2 = [PI() VAMeth : 12];
+
+ S s3 = [PI() VAMeth : 0, "hello", "there"];
+
+ S s4 = [PI() VAMeth : 2, ^{}, &foo];
+
+ return [PI() Meth1];
+}
+
+}
+
diff --git a/test/Rewriter/objc-modern-boxing.mm b/test/Rewriter/objc-modern-boxing.mm
new file mode 100644
index 000000000000..8f8ed751c58e
--- /dev/null
+++ b/test/Rewriter/objc-modern-boxing.mm
@@ -0,0 +1,72 @@
+// RUN: %clang_cc1 -E %s -o %t.mm
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %t.mm -o - | FileCheck %s
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %t.mm -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp -Wno-attributes
+
+extern char *strdup(const char *str);
+extern "C" void *sel_registerName(const char *);
+
+typedef signed char BOOL;
+typedef long NSInteger;
+typedef unsigned long NSUInteger;
+
+#if __has_feature(objc_bool)
+#define YES __objc_yes
+#define NO __objc_no
+#else
+#define YES ((BOOL)1)
+#define NO ((BOOL)0)
+#endif
+
+@interface NSNumber
++ (NSNumber *)numberWithChar:(char)value;
++ (NSNumber *)numberWithUnsignedChar:(unsigned char)value;
++ (NSNumber *)numberWithShort:(short)value;
++ (NSNumber *)numberWithUnsignedShort:(unsigned short)value;
++ (NSNumber *)numberWithInt:(int)value;
++ (NSNumber *)numberWithUnsignedInt:(unsigned int)value;
++ (NSNumber *)numberWithLong:(long)value;
++ (NSNumber *)numberWithUnsignedLong:(unsigned long)value;
++ (NSNumber *)numberWithLongLong:(long long)value;
++ (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value;
++ (NSNumber *)numberWithFloat:(float)value;
++ (NSNumber *)numberWithDouble:(double)value;
++ (NSNumber *)numberWithBool:(BOOL)value;
++ (NSNumber *)numberWithInteger:(NSInteger)value ;
++ (NSNumber *)numberWithUnsignedInteger:(NSUInteger)value ;
+@end
+
+@interface NSString
++ (id)stringWithUTF8String:(const char *)str;
+@end
+
+int main(int argc, const char *argv[]) {
+ // character.
+ NSNumber *theLetterZ = @('Z'); // equivalent to [NSNumber numberWithChar:('Z')]
+
+ // integral.
+ NSNumber *fortyTwo = @(42); // equivalent to [NSNumber numberWithInt:(42)]
+ NSNumber *fortyTwoUnsigned = @(42U); // equivalent to [NSNumber numberWithUnsignedInt:(42U)]
+ NSNumber *fortyTwoLong = @(42L); // equivalent to [NSNumber numberWithLong:(42L)]
+ NSNumber *fortyTwoLongLong = @(42LL); // equivalent to [NSNumber numberWithLongLong:(42LL)]
+
+ // floating point.
+ NSNumber *piFloat = @(3.141592654F); // equivalent to [NSNumber numberWithFloat:(3.141592654F)]
+ NSNumber *piDouble = @(3.1415926535); // equivalent to [NSNumber numberWithDouble:(3.1415926535)]
+
+ BOOL b;
+ NSNumber *nsb = @(b);
+
+ // Strings.
+ NSString *duplicateString = @(strdup("Hello"));
+}
+
+// CHECK: NSNumber *theLetterZ = ((NSNumber *(*)(id, SEL, char))(void *)objc_msgSend)(objc_getClass("NSNumber"), sel_registerName("numberWithChar:"), ('Z'));
+// CHECK: NSNumber *fortyTwo = ((NSNumber *(*)(id, SEL, int))(void *)objc_msgSend)(objc_getClass("NSNumber"), sel_registerName("numberWithInt:"), (42));
+// CHECK: NSNumber *fortyTwoUnsigned = ((NSNumber *(*)(id, SEL, unsigned int))(void *)objc_msgSend)(objc_getClass("NSNumber"), sel_registerName("numberWithUnsignedInt:"), (42U));
+// CHECK: NSNumber *fortyTwoLong = ((NSNumber *(*)(id, SEL, long))(void *)objc_msgSend)(objc_getClass("NSNumber"), sel_registerName("numberWithLong:"), (42L));
+// CHECK: NSNumber *fortyTwoLongLong = ((NSNumber *(*)(id, SEL, long long))(void *)objc_msgSend)(objc_getClass("NSNumber"), sel_registerName("numberWithLongLong:"), (42LL));
+// CHECK: NSNumber *piFloat = ((NSNumber *(*)(id, SEL, float))(void *)objc_msgSend)(objc_getClass("NSNumber"), sel_registerName("numberWithFloat:"), (3.1415927));
+// CHECK: NSNumber *piDouble = ((NSNumber *(*)(id, SEL, double))(void *)objc_msgSend)(objc_getClass("NSNumber"), sel_registerName("numberWithDouble:"), (3.1415926535));
+// CHECK: NSNumber *nsb = ((NSNumber *(*)(id, SEL, BOOL))(void *)objc_msgSend)(objc_getClass("NSNumber"), sel_registerName("numberWithBool:"), (BOOL)(b));
+// CHECK: NSString *duplicateString = ((NSString *(*)(id, SEL, const char *))(void *)objc_msgSend)(objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), (const char *)(strdup("Hello")));
diff --git a/test/Rewriter/objc-modern-container-subscript.mm b/test/Rewriter/objc-modern-container-subscript.mm
index d6bb9c2eb31d..cdcff03b770b 100644
--- a/test/Rewriter/objc-modern-container-subscript.mm
+++ b/test/Rewriter/objc-modern-container-subscript.mm
@@ -2,9 +2,10 @@
// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar://11203853
+typedef unsigned long size_t;
+
void *sel_registerName(const char *);
-typedef unsigned int size_t;
@protocol P @end
@interface NSMutableArray
diff --git a/test/Rewriter/objc-modern-getclass-proto.mm b/test/Rewriter/objc-modern-getclass-proto.mm
new file mode 100644
index 000000000000..98e76e01aac7
--- /dev/null
+++ b/test/Rewriter/objc-modern-getclass-proto.mm
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -E %s -o %t.mm
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %t.mm -o %t-rw.cpp
+// rdar://11375495
+
+@interface I @end
+@implementation I @end
+
+// CHECK: __OBJC_RW_DLLIMPORT struct objc_class *objc_getClass(const char *);
+// CHECK: __OBJC_RW_DLLIMPORT struct objc_class *objc_getMetaClass(const char *);
+
diff --git a/test/Rewriter/objc-modern-property-attributes.mm b/test/Rewriter/objc-modern-property-attributes.mm
index 7d74a95e7d16..abebb2c0feff 100644
--- a/test/Rewriter/objc-modern-property-attributes.mm
+++ b/test/Rewriter/objc-modern-property-attributes.mm
@@ -33,3 +33,13 @@ typedef void (^void_block_t)(void);
// CHECK: T@?,C,V__completion
// CHECK: T@\"PropertyClass\",&,VYVAR
+@interface Test @end
+@interface Test (Category)
+@property int q;
+@end
+
+@implementation Test (Category)
+@dynamic q;
+@end
+
+// CHECK: {{"q","Ti,D"}}
diff --git a/test/Rewriter/objc-string-concat-1.m b/test/Rewriter/objc-string-concat-1.m
index 80a9f04651dd..9a23abcc7ff9 100644
--- a/test/Rewriter/objc-string-concat-1.m
+++ b/test/Rewriter/objc-string-concat-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@class NSString;
diff --git a/test/Rewriter/objc-super-test.m b/test/Rewriter/objc-super-test.m
index fa95ad2fd346..68412d899b9c 100644
--- a/test/Rewriter/objc-super-test.m
+++ b/test/Rewriter/objc-super-test.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o - | grep objc_msgSendSuper | grep MainMethod
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o - | grep objc_msgSendSuper | grep MainMethod
typedef struct objc_selector *SEL;
typedef struct objc_object *id;
diff --git a/test/Rewriter/objc-synchronized-1.m b/test/Rewriter/objc-synchronized-1.m
index df5553690ffc..0e985ab67f2b 100644
--- a/test/Rewriter/objc-synchronized-1.m
+++ b/test/Rewriter/objc-synchronized-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
id SYNCH_EXPR();
void SYNCH_BODY();
diff --git a/test/Rewriter/properties.m b/test/Rewriter/properties.m
index 493fc3f8f4b1..67e864ed0fab 100644
--- a/test/Rewriter/properties.m
+++ b/test/Rewriter/properties.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fms-extensions -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
void *sel_registerName(const char *);
diff --git a/test/Rewriter/property-dot-syntax.mm b/test/Rewriter/property-dot-syntax.mm
index c8ee7234b4b2..c3e4405ebb58 100644
--- a/test/Rewriter/property-dot-syntax.mm
+++ b/test/Rewriter/property-dot-syntax.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar:// 8520727
diff --git a/test/Rewriter/protocol-rewrite-1.m b/test/Rewriter/protocol-rewrite-1.m
index 687a2591611a..541b7ee9baba 100644
--- a/test/Rewriter/protocol-rewrite-1.m
+++ b/test/Rewriter/protocol-rewrite-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
typedef struct MyWidget {
int a;
diff --git a/test/Rewriter/protocol-rewrite-2.m b/test/Rewriter/protocol-rewrite-2.m
index e0ec4f991b53..e0d59e88fe33 100644
--- a/test/Rewriter/protocol-rewrite-2.m
+++ b/test/Rewriter/protocol-rewrite-2.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o %t.cpp
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t.cpp
// RUN: %clang_cc1 -fsyntax-only %t.cpp
// rdar://10234024
diff --git a/test/Rewriter/rewrite-anonymous-union.m b/test/Rewriter/rewrite-anonymous-union.m
index 339524fbc8ab..bc35fd02e9fc 100644
--- a/test/Rewriter/rewrite-anonymous-union.m
+++ b/test/Rewriter/rewrite-anonymous-union.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi -o - %s
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -o - %s
// rdar://6948022
typedef unsigned int uint32_t;
diff --git a/test/Rewriter/rewrite-api-bug.m b/test/Rewriter/rewrite-api-bug.m
index ebaa0be13d67..f4a88ddf7782 100644
--- a/test/Rewriter/rewrite-api-bug.m
+++ b/test/Rewriter/rewrite-api-bug.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@interface MyDerived
- (void) instanceMethod;
diff --git a/test/Rewriter/rewrite-block-argument.m b/test/Rewriter/rewrite-block-argument.m
index 898f9836a743..4e1194d507d4 100644
--- a/test/Rewriter/rewrite-block-argument.m
+++ b/test/Rewriter/rewrite-block-argument.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" -emit-llvm -o %t %t-rw.cpp
// radar 7987817
diff --git a/test/Rewriter/rewrite-block-consts.mm b/test/Rewriter/rewrite-block-consts.mm
index 1d6de8cd6abc..1b32b35f33a8 100644
--- a/test/Rewriter/rewrite-block-consts.mm
+++ b/test/Rewriter/rewrite-block-consts.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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__block="" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar:// 8243071
diff --git a/test/Rewriter/rewrite-block-ivar-call.mm b/test/Rewriter/rewrite-block-ivar-call.mm
index 2ec27b3eb065..8e5a2ea124a8 100644
--- a/test/Rewriter/rewrite-block-ivar-call.mm
+++ b/test/Rewriter/rewrite-block-ivar-call.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -fblocks -rewrite-objc -fobjc-fragile-abi -o - %s
+// RUN: %clang_cc1 -x objective-c++ -fblocks -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -o - %s
@interface Foo {
void (^_block)(void);
diff --git a/test/Rewriter/rewrite-block-literal-1.mm b/test/Rewriter/rewrite-block-literal-1.mm
index f152117443a7..88ad5742effa 100644
--- a/test/Rewriter/rewrite-block-literal-1.mm
+++ b/test/Rewriter/rewrite-block-literal-1.mm
@@ -1,10 +1,13 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// radar 9254348
// 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 -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
// rdar://11259664
+// rdar://11375908
+typedef unsigned long size_t;
+
void *sel_registerName(const char *);
typedef void (^BLOCK_TYPE)(void);
diff --git a/test/Rewriter/rewrite-block-literal.mm b/test/Rewriter/rewrite-block-literal.mm
index 083312e79dd7..43f581125ba0 100644
--- a/test/Rewriter/rewrite-block-literal.mm
+++ b/test/Rewriter/rewrite-block-literal.mm
@@ -1,10 +1,13 @@
// RUN: %clang_cc1 -E %s -o %t.mm
// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %t.mm -o - | FileCheck %s
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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"Class=void*" -D"id=void*" -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"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
+// rdar://11375908
+typedef unsigned long size_t;
+
// rdar: // 11006566
void I( void (^)(void));
diff --git a/test/Rewriter/rewrite-block-pointer.mm b/test/Rewriter/rewrite-block-pointer.mm
index 58407a7ac5cf..9f3368098cad 100644
--- a/test/Rewriter/rewrite-block-pointer.mm
+++ b/test/Rewriter/rewrite-block-pointer.mm
@@ -1,9 +1,12 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 *);
diff --git a/test/Rewriter/rewrite-block-property.m b/test/Rewriter/rewrite-block-property.m
index 5c44b7dd1ee9..1328ab7918ec 100644
--- a/test/Rewriter/rewrite-block-property.m
+++ b/test/Rewriter/rewrite-block-property.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar://9055596
diff --git a/test/Rewriter/rewrite-byref-in-nested-blocks.mm b/test/Rewriter/rewrite-byref-in-nested-blocks.mm
index a65938345637..022bb5f4e357 100644
--- a/test/Rewriter/rewrite-byref-in-nested-blocks.mm
+++ b/test/Rewriter/rewrite-byref-in-nested-blocks.mm
@@ -1,9 +1,12 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
-// RUN: %clang_cc1 -fsyntax-only -fblocks -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 -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"SEL=void*" -U__declspec -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
+// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-modern-rw.cpp
// radar 7692350
+// rdar://11375908
+typedef unsigned long size_t;
+
void f(void (^block)(void));
@interface X {
diff --git a/test/Rewriter/rewrite-byref-vars.mm b/test/Rewriter/rewrite-byref-vars.mm
index 14a182a345c3..cfc51341d736 100644
--- a/test/Rewriter/rewrite-byref-vars.mm
+++ b/test/Rewriter/rewrite-byref-vars.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// radar 7540194
@@ -53,5 +53,5 @@ __declspec(dllexport) extern "C" __declspec(dllexport) void XXXXBreakTheRewriter
- (void) Meth { __attribute__((__blocks__(byref))) void ** listp = (void **)list; }
@end
-// $CLANG -cc1 -fms-extensions -rewrite-objc -fobjc-fragile-abi -x objective-c++ -fblocks bug.mm
+// $CLANG -cc1 -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -x objective-c++ -fblocks bug.mm
// g++ -c -D"__declspec(X)=" bug.cpp
diff --git a/test/Rewriter/rewrite-cast-ivar-access.mm b/test/Rewriter/rewrite-cast-ivar-access.mm
index ccc1cdec606c..4e50ff142a8c 100644
--- a/test/Rewriter/rewrite-cast-ivar-access.mm
+++ b/test/Rewriter/rewrite-cast-ivar-access.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
// radar 7575882
diff --git a/test/Rewriter/rewrite-cast-to-bool.mm b/test/Rewriter/rewrite-cast-to-bool.mm
index b3272b6d99b3..58db706e3ce9 100644
--- a/test/Rewriter/rewrite-cast-to-bool.mm
+++ b/test/Rewriter/rewrite-cast-to-bool.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// radar 9899834
diff --git a/test/Rewriter/rewrite-category-property.mm b/test/Rewriter/rewrite-category-property.mm
index b54bb67063f5..50ef4326e4e9 100644
--- a/test/Rewriter/rewrite-category-property.mm
+++ b/test/Rewriter/rewrite-category-property.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
// radar 7630636
diff --git a/test/Rewriter/rewrite-constructor-init.mm b/test/Rewriter/rewrite-constructor-init.mm
index f12de1f0329b..fa0e14893e0f 100644
--- a/test/Rewriter/rewrite-constructor-init.mm
+++ b/test/Rewriter/rewrite-constructor-init.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar : // 8213998
diff --git a/test/Rewriter/rewrite-eh.m b/test/Rewriter/rewrite-eh.m
index 46d1930cad95..6e6fb1c24cc6 100644
--- a/test/Rewriter/rewrite-eh.m
+++ b/test/Rewriter/rewrite-eh.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi -fobjc-exceptions -o - %s
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -fobjc-exceptions -o - %s
// rdar://7522880
@interface NSException
diff --git a/test/Rewriter/rewrite-elaborated-type.mm b/test/Rewriter/rewrite-elaborated-type.mm
index a0c7e43b0429..f2faa55cb5ad 100644
--- a/test/Rewriter/rewrite-elaborated-type.mm
+++ b/test/Rewriter/rewrite-elaborated-type.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -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_Bool=bool -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D_Bool=bool -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
diff --git a/test/Rewriter/rewrite-extern-c.mm b/test/Rewriter/rewrite-extern-c.mm
index c6104938adab..cf37d7597e3a 100644
--- a/test/Rewriter/rewrite-extern-c.mm
+++ b/test/Rewriter/rewrite-extern-c.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -fblocks -rewrite-objc -fobjc-fragile-abi -o - %s
+// RUN: %clang_cc1 -x objective-c++ -fblocks -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -o - %s
// radar 7546096
extern "C" {
diff --git a/test/Rewriter/rewrite-foreach-1.m b/test/Rewriter/rewrite-foreach-1.m
index f57e13c40956..5263fffbe7dd 100644
--- a/test/Rewriter/rewrite-foreach-1.m
+++ b/test/Rewriter/rewrite-foreach-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@protocol P @end
diff --git a/test/Rewriter/rewrite-foreach-2.m b/test/Rewriter/rewrite-foreach-2.m
index 228612aa854c..120d7d7e7985 100644
--- a/test/Rewriter/rewrite-foreach-2.m
+++ b/test/Rewriter/rewrite-foreach-2.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@protocol P @end
diff --git a/test/Rewriter/rewrite-foreach-3.m b/test/Rewriter/rewrite-foreach-3.m
index ef3803f55234..6e67415002a3 100644
--- a/test/Rewriter/rewrite-foreach-3.m
+++ b/test/Rewriter/rewrite-foreach-3.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@protocol P @end
diff --git a/test/Rewriter/rewrite-foreach-4.m b/test/Rewriter/rewrite-foreach-4.m
index 42cb2fb0c25e..e852c75cd2ef 100644
--- a/test/Rewriter/rewrite-foreach-4.m
+++ b/test/Rewriter/rewrite-foreach-4.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@interface MyList
- (id) allKeys;
diff --git a/test/Rewriter/rewrite-foreach-5.m b/test/Rewriter/rewrite-foreach-5.m
index 2940f453d932..1d3cc57618ec 100644
--- a/test/Rewriter/rewrite-foreach-5.m
+++ b/test/Rewriter/rewrite-foreach-5.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
void *sel_registerName(const char *);
diff --git a/test/Rewriter/rewrite-foreach-6.m b/test/Rewriter/rewrite-foreach-6.m
index 968c6f4a47ec..5159d383e577 100644
--- a/test/Rewriter/rewrite-foreach-6.m
+++ b/test/Rewriter/rewrite-foreach-6.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar://5716356
// FIXME: Should be able to pipe into clang, but code is not
diff --git a/test/Rewriter/rewrite-foreach-7.m b/test/Rewriter/rewrite-foreach-7.m
index 8c9293fec953..8f3a7c8819fa 100644
--- a/test/Rewriter/rewrite-foreach-7.m
+++ b/test/Rewriter/rewrite-foreach-7.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@class NSArray;
int main() {
diff --git a/test/Rewriter/rewrite-foreach-in-block.mm b/test/Rewriter/rewrite-foreach-in-block.mm
index fd34212d672e..2c1023b0c706 100644
--- a/test/Rewriter/rewrite-foreach-in-block.mm
+++ b/test/Rewriter/rewrite-foreach-in-block.mm
@@ -1,9 +1,11 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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"id=void*" -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"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
// rdar:// 9878420
+typedef unsigned long size_t;
+
void objc_enumerationMutation(id);
void *sel_registerName(const char *);
typedef void (^CoreDAVCompletionBlock)(void);
diff --git a/test/Rewriter/rewrite-foreach-protocol-id.m b/test/Rewriter/rewrite-foreach-protocol-id.m
index 034fb7a9bb08..5680110a524e 100644
--- a/test/Rewriter/rewrite-foreach-protocol-id.m
+++ b/test/Rewriter/rewrite-foreach-protocol-id.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar:// 9039342
diff --git a/test/Rewriter/rewrite-forward-class.m b/test/Rewriter/rewrite-forward-class.m
index 0ac620a058c1..28bab9d441e0 100644
--- a/test/Rewriter/rewrite-forward-class.m
+++ b/test/Rewriter/rewrite-forward-class.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar://6969189
diff --git a/test/Rewriter/rewrite-forward-class.mm b/test/Rewriter/rewrite-forward-class.mm
index 8e4eda63f88e..9f4e7e21e862 100644
--- a/test/Rewriter/rewrite-forward-class.mm
+++ b/test/Rewriter/rewrite-forward-class.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
extern "C" {
diff --git a/test/Rewriter/rewrite-function-decl.mm b/test/Rewriter/rewrite-function-decl.mm
index 883d3931d638..af85f687bf5a 100644
--- a/test/Rewriter/rewrite-function-decl.mm
+++ b/test/Rewriter/rewrite-function-decl.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fms-extensions -rewrite-objc -fobjc-fragile-abi -x objective-c++ -fblocks -o - %s
+// RUN: %clang_cc1 -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -x objective-c++ -fblocks -o - %s
extern "C" __declspec(dllexport) void BreakTheRewriter(void) {
__block int aBlockVariable = 0;
diff --git a/test/Rewriter/rewrite-implementation.mm b/test/Rewriter/rewrite-implementation.mm
index 2cc3387b32bb..8ef4ebe97aff 100644
--- a/test/Rewriter/rewrite-implementation.mm
+++ b/test/Rewriter/rewrite-implementation.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -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
// radar 7649577
diff --git a/test/Rewriter/rewrite-ivar-use.m b/test/Rewriter/rewrite-ivar-use.m
index 53b07c434f37..17bbf01af133 100644
--- a/test/Rewriter/rewrite-ivar-use.m
+++ b/test/Rewriter/rewrite-ivar-use.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// radar 7490331
diff --git a/test/Rewriter/rewrite-local-externs-in-block.mm b/test/Rewriter/rewrite-local-externs-in-block.mm
index 35d282bd5193..b31b422ab758 100644
--- a/test/Rewriter/rewrite-local-externs-in-block.mm
+++ b/test/Rewriter/rewrite-local-externs-in-block.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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
// radar 7735987
diff --git a/test/Rewriter/rewrite-local-static-id.mm b/test/Rewriter/rewrite-local-static-id.mm
index b002b6eefd24..b3d2c4833ed1 100644
--- a/test/Rewriter/rewrite-local-static-id.mm
+++ b/test/Rewriter/rewrite-local-static-id.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" -emit-llvm -o %t %t-rw.cpp
// radar 7946975
diff --git a/test/Rewriter/rewrite-message-expr.mm b/test/Rewriter/rewrite-message-expr.mm
index dafb31b2b543..72569cb8376f 100644
--- a/test/Rewriter/rewrite-message-expr.mm
+++ b/test/Rewriter/rewrite-message-expr.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
// radar 7617047
diff --git a/test/Rewriter/rewrite-modern-atautoreleasepool.mm b/test/Rewriter/rewrite-modern-atautoreleasepool.mm
new file mode 100644
index 000000000000..57c08abb78e7
--- /dev/null
+++ b/test/Rewriter/rewrite-modern-atautoreleasepool.mm
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -E %s -o %t.mm
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %t.mm -o %t-rw.cpp
+// RUN: FileCheck --input-file=%t-rw.cpp %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// radar 11474836
+
+extern "C"
+void *sel_registerName(const char *);
+
+@interface I
+{
+ id ivar;
+}
+- (id) Meth;
++ (id) MyAlloc;;
+@end
+
+@implementation I
+- (id) Meth {
+ @autoreleasepool {
+ id p = [I MyAlloc];
+ if (!p)
+ return ivar;
+ }
+ return 0;
+}
++ (id) MyAlloc {
+ return 0;
+}
+@end
+
+// CHECK: /* @autoreleasepool */ { __AtAutoreleasePool __autoreleasepool;
diff --git a/test/Rewriter/rewrite-modern-block-consts.mm b/test/Rewriter/rewrite-modern-block-consts.mm
new file mode 100644
index 000000000000..48c8d4023d31
--- /dev/null
+++ b/test/Rewriter/rewrite-modern-block-consts.mm
@@ -0,0 +1,22 @@
+// 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 -Werror -Wno-address-of-temporary -U__declspec -D"__declspec(X)=" %t-modern-rw.cpp
+// rdar:// 8243071
+
+// rdar://11375908
+typedef unsigned long size_t;
+
+void x(int y) {}
+void f() {
+ const int bar = 3;
+ int baz = 4;
+ __block int bab = 4;
+ __block const int bas = 5;
+ void (^b)() = ^{
+ x(bar);
+ x(baz);
+ x(bab);
+ x(bas);
+ b();
+ };
+ b();
+}
diff --git a/test/Rewriter/rewrite-modern-block.mm b/test/Rewriter/rewrite-modern-block.mm
index 8da723d319ff..23029654c984 100644
--- a/test/Rewriter/rewrite-modern-block.mm
+++ b/test/Rewriter/rewrite-modern-block.mm
@@ -1,7 +1,8 @@
// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
-// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp
// rdar://11230308
+typedef unsigned long size_t;
typedef struct {
char byte0;
char byte1;
@@ -20,4 +21,45 @@ void y() {
// rdar://11236342
int foo() {
__block int hello;
+ return hello;
}
+
+// rdar://7547630
+// rewriting multiple __block decls on wintin same decl stmt.
+void radar7547630() {
+ __block int BI1, BI2;
+
+ __block float FLOAT1, FT2, FFFFFFFF3,
+ FFFXXX4;
+
+ __block void (^B)(), (^BB)();
+}
+
+// rewriting multiple __block decls on wintin same decl stmt
+// with initializers.
+int rdar7547630(const char *keybuf, const char *valuebuf) {
+ __block int BI1 = 1, BI2 = 2;
+
+ double __block BYREFVAR = 1.34, BYREFVAR_NO_INIT, BYREFVAR2 = 1.37;
+
+ __block const char *keys = keybuf, *values = valuebuf, *novalues;
+
+ return BI2;
+}
+
+// rdar://11326988
+typedef struct _z {
+ int location;
+ int length;
+} z;
+
+z w(int loc, int len);
+
+@interface rdar11326988
+@end
+@implementation rdar11326988
+- (void)y:(int)options {
+ __attribute__((__blocks__(byref))) z firstRange = w(1, 0);
+ options &= ~(1 | 2);
+}
+@end
diff --git a/test/Rewriter/rewrite-modern-captured-nested-bvar.mm b/test/Rewriter/rewrite-modern-captured-nested-bvar.mm
new file mode 100644
index 000000000000..a8fd18073372
--- /dev/null
+++ b/test/Rewriter/rewrite-modern-captured-nested-bvar.mm
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -E %s -o %t.mm
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %t.mm -o - | FileCheck %s
+// rdar://9006279
+
+void q(void (^p)(void)) {
+ p();
+}
+
+void f() {
+ __block char BYREF_VAR_CHECK = 'a';
+ __block char d = 'd';
+ q(^{
+ q(^{
+ __block char e = 'e';
+ char l = 'l';
+ BYREF_VAR_CHECK = 'b';
+ d = 'd';
+ q(^{
+ e = '1';
+ BYREF_VAR_CHECK = '2';
+ d = '3';
+ }
+ );
+ });
+ });
+}
+
+int main() {
+ f();
+ return 0;
+}
+
+// CHECK 2: (__Block_byref_BYREF_VAR_CHECK_0 *)BYREF_VAR_CHECK
+// CHECK: {(void*)0,(__Block_byref_BYREF_VAR_CHECK_0 *)&BYREF_VAR_CHECK, 0, sizeof(__Block_byref_BYREF_VAR_CHECK_0), 'a'}
+// CHECK: __Block_byref_BYREF_VAR_CHECK_0 *)&BYREF_VAR_CHECK, (__Block_byref_d_1 *)&d, 570425344));
diff --git a/test/Rewriter/rewrite-modern-default-property-synthesis.mm b/test/Rewriter/rewrite-modern-default-property-synthesis.mm
new file mode 100644
index 000000000000..fd1a578f083f
--- /dev/null
+++ b/test/Rewriter/rewrite-modern-default-property-synthesis.mm
@@ -0,0 +1,80 @@
+// RUN: %clang_cc1 -E %s -o %t.mm
+// RUN: %clang_cc1 -x objective-c++ -fms-extensions -fobjc-default-synthesize-properties -rewrite-objc %t.mm -o %t-rw.cpp
+// RUN: FileCheck --input-file=%t-rw.cpp %s
+// RUN: %clang_cc1 -fsyntax-only -Werror -DSEL="void *" -Did="struct objc_object *" -Wno-attributes -Wno-address-of-temporary -U__declspec -D"__declspec(X)=" %t-rw.cpp
+// rdar://11374235
+
+extern "C" void *sel_registerName(const char *);
+
+@interface NSObject
+- (void) release;
+- (id) retain;
+@end
+@class NSString;
+
+@interface SynthItAll : NSObject
+@property int howMany;
+@property (retain) NSString* what;
+@end
+
+@implementation SynthItAll
+@end
+
+
+@interface SynthSetter : NSObject
+@property (nonatomic) int howMany;
+@property (nonatomic, retain) NSString* what;
+@end
+
+@implementation SynthSetter
+
+- (int) howMany {
+ return _howMany;
+}
+// - (void) setHowMany: (int) value
+
+- (NSString*) what {
+ return _what;
+}
+// - (void) setWhat: (NSString*) value
+@end
+
+
+@interface SynthGetter : NSObject
+@property (nonatomic) int howMany;
+@property (nonatomic, retain) NSString* what;
+@end
+
+@implementation SynthGetter
+// - (int) howMany
+- (void) setHowMany: (int) value {
+ _howMany = value;
+}
+
+// - (NSString*) what
+- (void) setWhat: (NSString*) value {
+ if (_what != value) {
+ [_what release];
+ _what = [value retain];
+ }
+}
+@end
+
+typedef struct {
+ int x:1;
+ int y:1;
+} TBAR;
+
+@interface NONAME
+{
+ TBAR _bar;
+}
+@property TBAR bad;
+@end
+
+@implementation NONAME
+@end
+
+// CHECK: (*(int *)((char *)self + OBJC_IVAR_$_SynthItAll$_howMany)) = howMany;
+// CHECK: return (*(int *)((char *)self + OBJC_IVAR_$_SynthGetter$_howMany));
+// CHECK: (*(TBAR *)((char *)self + OBJC_IVAR_$_NONAME$_bad)) = bad;
diff --git a/test/Rewriter/rewrite-modern-extern-c-func-decl.mm b/test/Rewriter/rewrite-modern-extern-c-func-decl.mm
index 82d5a4d9c34e..c3bfec9e228c 100644
--- a/test/Rewriter/rewrite-modern-extern-c-func-decl.mm
+++ b/test/Rewriter/rewrite-modern-extern-c-func-decl.mm
@@ -2,6 +2,7 @@
// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -Wno-attributes -D"Class=void*" -D"id=void*" -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp
// rdar://11131490
+typedef unsigned long size_t;
extern "C" __declspec(dllexport) void BreakTheRewriter(void) {
__block int aBlockVariable = 0;
void (^aBlock)(void) = ^ {
@@ -43,3 +44,51 @@ main (int argc, char *argv[])
bBlockVariable = 42;
};
}
+
+// rdar://11275241
+static char stringtype;
+char CFStringGetTypeID();
+void x(void (^)());
+
+static void initStatics(int arg, ...) {
+ x(^{
+ stringtype = CFStringGetTypeID();
+ });
+}
+static void initStatics1(...) {
+ x(^{
+ stringtype = CFStringGetTypeID();
+ });
+}
+static void initStatics2() {
+ x(^{
+ stringtype = CFStringGetTypeID();
+ });
+}
+
+// rdar://11314329
+static inline const void *auto_zone_base_pointer(void *zone, const void *ptr) { return 0; }
+
+@interface I
+{
+ id list;
+}
+- (void) Meth;
+// radar 7589385 use before definition
+- (void) allObjects;
+@end
+
+@implementation I
+// radar 7589385 use before definition
+- (void) allObjects {
+ __attribute__((__blocks__(byref))) id *listp;
+
+ void (^B)(void) = ^(void) {
+ *listp++ = 0;
+ };
+
+ B();
+}
+- (void) Meth { __attribute__((__blocks__(byref))) void ** listp = (void **)list; }
+@end
+
diff --git a/test/Rewriter/rewrite-modern-ivar-access.mm b/test/Rewriter/rewrite-modern-ivar-access.mm
new file mode 100644
index 000000000000..4bde1a401312
--- /dev/null
+++ b/test/Rewriter/rewrite-modern-ivar-access.mm
@@ -0,0 +1,98 @@
+// RUN: %clang_cc1 -fblocks -rewrite-objc -fms-extensions %s -o %t-rw.cpp
+// RUN: %clang_cc1 -Werror -fsyntax-only -Wno-address-of-temporary -Wno-c++11-narrowing -std=c++11 -D"Class=void*" -D"id=void*" -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp
+
+struct OUTSIDE {
+ int i_OUTSIDE;
+ double d_OUTSIDE;
+};
+
+
+@interface I1 {
+@protected
+ struct OUTSIDE ivar_I1;
+
+ struct INNER_I1 {
+ int i_INNER_I1;
+ double d_INNER_I1;
+ };
+
+ struct INNER_I1 ivar_I2;
+
+ struct OUTSIDE ivar_I3;
+
+ struct {
+ int i_noname;
+ double d_noname;
+ } NONAME_I4;
+
+ struct {
+ int i_noname;
+ double d_noname;
+ } NONAME_I5;
+}
+@end
+
+@implementation I1
+- (void) I1_Meth {
+ ivar_I1.i_OUTSIDE = 0;
+
+ ivar_I2.i_INNER_I1 = 1;
+
+ ivar_I3.i_OUTSIDE = 2;
+
+ NONAME_I4.i_noname = 3;
+
+ NONAME_I5.i_noname = 4;
+}
+@end
+
+@interface INTF2 {
+@protected
+ struct OUTSIDE ivar_INTF2;
+
+ struct {
+ int i_noname;
+ double d_noname;
+ } NONAME_INTF4;
+
+
+ struct OUTSIDE ivar_INTF3;
+
+ struct INNER_I1 ivar_INTF4;
+
+ struct {
+ int i_noname;
+ double d_noname;
+ } NONAME_INTF5;
+
+ struct INNER_INTF2 {
+ int i_INNER_INTF2;
+ double d_INNER_INTF2;
+ };
+
+ struct INNER_INTF2 ivar_INTF6, ivar_INTF7;
+
+ struct INNER_INTF3 {
+ int i;
+ } X1,X2,X3;
+
+}
+@end
+
+@implementation INTF2
+- (void) I2_Meth {
+ ivar_INTF2.i_OUTSIDE = 0;
+
+ ivar_INTF4.i_INNER_I1 = 1;
+
+ ivar_INTF3.i_OUTSIDE = 2;
+
+ NONAME_INTF4.i_noname = 3;
+
+ NONAME_INTF5.i_noname = 4;
+ ivar_INTF6.i_INNER_INTF2 = 5;
+ ivar_INTF7.i_INNER_INTF2 = 5;
+ X1.i = X2.i = X3.i = 1;
+}
+@end
+
diff --git a/test/Rewriter/rewrite-modern-ivars-1.mm b/test/Rewriter/rewrite-modern-ivars-1.mm
index 376d300c7e9d..dbd28d121ee0 100644
--- a/test/Rewriter/rewrite-modern-ivars-1.mm
+++ b/test/Rewriter/rewrite-modern-ivars-1.mm
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
-// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp
@interface NSCheapMutableString {
@private
@@ -87,3 +87,38 @@
}
@end
+enum OUTSIDE {
+ yes
+};
+
+@interface MoreEnumTests {
+@private
+ enum INSIDE {
+ no
+ } others;
+
+ enum OUTSIDE meetoo;
+
+ enum {
+ one,
+ two
+ } eu;
+}
+@end
+
+@interface I {
+ enum INSIDE I1;
+ enum OUTSIDE I2;
+ enum ALSO_INSIDE {
+ maybe
+ } I3;
+
+ enum ALSO_INSIDE I4;
+
+ enum {
+ three,
+ four
+ } I5;
+}
+@end
+
diff --git a/test/Rewriter/rewrite-modern-private-ivars.mm b/test/Rewriter/rewrite-modern-private-ivars.mm
new file mode 100644
index 000000000000..fc2e73bb26e6
--- /dev/null
+++ b/test/Rewriter/rewrite-modern-private-ivars.mm
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 -fblocks -rewrite-objc -fms-extensions %s -o %t-rw.cpp
+// RUN: %clang_cc1 -Werror -fsyntax-only -Wno-address-of-temporary -Wno-c++11-narrowing -std=c++11 -D"Class=void*" -D"id=void*" -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp
+// rdar://11351299
+
+struct Q {
+ int x;
+};
+
+@interface I
+@end
+
+@interface I() {
+
+ struct {
+ int x;
+ } unnamed;
+
+ struct S {
+ int x;
+ } foo;
+
+ double dd;
+
+ struct S foo1;
+}
+@end
+
+@implementation I
+{
+ struct P {
+ int x;
+ } bar;
+
+ double ee;
+
+ struct Q bar1;
+
+ struct {
+ int x;
+ } noname;
+}
+
+- (void) Meth {
+ foo.x = 1;
+ bar.x = 2;
+ dd = 1.23;
+ ee = 0.0;
+ foo1.x = 3;
+ bar1.x = 4;
+ noname.x = 3;
+ unnamed.x = 10;
+}
+@end
diff --git a/test/Rewriter/rewrite-modern-struct-ivar-1.mm b/test/Rewriter/rewrite-modern-struct-ivar-1.mm
new file mode 100644
index 000000000000..a17fe3f85675
--- /dev/null
+++ b/test/Rewriter/rewrite-modern-struct-ivar-1.mm
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -fblocks -rewrite-objc -fms-extensions %s -o %t-rw.cpp
+// RUN: %clang_cc1 -Werror -fsyntax-only -Wno-address-of-temporary -Wno-c++11-narrowing -std=c++11 -D"Class=void*" -D"id=void*" -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp
+// rdar://11323187
+
+typedef unsigned long NSUInteger;
+
+typedef struct _NSRange {
+ NSUInteger location;
+ NSUInteger length;
+} NSRange;
+
+typedef struct {
+ NSUInteger _capacity;
+ NSRange _ranges[0];
+} _NSRangeInfo;
+
+@interface Foo{
+ @protected
+ struct _bar {
+ int x:1;
+ int y:1;
+ } bar;
+ union {
+ struct {
+ NSRange _range;
+ } _singleRange;
+ struct {
+ void * _data;
+ void *_reserved;
+ } _multipleRanges;
+ } _internal;
+}
+@end
+@implementation Foo
+- (void)x:(Foo *)other {
+ bar.x = 0;
+ bar.y = 1;
+ self->_internal._singleRange._range = (( other ->bar.x) ? &( other ->_internal._singleRange._range) : ((NSRange *)(&(((_NSRangeInfo *)( other ->_internal._multipleRanges._data))->_ranges))))[0];
+}
+@end
+@interface FooS : Foo
+@end
+@implementation FooS
+- (void)y {
+
+ NSUInteger asdf = (( self ->bar.x) ? 1 : ((_NSRangeInfo *)( self ->_internal._multipleRanges._data))->_capacity );
+}
+@end
diff --git a/test/Rewriter/rewrite-modern-struct-ivar.mm b/test/Rewriter/rewrite-modern-struct-ivar.mm
index 09c02dffab19..9f56cd8b1b83 100644
--- a/test/Rewriter/rewrite-modern-struct-ivar.mm
+++ b/test/Rewriter/rewrite-modern-struct-ivar.mm
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -E %s -o %t.mm
// RUN: %clang_cc1 -fblocks -rewrite-objc -fms-extensions %t.mm -o %t-rw.cpp
// RUN: FileCheck --input-file=%t-rw.cpp %s
-// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -Wno-c++11-narrowing -std=c++11 -D"Class=void*" -D"id=void*" -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp
struct S {
int i1;
@@ -20,5 +20,33 @@ struct S {
@implementation I
- (struct S) dMeth{ return struct_ivar; }
@end
-
+
// CHECK: return (*(struct S *)((char *)self + OBJC_IVAR_$_I$struct_ivar));
+
+// rdar://11323187
+@interface Foo{
+ @protected
+ struct {
+ int x:1;
+ int y:1;
+ } bar;
+
+ struct _S {
+ int x:1;
+ int y:1;
+ } s;
+
+}
+@end
+@implementation Foo
+- (void)x {
+ bar.x = 0;
+ bar.y = 1;
+
+ s.x = 0;
+ s.y = 1;
+}
+@end
+
+// CHECK: (*(decltype(((Foo_IMPL *)0U)->bar) *)((char *)self + OBJC_IVAR_$_Foo$bar)).x = 0;
+// CHECK: (*(struct _S *)((char *)self + OBJC_IVAR_$_Foo$s)).x = 0;
diff --git a/test/Rewriter/rewrite-modern-typeof.mm b/test/Rewriter/rewrite-modern-typeof.mm
index 4650ab7b7f30..a493c1184967 100644
--- a/test/Rewriter/rewrite-modern-typeof.mm
+++ b/test/Rewriter/rewrite-modern-typeof.mm
@@ -2,6 +2,7 @@
// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -Wno-attributes -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+typedef unsigned long size_t;
extern "C" {
extern "C" void *_Block_copy(const void *aBlock);
extern "C" void _Block_release(const void *aBlock);
diff --git a/test/Rewriter/rewrite-nest.m b/test/Rewriter/rewrite-nest.m
index a08f9475d5d6..41bb875c680a 100644
--- a/test/Rewriter/rewrite-nest.m
+++ b/test/Rewriter/rewrite-nest.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@interface NSMapTable @end
@interface NSEnumerator @end
diff --git a/test/Rewriter/rewrite-nested-blocks-1.mm b/test/Rewriter/rewrite-nested-blocks-1.mm
index 25b17cfce179..8981777b8e95 100644
--- a/test/Rewriter/rewrite-nested-blocks-1.mm
+++ b/test/Rewriter/rewrite-nested-blocks-1.mm
@@ -1,9 +1,10 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -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"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
// radar 7696893
+typedef unsigned long size_t;
void *sel_registerName(const char *);
void f(void (^block)(void));
diff --git a/test/Rewriter/rewrite-nested-blocks-2.mm b/test/Rewriter/rewrite-nested-blocks-2.mm
index d1513f3a5fa0..46afdf16889c 100644
--- a/test/Rewriter/rewrite-nested-blocks-2.mm
+++ b/test/Rewriter/rewrite-nested-blocks-2.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// grep "static void __FUNC_block_copy_" %t-rw.cpp | count 2
// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
@@ -6,6 +6,7 @@
// grep "static void __FUNC_block_copy_" %t-modern-rw.cpp | count 2
// rdar://8499592
+typedef unsigned long size_t;
void Outer(void (^bk)());
void Inner(void (^bk)());
void INNER_FUNC(id d);
diff --git a/test/Rewriter/rewrite-nested-blocks.mm b/test/Rewriter/rewrite-nested-blocks.mm
index d492afa18d49..16a9b31415a8 100644
--- a/test/Rewriter/rewrite-nested-blocks.mm
+++ b/test/Rewriter/rewrite-nested-blocks.mm
@@ -1,10 +1,11 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 7682149
+typedef unsigned long size_t;
void f(void (^block)(void));
@interface X {
diff --git a/test/Rewriter/rewrite-nested-ivar.mm b/test/Rewriter/rewrite-nested-ivar.mm
index bab221d33f35..07fc2f51b404 100644
--- a/test/Rewriter/rewrite-nested-ivar.mm
+++ b/test/Rewriter/rewrite-nested-ivar.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -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-rw-modern.cpp
// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw-modern.cpp
diff --git a/test/Rewriter/rewrite-nested-property-in-blocks.mm b/test/Rewriter/rewrite-nested-property-in-blocks.mm
index 7f9361ed0788..d029559b64f8 100755
--- a/test/Rewriter/rewrite-nested-property-in-blocks.mm
+++ b/test/Rewriter/rewrite-nested-property-in-blocks.mm
@@ -1,9 +1,10 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fms-extensions -Wno-address-of-temporary -Did="void *" -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 -fms-extensions -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
// radar 8608293
+typedef unsigned long size_t;
void *sel_registerName(const char *);
extern "C" void nowarn(id);
diff --git a/test/Rewriter/rewrite-no-nextline.mm b/test/Rewriter/rewrite-no-nextline.mm
index 4ef37157f748..51f412f3e7ca 100644
--- a/test/Rewriter/rewrite-no-nextline.mm
+++ b/test/Rewriter/rewrite-no-nextline.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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
// radar 7946975
diff --git a/test/Rewriter/rewrite-property-attributes.mm b/test/Rewriter/rewrite-property-attributes.mm
index c70760353f8c..4a8b1972779c 100644
--- a/test/Rewriter/rewrite-property-attributes.mm
+++ b/test/Rewriter/rewrite-property-attributes.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// radar 7214439
diff --git a/test/Rewriter/rewrite-property-set-cfstring.mm b/test/Rewriter/rewrite-property-set-cfstring.mm
index 3ac90656ba04..9de76428ada6 100644
--- a/test/Rewriter/rewrite-property-set-cfstring.mm
+++ b/test/Rewriter/rewrite-property-set-cfstring.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar:// 8527018
diff --git a/test/Rewriter/rewrite-protocol-property.mm b/test/Rewriter/rewrite-protocol-property.mm
index 3a53f2377fc4..c3f154c8526a 100644
--- a/test/Rewriter/rewrite-protocol-property.mm
+++ b/test/Rewriter/rewrite-protocol-property.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -Did="void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar:// 8558702
diff --git a/test/Rewriter/rewrite-protocol-qualified.mm b/test/Rewriter/rewrite-protocol-qualified.mm
index f828724a1568..7a7eed737311 100644
--- a/test/Rewriter/rewrite-protocol-qualified.mm
+++ b/test/Rewriter/rewrite-protocol-qualified.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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"id=void*" -D"__declspec(X)=" %t-rw.cpp
// radar 7589414
diff --git a/test/Rewriter/rewrite-protocol-type-1.m b/test/Rewriter/rewrite-protocol-type-1.m
index 5246df45ffc6..2ecae8b584a7 100644
--- a/test/Rewriter/rewrite-protocol-type-1.m
+++ b/test/Rewriter/rewrite-protocol-type-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@protocol MyProto1
@end
diff --git a/test/Rewriter/rewrite-qualified-id.mm b/test/Rewriter/rewrite-qualified-id.mm
index f54bae9c3718..428b65563cc3 100644
--- a/test/Rewriter/rewrite-qualified-id.mm
+++ b/test/Rewriter/rewrite-qualified-id.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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
// radar 7680953
diff --git a/test/Rewriter/rewrite-rewritten-initializer.mm b/test/Rewriter/rewrite-rewritten-initializer.mm
index 14734f9af2c3..25d16253607d 100644
--- a/test/Rewriter/rewrite-rewritten-initializer.mm
+++ b/test/Rewriter/rewrite-rewritten-initializer.mm
@@ -1,7 +1,10 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %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 -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw-modern.cpp
+// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw-modern.cpp
// radar 7669784
+typedef unsigned long size_t;
typedef void * id;
void *sel_registerName(const char *);
diff --git a/test/Rewriter/rewrite-static-block.mm b/test/Rewriter/rewrite-static-block.mm
index 4ee227ea91d2..ed720e034a28 100644
--- a/test/Rewriter/rewrite-static-block.mm
+++ b/test/Rewriter/rewrite-static-block.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp -emit-llvm -o %t-rw.ll
// RUN: FileCheck --input-file=%t-rw.ll %s
diff --git a/test/Rewriter/rewrite-super-message.mm b/test/Rewriter/rewrite-super-message.mm
index d770b33750e5..45d7e1301f21 100644
--- a/test/Rewriter/rewrite-super-message.mm
+++ b/test/Rewriter/rewrite-super-message.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -DKEEP_ATTRIBUTES -D"id=struct objc_object *" -D"Class=struct objc_class *" -D"SEL=void*" -D"__declspec(X)=" -emit-llvm -o - %t-rw.cpp | FileCheck %t-rw.cpp
// radar 7738453
diff --git a/test/Rewriter/rewrite-trivial-constructor.mm b/test/Rewriter/rewrite-trivial-constructor.mm
index f14f4b15b3bf..e343a383102a 100644
--- a/test/Rewriter/rewrite-trivial-constructor.mm
+++ b/test/Rewriter/rewrite-trivial-constructor.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fms-extensions -rewrite-objc -fobjc-fragile-abi -x objective-c++ -fblocks -o - %s
+// RUN: %clang_cc1 -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -x objective-c++ -fblocks -o - %s
// radar 7537770
typedef struct {
diff --git a/test/Rewriter/rewrite-try-catch.m b/test/Rewriter/rewrite-try-catch.m
index b4d13b6ac2fe..8720d0c9b91b 100644
--- a/test/Rewriter/rewrite-try-catch.m
+++ b/test/Rewriter/rewrite-try-catch.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@interface Foo @end
@interface GARF @end
diff --git a/test/Rewriter/rewrite-typeof.mm b/test/Rewriter/rewrite-typeof.mm
index 24e3bcc55bce..02c36f88a569 100644
--- a/test/Rewriter/rewrite-typeof.mm
+++ b/test/Rewriter/rewrite-typeof.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
extern "C" {
diff --git a/test/Rewriter/rewrite-unique-block-api.mm b/test/Rewriter/rewrite-unique-block-api.mm
index 1dcc1b67fe7b..85ead11d2fab 100644
--- a/test/Rewriter/rewrite-unique-block-api.mm
+++ b/test/Rewriter/rewrite-unique-block-api.mm
@@ -1,9 +1,10 @@
-// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -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++ -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 7630551
+typedef unsigned long size_t;
void f(void (^b)(char c));
@interface a
diff --git a/test/Rewriter/rewrite-user-defined-accessors.mm b/test/Rewriter/rewrite-user-defined-accessors.mm
index 3c38e178d619..24d7b05d7aa5 100644
--- a/test/Rewriter/rewrite-user-defined-accessors.mm
+++ b/test/Rewriter/rewrite-user-defined-accessors.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -Did="void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar:// 8570020
diff --git a/test/Rewriter/rewrite-vararg.m b/test/Rewriter/rewrite-vararg.m
index bd58a6acf3c3..ff7b250f809f 100644
--- a/test/Rewriter/rewrite-vararg.m
+++ b/test/Rewriter/rewrite-vararg.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
+// 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 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar://9056351
diff --git a/test/Rewriter/rewrite-weak-attr.m b/test/Rewriter/rewrite-weak-attr.m
index 60c6fc881a83..f8eb3b727e0f 100644
--- a/test/Rewriter/rewrite-weak-attr.m
+++ b/test/Rewriter/rewrite-weak-attr.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -fblocks -Dnil=0 -rewrite-objc -fobjc-fragile-abi -o - %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -fblocks -Dnil=0 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -o - %s
int main() {
__weak __block id foo = nil;
__block id foo2 = nil;
diff --git a/test/Rewriter/static-type-protocol-1.m b/test/Rewriter/static-type-protocol-1.m
index bafe2860d1c0..dbf9d38670fc 100644
--- a/test/Rewriter/static-type-protocol-1.m
+++ b/test/Rewriter/static-type-protocol-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@protocol Proto
- (void) ProtoDidget;
diff --git a/test/Rewriter/undecl-objc-h.m b/test/Rewriter/undecl-objc-h.m
index 5c3e6930da06..2581aa598a89 100644
--- a/test/Rewriter/undecl-objc-h.m
+++ b/test/Rewriter/undecl-objc-h.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
typedef struct S {
int * pint;
diff --git a/test/Rewriter/undeclared-method-1.m b/test/Rewriter/undeclared-method-1.m
index 9b4ca1920ba0..a52c677bc721 100644
--- a/test/Rewriter/undeclared-method-1.m
+++ b/test/Rewriter/undeclared-method-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@interface Derived @end
diff --git a/test/Rewriter/undef-field-reference-1.m b/test/Rewriter/undef-field-reference-1.m
index 9c067a80a4e9..07bd21b756c9 100644
--- a/test/Rewriter/undef-field-reference-1.m
+++ b/test/Rewriter/undef-field-reference-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
@interface MyDerived
{
diff --git a/test/Rewriter/va-method.m b/test/Rewriter/va-method.m
index c232d2359413..78d9367819b5 100644
--- a/test/Rewriter/va-method.m
+++ b/test/Rewriter/va-method.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
#include <stdarg.h>
diff --git a/test/Rewriter/weak_byref_objects.m b/test/Rewriter/weak_byref_objects.m
index 1b9efbe573b4..09d30ed268b0 100644
--- a/test/Rewriter/weak_byref_objects.m
+++ b/test/Rewriter/weak_byref_objects.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fblocks -triple i386-apple-darwin9 -fobjc-gc -rewrite-objc -fobjc-fragile-abi %s -o -
+// RUN: %clang_cc1 -fblocks -triple i386-apple-darwin9 -fobjc-gc -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -
#define nil 0
int main() {