]> granicus.if.org Git - clang/commitdiff
[arcmt] Un-XFAIL a test.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 9 Dec 2011 00:17:47 +0000 (00:17 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 9 Dec 2011 00:17:47 +0000 (00:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146210 91177308-0d34-0410-b5e6-96231b3b80d8

test/ARCMT/checking.m

index 86afdf0b237e8690d4a251bd08c3dcfc99647b94..7d1a8c7321eabfce144ffedfc5be985aa56e0ab2 100644 (file)
@@ -1,7 +1,33 @@
 // RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 %s
-// XFAIL: *
 
-#include "Common.h"
+#if __has_feature(objc_arc)
+#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode")))
+#else
+#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE
+#endif
+
+typedef int BOOL;
+typedef unsigned NSUInteger;
+
+@protocol NSObject
+- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE; // expected-note {{unavailable here}}
+- (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
+- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE; // expected-note 4 {{unavailable here}}
+- (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
+@end
+
+@interface NSObject <NSObject> {}
+- (id)init;
+
++ (id)new;
++ (id)alloc;
+- (void)dealloc;
+
+- (void)finalize;
+
+- (id)copy;
+- (id)mutableCopy;
+@end
 
 typedef const struct __CFString * CFStringRef;
 extern const CFStringRef kUTTypePlainText;
@@ -44,16 +70,20 @@ id global_foo;
 
 void test1(A *a, BOOL b, struct UnsafeS *unsafeS) {
   [[a delegate] release]; // expected-error {{it is not safe to remove 'retain' message on the result of a 'delegate' message; the object that was passed to 'setDelegate:' may not be properly retained}} \
-                          // expected-error {{ARC forbids explicit message send}}
+                          // expected-error {{ARC forbids explicit message send}} \
+                          // expected-error {{unavailable}}
   [a.delegate release]; // expected-error {{it is not safe to remove 'retain' message on the result of a 'delegate' message; the object that was passed to 'setDelegate:' may not be properly retained}} \
-                        // expected-error {{ARC forbids explicit message send}}
+                        // expected-error {{ARC forbids explicit message send}} \
+                        // expected-error {{unavailable}}
   [unsafeS->unsafeObj retain]; // expected-error {{it is not safe to remove 'retain' message on an __unsafe_unretained type}} \
                                // expected-error {{ARC forbids explicit message send}}
   id foo = [unsafeS->unsafeObj retain]; // no warning.
   [global_foo retain]; // expected-error {{it is not safe to remove 'retain' message on a global variable}} \
-                       // expected-error {{ARC forbids explicit message send}}
+                       // expected-error {{ARC forbids explicit message send}} \
+                       // expected-error {{unavailable}}
   [global_foo release]; // expected-error {{it is not safe to remove 'release' message on a global variable}} \
-                        // expected-error {{ARC forbids explicit message send}}
+                        // expected-error {{ARC forbids explicit message send}} \
+                        // expected-error {{unavailable}}
   [a dealloc];
   [a retain];
   [a retainCount]; // expected-error {{ARC forbids explicit message send of 'retainCount'}}
@@ -267,7 +297,8 @@ void rdar9491791(int p) {
 
 // rdar://9504750
 void rdar9504750(id p) {
-  RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}}
+  RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}} \
+                    // expected-error {{unavailable}}
 }
 
 // rdar://8939557