[cfe-commits] r146210 - /cfe/trunk/test/ARCMT/checking.m

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Dec 8 16:17:47 PST 2011


Author: akirtzidis
Date: Thu Dec  8 18:17:47 2011
New Revision: 146210

URL: http://llvm.org/viewvc/llvm-project?rev=146210&view=rev
Log:
[arcmt] Un-XFAIL a test.

Modified:
    cfe/trunk/test/ARCMT/checking.m

Modified: cfe/trunk/test/ARCMT/checking.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/checking.m?rev=146210&r1=146209&r2=146210&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/checking.m (original)
+++ cfe/trunk/test/ARCMT/checking.m Thu Dec  8 18:17:47 2011
@@ -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;
+
+ at 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;
+ at end
+
+ at interface NSObject <NSObject> {}
+- (id)init;
+
++ (id)new;
++ (id)alloc;
+- (void)dealloc;
+
+- (void)finalize;
+
+- (id)copy;
+- (id)mutableCopy;
+ at end
 
 typedef const struct __CFString * CFStringRef;
 extern const CFStringRef kUTTypePlainText;
@@ -44,16 +70,20 @@
 
 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 @@
 
 // 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





More information about the cfe-commits mailing list