summaryrefslogtreecommitdiff
path: root/test/Rewriter
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-02-07 01:53:15 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-02-07 01:53:15 +0000
commitcd3b036dbdd29b0ddcaa12b5cce69b647b2ac5ba (patch)
tree602d8d125a545b7b150abf11c4335e36aaa2d407 /test/Rewriter
parent4a19052fe91c988885c722252ef03ce5f762a73c (diff)
objective-C modern translator. Fix up the translated
metadata to handle ivar bitfields. This is wip. // rdar://13138459 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174573 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Rewriter')
-rw-r--r--test/Rewriter/modern-write-bf-abi.mm52
-rw-r--r--test/Rewriter/unnamed-bf-modern-write.mm16
2 files changed, 62 insertions, 6 deletions
diff --git a/test/Rewriter/modern-write-bf-abi.mm b/test/Rewriter/modern-write-bf-abi.mm
new file mode 100644
index 0000000000..9f44564008
--- /dev/null
+++ b/test/Rewriter/modern-write-bf-abi.mm
@@ -0,0 +1,52 @@
+// 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
+// rdar://13138459
+
+// -Did="void*" -DSEL="void *" -DClass="void*"
+@interface NSMutableArray {
+ id isa;
+}
+@end
+
+typedef unsigned char BOOL;
+typedef unsigned long NSUInteger;
+
+__attribute__((visibility("hidden")))
+@interface __NSArrayM : NSMutableArray {
+ NSUInteger _used;
+ NSUInteger _doHardRetain:1;
+ NSUInteger _doWeakAccess:1;
+#if __LP64__
+ NSUInteger _size:62;
+#else
+ NSUInteger _size:30;
+#endif
+ NSUInteger _hasObjects:1;
+ NSUInteger _hasStrongReferences:1;
+#if __LP64__
+ NSUInteger _offset:62;
+#else
+ NSUInteger _offset:30;
+#endif
+ unsigned long _mutations;
+ id *_list;
+}
+@end
+
+
+id __CFAllocateObject2();
+BOOL objc_collectingEnabled();
+
+@implementation __NSArrayM
++ (id)__new:(const id [])objects :(NSUInteger)count :(BOOL)hasObjects :(BOOL)hasStrong :(BOOL)transferRetain {
+ __NSArrayM *newArray = (__NSArrayM *)__CFAllocateObject2();
+ newArray->_size = count;
+ newArray->_mutations = 1;
+ newArray->_doHardRetain = (hasObjects && hasStrong);
+ newArray->_doWeakAccess = (objc_collectingEnabled() && !hasStrong);
+ newArray->_hasObjects = hasObjects;
+ newArray->_hasStrongReferences = hasStrong;
+ newArray->_list = 0;
+ return *newArray->_list;
+}
+@end
diff --git a/test/Rewriter/unnamed-bf-modern-write.mm b/test/Rewriter/unnamed-bf-modern-write.mm
index 892382ff97..209cdd6035 100644
--- a/test/Rewriter/unnamed-bf-modern-write.mm
+++ b/test/Rewriter/unnamed-bf-modern-write.mm
@@ -1,5 +1,6 @@
// 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://13138459
@interface Foo {
@private
@@ -13,11 +14,14 @@
@implementation Foo
@end
+// CHECK: struct Foo__T_1 {
+// CHECK-NEXT: int : 1;
+// CHECK-NEXT: int third : 1;
+// CHECK-NEXT: int : 1;
+// CHECK-NEXT: int fifth : 1;
+// CHECK-NEXT: char : 0;
+// CHECK-NEXT: } ;
// CHECK: struct Foo_IMPL {
-// CHECK-NEXT: int first;
-// CHECK-NEXT: int : 1;
-// CHECK-NEXT: int third : 1;
-// CHECK-NEXT: int : 1;
-// CHECK-NEXT: int fifth : 1;
-// CHECK-NEXT: char : 0;
+// CHECK-NEXT: int first;
+// CHECK-NEXT: struct Foo__T_1 Foo__GRBF_1;
// CHECK-NEXT: };