summaryrefslogtreecommitdiffstats
path: root/clang/test/ARCMT
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-08 02:02:38 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-08 02:02:38 +0000
commit2519a0801fde7baa660e66f78594e03f7324012e (patch)
tree7ac4a25dd4bf892a60b7d10ea11b3932e3cc365d /clang/test/ARCMT
parentfb3cb9a861727ce72854acbd43d8e0e3a34720ef (diff)
downloadbcm5719-llvm-2519a0801fde7baa660e66f78594e03f7324012e.tar.gz
bcm5719-llvm-2519a0801fde7baa660e66f78594e03f7324012e.zip
[arcmt] When we already removed a __weak, don't try to change it to __unsafe_unretained
later on, or we will end up with a redundant '__unsafe_unretained'. llvm-svn: 144059
Diffstat (limited to 'clang/test/ARCMT')
-rw-r--r--clang/test/ARCMT/GC-no-arc-runtime.m73
-rw-r--r--clang/test/ARCMT/GC-no-arc-runtime.m.result68
2 files changed, 141 insertions, 0 deletions
diff --git a/clang/test/ARCMT/GC-no-arc-runtime.m b/clang/test/ARCMT/GC-no-arc-runtime.m
new file mode 100644
index 00000000000..2a43f18004f
--- /dev/null
+++ b/clang/test/ARCMT/GC-no-arc-runtime.m
@@ -0,0 +1,73 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -x objective-c %s.result
+// RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-gc-only -x objective-c %s > %t
+// RUN: diff %t %s.result
+// RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-gc-only -x objective-c++ %s > %t
+// RUN: diff %t %s.result
+
+#include "Common.h"
+#include "GC.h"
+
+void test1(CFTypeRef *cft) {
+ id x = NSMakeCollectable(cft);
+}
+
+@interface I1 {
+ __strong I1 *myivar;
+}
+@end
+
+@implementation I1
+-(void)dealloc {
+ // dealloc
+ test1(0);
+}
+
+-(void)finalize {
+ // finalize
+ test1(0);
+}
+@end
+
+@interface I2
+@property (retain) id prop;
+@end
+
+@implementation I2
+@synthesize prop;
+
+-(void)finalize {
+ self.prop = 0;
+ // finalize
+ test1(0);
+}
+@end
+
+__attribute__((objc_arc_weak_reference_unavailable))
+@interface QQ {
+ __weak id s;
+ __weak QQ *q;
+}
+@end
+
+@interface I3
+@property (assign) I3 *__weak pw1, *__weak pw2;
+@property (assign) I3 *__strong ps;
+@property (assign) I3 * pds;
+@end
+
+@interface I4Impl {
+ I4Impl *pds2;
+}
+@property (assign) I4Impl *__weak pw1, *__weak pw2;
+@property (assign) I4Impl *__strong ps;
+@property (assign) I4Impl * pds;
+@property (assign) I4Impl * pds2;
+@end
+
+@implementation I4Impl
+@synthesize pw1, pw2, ps, pds, pds2;
+
+-(void)test1:(CFTypeRef *)cft {
+ id x = NSMakeCollectable(cft);
+}
+@end
diff --git a/clang/test/ARCMT/GC-no-arc-runtime.m.result b/clang/test/ARCMT/GC-no-arc-runtime.m.result
new file mode 100644
index 00000000000..567f804698c
--- /dev/null
+++ b/clang/test/ARCMT/GC-no-arc-runtime.m.result
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -x objective-c %s.result
+// RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-gc-only -x objective-c %s > %t
+// RUN: diff %t %s.result
+// RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-gc-only -x objective-c++ %s > %t
+// RUN: diff %t %s.result
+
+#include "Common.h"
+#include "GC.h"
+
+void test1(CFTypeRef *cft) {
+ id x = CFBridgingRelease(cft);
+}
+
+@interface I1 {
+ I1 *myivar;
+}
+@end
+
+@implementation I1
+-(void)dealloc {
+ // dealloc
+ test1(0);
+}
+
+@end
+
+@interface I2
+@property id prop;
+@end
+
+@implementation I2
+@synthesize prop;
+
+-(void)dealloc {
+ // finalize
+ test1(0);
+}
+@end
+
+__attribute__((objc_arc_weak_reference_unavailable))
+@interface QQ {
+ __unsafe_unretained id s;
+ __unsafe_unretained QQ *q;
+}
+@end
+
+@interface I3
+@property (unsafe_unretained) I3 * pw1, * pw2;
+@property (strong) I3 * ps;
+@property (assign) I3 * pds;
+@end
+
+@interface I4Impl {
+ I4Impl *pds2;
+}
+@property (unsafe_unretained) I4Impl * pw1, * pw2;
+@property I4Impl * ps;
+@property I4Impl * pds;
+@property I4Impl * pds2;
+@end
+
+@implementation I4Impl
+@synthesize pw1, pw2, ps, pds, pds2;
+
+-(void)test1:(CFTypeRef *)cft {
+ id x = CFBridgingRelease(cft);
+}
+@end
OpenPOWER on IntegriCloud