summaryrefslogtreecommitdiff
path: root/clang/test/ARCMT/check-with-serialized-diag.m
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
commitbe1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch)
tree1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/ARCMT/check-with-serialized-diag.m
parentc4626a62754862d20b41e8a46a3574264ea80e6d (diff)
parentf1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff)
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/ARCMT/check-with-serialized-diag.m')
-rw-r--r--clang/test/ARCMT/check-with-serialized-diag.m55
1 files changed, 55 insertions, 0 deletions
diff --git a/clang/test/ARCMT/check-with-serialized-diag.m b/clang/test/ARCMT/check-with-serialized-diag.m
new file mode 100644
index 0000000..d8073d0
--- /dev/null
+++ b/clang/test/ARCMT/check-with-serialized-diag.m
@@ -0,0 +1,55 @@
+
+@protocol NSObject
+- (id)retain;
+- (unsigned)retainCount;
+- (oneway void)release;
+- (id)autorelease;
+@end
+
+@interface NSObject <NSObject> {}
+- (id)init;
+
++ (id)new;
++ (id)alloc;
+- (void)dealloc;
+
+- (void)finalize;
+
+- (id)copy;
+- (id)mutableCopy;
+@end
+
+@interface A : NSObject
+@end
+
+struct UnsafeS {
+ A *__unsafe_unretained unsafeObj;
+};
+
+id global_foo;
+
+void test1(A *a, struct UnsafeS *unsafeS) {
+ [unsafeS->unsafeObj retain];
+ id foo = [unsafeS->unsafeObj retain]; // no warning.
+ [global_foo retain];
+ [a retainCount];
+}
+
+// RUN: not %clang_cc1 -arcmt-check -triple x86_64-apple-darwin10 %s -serialize-diagnostic-file %t.diag
+// RUN: c-index-test -read-diagnostics %t.diag > %t 2>&1
+// RUN: FileCheck --input-file=%t %s
+
+// CHECK: {{.*}}check-with-serialized-diag.m:32:4: error: [rewriter] it is not safe to remove 'retain' message on an __unsafe_unretained type
+// CHECK-NEXT: Number FIXITs = 0
+// CHECK-NEXT: {{.*}}check-with-serialized-diag.m:34:4: error: [rewriter] it is not safe to remove 'retain' message on a global variable
+// CHECK-NEXT: Number FIXITs = 0
+// CHECK-NEXT: {{.*}}check-with-serialized-diag.m:32:4: error: ARC forbids explicit message send of 'retain'
+// CHECK-NEXT: Range: {{.*}}check-with-serialized-diag.m:32:23 {{.*}}check-with-serialized-diag.m:32:29
+// CHECK-NEXT: Number FIXITs = 0
+// CHECK-NEXT: {{.*}}check-with-serialized-diag.m:34:4: error: ARC forbids explicit message send of 'retain'
+// CHECK-NEXT: Range: {{.*}}check-with-serialized-diag.m:34:15 {{.*}}check-with-serialized-diag.m:34:21
+// CHECK-NEXT: Number FIXITs = 0
+// CHECK-NEXT: {{.*}}check-with-serialized-diag.m:35:4: error: ARC forbids explicit message send of 'retainCount'
+// CHECK-NEXT: Range: {{.*}}check-with-serialized-diag.m:35:6 {{.*}}check-with-serialized-diag.m:35:17
+// CHECK-NEXT: Number FIXITs = 0
+